References
WavePropBase.INTERFACE — Constantconst INTERFACEMethods comprising the package's interface.
WavePropBase.ambient_dimension — Functionambient_dimension(x)Dimension of the ambient space where x lives. For geometrical objects this can differ from its geometric_dimension; for example a triangle in ℝ³ has ambient dimension 3 but geometric dimension 2, while a curve in ℝ³ has ambient dimension 3 but geometric dimension 1.
WavePropBase.boundary — Functionboundary(ω)Return the boundary of ω. For a mesh element gives the d-1 dimensional elements composing its boundary, while for an entity gives the corresponding d-1 dimensional entities.
WavePropBase.center — Functioncenter(Ω)Center of the smallest possible ball containing Ω.
WavePropBase.coords — Functioncoords(x)Return an SVector giving a cartesian coordinate used to sort x. For points, this is simply the coordinates of the point, while for elements this may be the center of the element. You must overload this function for your own type if you want e.g. the clustering algorithms to work for x.
WavePropBase.diameter — Functiondiameter(Ω)Largest distance between x and y for x,y ∈ Ω.
WavePropBase.dimension — Functiondimension(space)The length of a basis for space; i.e. the number of linearly independent elements required to span space.
WavePropBase.distance — Functiondistance(Ω₁,Ω₂)Minimal Euclidean distance between Ω₁ and Ω₂.
WavePropBase.domain — Functiondomain(f)The domain of the function f; i.e. if f: Ω → R, return Ω.
WavePropBase.geometric_dimension — Functiongeometric_dimension(x)
geometric_dimension(Ω::Domain)Number of degrees of freedom necessary to locally represent the geometrical object. For example, lines have geometric dimension of 1 (whether in ℝ² or in ℝ³), while surfaces have geometric dimension of 2.
When the argument is a Domain, return the largest geometric dimension encoutered.
WavePropBase.image — Functionimage(f)The image of the function f; i.e. if f: Ω → R, return R.
WavePropBase.jacobian — Functionjacobian(f,x)Given a (possibly vector-valued) function f : 𝐑ᵐ → 𝐅ᵐ, return the m × n matrix Aᵢⱼ = ∂fᵢ/∂xⱼ.
WavePropBase.normal — Functionnormal(el,x̂)
normal(jac::SMatrix)The unit normal vector at coordinate x̂, guaranteed to be orthogonal to all columns of jacobian(el,x).
WavePropBase.parametrization — Functionparametrization(el)Return the underlying parametrization of el.
WavePropBase.radius — Functionradius(Ω)Half the diameter.
WavePropBase.return_type — Functionreturn_type(f)The type returned by function-like objects.
WavePropBase.@export_interface — Macromacro export_interface()Export all symbols inside INTERFACE.
WavePropBase.@import_interface — Macromacro import_interface()Import all symbols inside INTERFACE.
WavePropBase.Utils — ModuleUtilsModule containing various utility functions for WaveProp.
WavePropBase.Utils.SType — Typeconst SType{T} = Union{T,Type{T}}Union type of T and its data type Type{T}. Used to simplify methods defined on singleton types where both foo(::T) and foo(::Type{T}) are required.
WavePropBase.Utils.abstractmethod — MethodabstractmethodA method of an abstract type for which concrete subtypes are expected to provide an implementation.
WavePropBase.Utils.assert_extension — Functionassert_extension(fname,ext,[msg])Check that fname is of extension ext. Print the message msg as an assertion error otherwise.
WavePropBase.Utils.blockmatrix_to_matrix — Methodblockmatrix_to_matrix(A::Matrix{B}) where {B<:SMatrix}Convert a Matrix{B}, where B<:SMatrix, to the equivalent Matrix{T}, where T = eltype(B)
WavePropBase.Utils.blockvector_to_vector — Methodblockvector_to_vector(A::Vector{B}) where {B<:SVector}Convert a Vector{B}, where B<:SVector, to the equivalent Vector{T}, where T = eltype(B)
WavePropBase.Utils.cart2pol — Methodcart2pol(x,y)Map cartesian coordinates x,y to polar coordinates r,θ. The convention followed is that -π ≤ θ ≤ π.
WavePropBase.Utils.cart2sph — Methodcart2sph(x,y,z)Map cartesian coordinates x,y,z to spherical ones r, θ, φ representing the radius, elevation, and azimuthal angle respectively. The convention followed is that 0 ≤ θ ≤ π and -π < φ ≤ π.
WavePropBase.Utils.cross_product_matrix — Methodcross_product_matrix(v)Returns the matrix Aᵥ associated with the cross product v × ϕ so that v × ϕ = Aᵥϕ.
WavePropBase.Utils.diagonalblockmatrix_to_matrix — Methoddiagonalblockmatrix_to_matrix(A::Matrix{B}) where {B<:SMatrix}Convert a diagonal block matrix A::AbstractVector{B}, where A is the list of diagonal blocks and B<:SMatrix, to the equivalent SparseMatrixCSC{T}, where T = eltype(B).
WavePropBase.Utils.enable_debug — Methodenable_debug(mname)Activate debugging messages.
WavePropBase.Utils.matrix_to_blockmatrix — Methodmatrix_to_blockmatrix(A::Matrix,B)Convert a Matrix{T} to a Matrix{B}, where B<:Type{SMatrix}. The element type of B must match that of A, and the size of A must be divisible by the size of B along each dimension.
WavePropBase.Utils.notimplemented — Methodnotimplemented()Things which should probably be implemented at some point.
WavePropBase.Utils.pol2cart — Methodpol2cart(r,θ)Map polar coordinates r,θ to cartesian coordinates x,y.
WavePropBase.Utils.print_threads_info — Methodprint_threads_info()Prints in console the total number of threads.
WavePropBase.Utils.sort_by_type — Methodsort_by_type(v)Sort the elements of v into vectors vi according to their type. Return a Dict{DataType,Vector} mapping each type to a vector of that type.
Examples
v = [1,"a",3,"b"]
dict = sort_by_type(v)WavePropBase.Utils.sph2cart — Methodsph2cart(x,y,z)Map spherical coordinates r,θ,φ representing the radius, elevation, and azimuthal angle respectively, to cartesian ones x, y, z .
WavePropBase.Utils.svector — Methodsvector(f,n)Just like Base.ntuple, but convert output to an SVector.
WavePropBase.Utils.vector_to_blockvector — Methodvector_to_blockvector(A::Vector,B)Convert a Vector{T} to a Vector{B}, where B<:Type{SVector}. The element type of B must match that of A, and the size of A must be divisible by the size of B along each dimension.
WavePropBase.Utils.@interface — Macro@interface f [n=1]Declare that the function f is an interface function. The call f(args...) resolves to M.f(args...) where M is parent module of the args[n] object.
The somewhat contrived example below illustrates how this can be used to have a generic method defined in module A applied to a type defined on module B which is independent of A but which implements the interface function f:
module A
using WavePropBase.Utils
Utils.@interface foo
# a method which works on any type `x` implementing the `foo` function
do_work(x) = 2*foo(x)
end
module B
struct Foo end
foo(x::Foo) = 1
end
using .A
using .B
foo = B.Foo()
A.do_work(foo)
# output
2Note that if in the example above module A implements a generic version of foo, the call A.do_work(foo) would use that method instead based on the dispatch rules.
WavePropBase.Geometry — Modulemodule GeometryModule defining basic geometrical concepts.
WavePropBase.Geometry.ENTITIES — Constantconst ENTITIESGlobal dictionary storing the used entity tags (the value) for a given dimension (the key).
WavePropBase.Geometry.TAGS — Constantconst TAGS::Dict{Int,Vector{Int}}Global dictionary storing the used entity tags (the value) for a given dimension (the key).
WavePropBase.Geometry.AbstractEntity — Typeabstract type AbstractEntityEntity of geometrical nature. Identifiable throught its (dim,tag) key.
WavePropBase.Geometry.AbstractReferenceShape — Typeabstract type AbstractReferenceShape{N}A reference domain/shape in ℜᴺ.
Used mostly for defining more complex shapes as transformations mapping an AbstractReferenceShape into some region of ℜᴹ.
See e.g. ReferenceLine or ReferenceTriangle for some examples of concrete subtypes.
WavePropBase.Geometry.ComplexPoint2D — Typeconst ComplexPoint2D
const ComplexPoint2D(x1, x2)
const ComplexPoint2D(x::NTuple{2, ComplexF64})A complex 2D point, stored in a StaticArray. ComplexPoint2D = SVector{2, ComplexF64}.
WavePropBase.Geometry.ComplexPoint3D — Typeconst ComplexPoint3D
const ComplexPoint3D(x1, x2, x3)
const ComplexPoint3D(x::NTuple{3, ComplexF64})A complex 3D point, stored in a StaticArray. ComplexPoint3D = SVector{3, ComplexF64}.
WavePropBase.Geometry.Domain — Typestruct DomainRepresent a physical domain as a union of entities.
See also: AbstractEntity, ElementaryEntity.
WavePropBase.Geometry.ElementaryEntity — Typestruct ElementaryEntity <: AbstractEntityThe most basic representation of an AbstractEntity.
Fields:
dim::UInt8: the geometrical dimension of the entity (e.g. line hasdim=1, surface hasdim=2, etc)tag::Int64: an integer tag associated to the entityboundary::Vector{AbstractEntity}: the entities of dimensiondim-1forming the entity's boundary
WavePropBase.Geometry.ElementaryEntity — MethodElementaryEntity(dim,tag)Construct an ElementaryEntity with an empty boundary .
WavePropBase.Geometry.Point1D — Typeconst Point1D
const Point1D(x1)A point in 1D space, stored in a StaticArray. Point1D = SVector{1, Float64}.
WavePropBase.Geometry.Point2D — Typeconst Point2D
const Point2D(x1, x2)
const Point2D(x::NTuple{2, Float64})A point in 2D space, stored in a StaticArray. Point2D = SVector{2, Float64}.
WavePropBase.Geometry.Point3D — Typeconst Point3D
const Point3D(x1, x2, x3)
const Point3D(x::NTuple{3, Float64})A point in 3D space, stored in a StaticArray. Point3D = SVector{3, Float64}.
WavePropBase.Geometry.PointEntity — TypePointEntity{N,T} <: AbstractEntityZero-dimension geometrical entity. As a subtype of [AbstractEntity],(@ref) the (dim,tag) of all created point entities get added to the global ENTITIES. Intended usage is to build higher dimensionsional entities, and not to represent regular points such as grid points.
WavePropBase.Geometry.ReferenceHyperCube — Typestruct ReferenceHyperCube{N}Singleton type representing the axis-aligned hypercube in N dimensions with the lower corner at the origin and the upper-corner at (1,1,…,1).
WavePropBase.Geometry.ReferenceLine — Typestruct ReferenceLineSingleton type representing the [0,1] segment.
WavePropBase.Geometry.ReferencePoint — Typestruct ReferencePointSingleton type representing a reference zero-dimensional entitty (i.e. a point).
WavePropBase.Geometry.ReferenceSquare — Typeconst ReferenceSquare = ReferenceHyperCube{2}Singleton type representing the square with vertices (0,0),(0,1),(1,1),(1,0)
WavePropBase.Geometry.ReferenceTetrahedron — Typestruct ReferenceTetrahedronSingleton type representing the tetrahedron with vertices (0,0,0),(0,0,1),(0,1,0),(1,0,0)
WavePropBase.Geometry.ReferenceTriangle — Typestruct ReferenceTriangleSingleton type representing the triangle with vertices (0,0),(0,1),(1,0)
Base.:== — Method==(Ω1::AbstractEntity,Ω2::AbstractEntity)Two entities are considered equal geometric_dimension(Ω1)==geometric_dimension(Ω2) and abs(tag(Ω1))=abs(tag(Ω2)). For entities of co-dimension one, the sign of tag(Ω) is used to determine the orientation of the normal vector.
Notice that this implies dim and tag of an elementary entity should uniquely define it (up to the sign of tag), and therefore global variables like TAGS are needed to make sure newly created AbstractEntity have a new (dim,tag) identifier.
Base.:== — Method===(Ω1::Domain,Ω2::Domain)Two Domains are equal if all their entities are equal (regardless of order).
Base.in — Methodin(ω::ElementaryEntity,Ω::Domain)Check whether an ElementaryEntity belongs to a Domain by recursively checking whether it belongs to its boundary.
Base.iterate — Functioniterate(Ω::Domain)Iterating over a domain means iterating over its entities.
Base.keys — MethodReturn all tags of the elementary entities in the domain Ω corresponding to the dimension d.
Base.keys — MethodReturn all tags of the elementary entities in the domain Ω corresponding to the dimensions contained in dims.
Base.length — Methodlength(Ω:::Domain)The length of a domain corresponds to the number of elementary entities that make it.
WavePropBase.Geometry.assertequaldim — Methodassertequaldim(Ω1::Domain,Ω2::Domain)Check that two domains have same dimension.
If one of the domain (or both) are empty, the assertion is assumed to be true.
WavePropBase.Geometry.clear_entities! — Methodclear_entities!()Empty the global variables used to keep track of the various entities created.
WavePropBase.Geometry.entities — Methodentities(Ω::Domain)Return a vector of all elementary entities making up a domain.
WavePropBase.Geometry.external_boundary — MethodReturn the external boundaries inside a domain.
WavePropBase.Geometry.global_add_entity! — Methodglobal_add_entity!(ent::AbstractEntity)Add ent to the global dictionary ENTITIES and update TAGS with its (dim,tag) key. This function should be called by the inner constructor of every AbstractEntity; see the constructor of ElementaryEntity for an example.
WavePropBase.Geometry.internal_boundary — MethodReturn the internal boundaries inside a domain.
WavePropBase.Geometry.new_tag — Methodnew_tag(dim)Generate a unique tag for an AbstractEntity of dimension dim.
The implementation consists of adding one to the maximum value of TAGS[dim]
See also: TAGS.
WavePropBase.Geometry.skeleton — Methodskeleton(Ω::Domain)Return all the boundaries of the domain, i.e. the domain's skeleton.
WavePropBase.Geometry.tag — Methodtag(::AbstractEntity)Integer tag used to idetify geometrical entities.
WavePropBase.boundary — MethodWavePropBase.key — Methodkey(e::AbstractEntity)The (dim,tag) pair used as a key to identify geometrical entities.
WavePropBase.Trees — Modulemodule TreesModule defining some commonly used tree structures, as well as an interface for talking about trees inside the WaveProp organization.
WavePropBase.Trees.AbstractSplitter — Typeabstract type AbstractSplitterAn AbstractSplitter is used to split a ClusterTree. The interface requires the following methods:
should_split(clt,splitter): return aBooldetermining if theClusterTreeshould be further dividedsplit!(clt,splitter): perform the splitting of theClusterTreehandling the necessary data sorting.
See GeometricSplitter for an example of an implementation.
WavePropBase.Trees.AbstractTree — Typeabstract type AbstracTree endSupertype for tree-like objects.
WavePropBase.Trees.CardinalitySplitter — Typestruct CardinalitySplitter <: AbstractSplitterUsed to split a ClusterTree along the largest dimension if length(tree)>nmax. The split is performed so the data is evenly distributed amongst all children.
WavePropBase.Trees.ClusterTree — Typemutable struct ClusterTree{T,S,D}Tree structure used to cluster elements of type T into containers of type S. The method center(::T)::SVector is required for the clustering algorithms. An additional data field of type D can be associated with each node to store node-specific information (it defaults to D=Nothing).
Fields:
_elements::T: vector containing the sorted elements.container::S: container for the elements in the current node.index_range::UnitRange{Int}: indices of elements contained in the current node.loc2glob::Vector{Int}: permutation from the local indexing system to the
original (global) indexing system used as input in the construction of the tree.
children::Vector{ClusterTree{N,T,D}}parent::ClusterTree{N,T,D}data::D: generic data field of typeD.
WavePropBase.Trees.ClusterTree — MethodClusterTree(elements,splitter;[copy_elements=true])
ClusterTree{D}(points,splitter;[copy_elements=true])Construct a ClusterTree from the given elements using the splitting strategy encoded in splitter. If copy_elements is set to false, the elements argument are directly stored in the ClusterTree and are permuted during the tree construction.
WavePropBase.Trees.DyadicSplitter — Typestruct DyadicSplitterUsed to split an N dimensional ClusterTree into 2^N children until at most nmax points are contained in node.
WavePropBase.Trees.GeometricMinimalSplitter — Typestruct GeometricMinimalSplitter <: AbstractSplitterLike GeometricSplitter, but shrinks the children's containters.
WavePropBase.Trees.GeometricSplitter — Typestruct GeometricSplitter <: AbstractSplitterUsed to split a ClusterTree in half along the largest axis.
WavePropBase.Trees.PrincipalComponentSplitter — Typestruct PrincipalComponentSplitter <: AbstractSplitterBase.parent — Methodparent(t::AbstractTree)The node's parent. If t is a root, then parent(t)==t.
WavePropBase.Trees._binary_split! — Method_binary_split!(cluster::ClusterTree,dir,pos;parentcluster=cluster)
_binary_split!(cluster::ClusterTree,f;parentcluster=cluster)Split a ClusterTree into two, sorting all elements in the process. For each resulting child assign child.parent=parentcluster.
Passing a dir and pos arguments splits the bounding_box box of node along direction dir at position pos, then sorts all points into the resulting left/right nodes.
If passed a predicate f, each point is sorted according to whether f(x) returns true (point sorted on the left node) or false (point sorted on the right node). At the end a minimal HyperRectangle containing all left/right points is created.
WavePropBase.Trees.children — Methodchildren(t::AbstractTree)Iterable collection of the node's children.
WavePropBase.Trees.container — Methodcontainer(clt::ClusterTree)Return the object enclosing all the elements of the clt.
WavePropBase.Trees.container_type — Methodcontainer_type(clt::ClusterTree)Type used to enclose the elements of clt.
WavePropBase.Trees.depth — Functiondepth(tree::AbstractTree,acc=0)Recursive function to compute the depth of node in a a tree-like structure.
Overload this function if your structure has a more efficient way to compute depth (e.g. if it stores it in a field).
WavePropBase.Trees.element_type — Methodelement_type(clt::ClusterTree)Type of elements sorted in clt.
WavePropBase.Trees.elements — Methodelements(clt::ClusterTree)Iterable list of the elements inside clt.
WavePropBase.Trees.filter_tree — Functionfilter_tree(f,tree,isterminal=true)Return a vector containing all the nodes of tree such that filter(node)==true. The argument isterminal can be used to control whether to continue the search on children of nodes for which f(node)==true.
WavePropBase.Trees.filter_tree! — Functionfilter_tree!(filter,nodes,tree,[isterminal=true])Like filter_tree, but appends results to nodes.
WavePropBase.Trees.index_range — Methodindex_range(clt::ClusterTree)Indices of elements in root_elements(clt) which lie inside clt.
WavePropBase.Trees.isleaf — Methodisleaf(t)Return true if t has no children.
WavePropBase.Trees.isroot — Methodisroot(t)Return true if t is its own parent.
WavePropBase.Trees.loc2glob — Methodloc2glob(clt::ClusterTree)The permutation from the (local) indexing system of the elements of the clt to the (global) indexes used upon the construction of the tree.
WavePropBase.Trees.root_elements — Methodroot_elements(clt::ClusterTree)The elements contained in the root of the tree to which clt belongs.
WavePropBase.Trees.should_split — Methodshould_split(clt::ClusterTree,splitter::AbstractSplitter)Determine whether or not a ClusterTree should be further divided.
WavePropBase.Trees.split! — Methodsplit!(clt::ClusterTree,splitter::AbstractSplitter)Divide clt using the strategy implemented by splitter.
WavePropBase.distance — Methoddistance(X::ClusterTree, Y::ClusterTree)Distance between the containers of X and Y.
WavePropBase.Interpolation — Modulemodule InterpolationModule implementing various interpolation schemes commonly used in finite element and boundary element methods.
WavePropBase.Interpolation.AbstractElement — Typeabstract type AbstractElement{D,T}Elements given by a fixed interpolation schemes mapping points on the the domain D<:AbstractReferenceShape (of singleton type) to a value of type T.
Instances el of AbstractElement are expected to implement:
el(x̂): evaluate the interpolation scheme at the (reference) coordinatex̂ ∈ D.jacobian(el,x̂): evaluate the jacobian matrix of the interpolation at the (reference) coordinatex ∈ D.
For performance reasons, both el(x̂) and jacobian(el,x̂) should take as input a StaticVector and output a static vector or static array.
WavePropBase.Interpolation.AbstractHyperRectangle — Typeabstract type AbstractHyperRectangle{N,T} <: AbstractElement{ReferenceHyperCube{N},SVector{N,T}}Axis-aligned hyperrectangle in N dimensions with coordinates of type SVector{N,T}.
WavePropBase.Interpolation.AbstractPolynomialSpace — Typeabstract type AbstractPolynomialSpace{D}A polynomial space over D. This is a vector space under polynomial addition and scalar multiplication.
WavePropBase.Interpolation.HyperCube — Typestruct HyperCube{N,T}Axis-aligned hypercube in N dimensions given by low_corner::SVector{N,T} and side::T.
WavePropBase.Interpolation.HyperRectangle — Typestruct HyperRectangle{N,T}Axis-aligned hyperrectangle in N dimensions given by low_corner::SVector{N,T} and high_corner::SVector{N,T}.
WavePropBase.Interpolation.LagrangeElement — Typestruct LagrangeElement{D,Np,T} <: AbstractElement{D,T}Standard element over D <: AbstractReferenceShape commonly used in finite element methods. The underlying polynomial space is Pk{D,K}, and its interpolant maps the Np reference_nodes in D to Np values of type T stored in the field vals.
WavePropBase.Interpolation.LagrangeLine — Typeconst LagrangeLine = LagrangeElement{ReferenceLine}WavePropBase.Interpolation.LagrangePoint — Typeconst LagrangePoint{N,T} = LagrangeElement{ReferencePoint,1,SVector{N,T}}WavePropBase.Interpolation.LagrangeSquare — Typeconst LagrangeSquare = LagrangeElement{ReferenceSquare}WavePropBase.Interpolation.LagrangeTetrahedron — Typeconst LagrangeTetrahedron = LagrangeElement{ReferenceTetrahedron}WavePropBase.Interpolation.LagrangeTriangle — Typeconst LagrangeTriangle = LagrangeElement{ReferenceTriangle}WavePropBase.Interpolation.Pk — Typestruct Pk{D,K} <: AbstractPolynomialSpace{D}The space of all polynomials over D of degree ≤K.
When D is a hypercube in d dimensions, the precise definition is Pk{D,K} = span{𝐱ᶿ : max(θ)≤ K}; when D is a d-dimensional simplex, the space is Pk{D,K} = span{𝐱ᶿ : sum(θ)≤ K}, where θ ∈ 𝐍ᵈ is a multi-index.
WavePropBase.Interpolation.TensorLagInterp — Typestruct TensorLagInterp{N,Td,T}Generic Lagrange interpolation over an N-dimensional tensor grid. The implementation uses a multidimensional generalization of the barycentric formula.
The main constructor takes an SVector{N,Vector{Td}} containig the N one-dimensional nodes and an Array{N,T} of the function vals at the tensor product grid formed by the one-dimensional nodes.
Examples:
nx = 10
ny = 12
x = [0.5+0.5cos((2k-1)*π/2nx) for k in 1:nx] # Chebyshev nodes
y = [0.5+0.5cos((2k-1)*π/2ny) for k in 1:ny] # Chebyshev nodes
f = (x) -> cos(x[1]*x[2])
vals = [f((x,y)) for x in x, y in y]
p = TensorLagInterp(SVector(x,y),vals)
p((0.1,0.2)) ≈ f((0.1,0.2))Base.split — Methodsplit(rec::AbstractHyperRectangle,[axis]::Int,[place])Split a hyperrectangle in two along the axis direction at the position place. Returns a tuple with the two resulting hyperrectangles.
When no place is given, defaults to splitting in the middle of the axis.
When no axis and no place is given, defaults to splitting along the largest axis.
WavePropBase.Interpolation.cheb1nodes — Methodcheb1nodes(n,a,b)Return the n Chebyshev points of the first kind on the interval [a,b].
WavePropBase.Interpolation.cheb2nodes — Methodcheb2nodes(n,a,b)Return the n Chebyshev points of the second kind on the interval [a,b]. The nodes are nested in the following sense: cheb2nodes(n,a,b) == cheb2nodes(2n-1,a,b)[1:2:end].
WavePropBase.Interpolation.degree — Methoddegree(el::LagrangeElement)The polynomial degree of the element. A LagrangeElement of degree K and domain D belongs to the space Pk{D,K}.
WavePropBase.Interpolation.lagrange_basis — Methodlagrange_basis(nodes,[sp::AbstractPolynomialSpace])Return the set of n polynomials in sp taking the value of 1 on node i and 0 on nodes j ≂̸ i for 1 ≤ i ≤ n. For N-dimensional tensor-product nodes represented in the form of an SVector{N,Vector{T}}, the argument sp may be ommited.
It is assumed that the value of a function on nodes uniquely determine a polynomial in sp.
WavePropBase.Interpolation.monomial_basis — Functionmonomial_basis(sp::Pk)Return an NTuple containing a basis of monomials 𝐱ᶿ spanning the polynomial space Pk.
WavePropBase.Interpolation.reference_nodes — Functionreference_nodes(el::LagrangeElement)Return the reference nodes on domain(el) used for the polynomial interpolation. The function values on these nodes completely determines the interpolating polynomial.
We use the same convention as gmsh for defining the reference nodes and their order (see node ordering on gmsh documentation).
WavePropBase.distance — Methoddistance(x::SVector,r::HyperRectangle)The (minimal) Euclidean distance between the point x and any point y ∈ r.
WavePropBase.distance — Methoddistance(r1::AbstractHyperRectangle,r2::AbstractHyperRectangle)The (minimal) Euclidean distance between a point x ∈ r1 and y ∈ r2.
WavePropBase.Integration — Modulemodule IntegrationMethods for integrating over instances of AbstractReferenceShape.
Besides some standard quadrature rules used to integrate smooth functions, it also defines singular integration routines useful for (weakly) singular integrands.
WavePropBase.Integration.AbstractQuadratureRule — Typeabstract type AbstractQuadratureRule{D<:AbstractReferenceShape}A quadrature rule for integrating a function over the domain D.
An instance q of AbstractQuadratureRule{D} is expected to implement the following methods:
q(): return the nodesxand weightswof the quadrature rule on the reference domainD. For performance reasons, the result should depend only on the type ofq.
WavePropBase.Integration.AbstractQuadratureRule — Method(q::AbstractQuadratureRule)()Return the quadrature nodes x and weights w on the domain(q).
WavePropBase.Integration.AbstractSingularityHandler — Typeabstract type AbstractSingularityHandler{R}Used for handling localized integrand singularities in R.
WavePropBase.Integration.Duffy — Typestruct Duffy <: AbstractSingularityHandler{RefereceTriangle}Change of variables mapping the ReferenceSquare to the RefereceTriangle with the property that the jacobian vanishes at the (1,0) vertex of the triangle.
Useful for integrating functions with a singularity on the (1,0) edge of the reference triangle.
WavePropBase.Integration.Fejer — Typestruct Fejer{N}N-point Fejer's first quadrature rule for integrating a function over [0,1]. Exactly integrates all polynomials of degree ≤ N-1.
WavePropBase.Integration.Gauss — Typestruct Gauss{D,N} <: AbstractQuadratureRule{D}Tabulated N-point symmetric Gauss quadrature rule for integration over D.
WavePropBase.Integration.IMT — Typestruct IMT{A,P} <: AbstractSingularityHandler{ReferenceLine}One-dimensional change of variables mapping [0,1] -> [0,1] with the property that all derivatives vanish at the point x=0.
See Davis and Rabinowitz.
WavePropBase.Integration.Kress — Typestruct Kress{P} <: AbstractSingularityHandler{ReferenceLine}Change of variables mapping [0,1] to [0,1] with the property that the first P-1 derivatives of the transformation vanish at x=0.
WavePropBase.Integration.KressP — Typestruct KressP{P} <: AbstractSingularityHandler{ReferenceLine}Like Kress, this change of variables maps the interval [0,1] onto itself, but the first P derivatives of the transformation vanish at both endpoints.
This change of variables can be used to periodize integrals in the following sense. Suppose we wish to compute the integral of f(x) from 0 to 1 where f is not a1-periodic function. If ϕ is an object of type KressP, then using it as a change of variables in the integration yields a similar integral from 0 to 1 (the interval 0≤0≤1 is mappend onto itself), but with integrand given by g(x) = f(ϕ(x))ϕ'(x). Since ϕ' vanishes (together with P of its derivatives), the function g(x) is now periodic (up to derivatives of order up to P) at the endpoints. Thus quadrature rules designed for periodic functions like the TrapezoidalOpen can be used to obtain high order convergence of g, which in turn yields a modified quadrature rule when viewed as a quadrature rule for f.
WavePropBase.Integration.SingularQuadratureRule — TypeSingularQuadratureRule{D,Q,S} <: AbstractQuadratureRule{D}A quadrature rule over D intended to integrate functions which are singular at a known point s ∈ D.
A singular quadrature is rule is composed of a regular quadrature rule (e.g. GaussLegendre) and a AbstractSingularityHandler to transform the regular quadrature. The regular quadrature rule generates nodes and weights on the domain(sing_handler), and those are mapped into an appropriate quadrature over D = range(sing_handler) using the singularity handler.
WavePropBase.Integration.TensorProductQuadrature — TypeTensorProductQuadrature{Q}A tensor-product of one-dimension quadrature rules. Integrates over [0,1]^d, where d=length(quad).
Examples
qx = Fejer(10)
qy = TrapezoidalOpen(15)
q = TensorProductQuadrature(qx,qy)WavePropBase.Integration.TensorProductSingularityHandler — Typestruct TensorProductSingularityHandler{S} <: AbstractSingularityHandler{ReferenceSquare}A tensor product of two one-dimensional AbstractSingularityHandlers for performing integration over the ReferenceSquare.
WavePropBase.Integration.Trapezoidal — Typestruct Trapezoidal{N} <: AbstractQuadratureRule{ReferenceLine}Closed N-point trapezoidal rule for integrating a function over the interval [0,1].
Examples:
q = Trapezoidal(10)
f(x) = exp(x)*cos(x)
integrate(f,q)WavePropBase.Integration.TrapezoidalOpen — Typestruct TrapezoidalOpen{N} <: AbstractQuadratureRule{ReferenceLine}Open trapezoidal rule.
WavePropBase.Integration._get_gauss_qnodes_and_qweights — Method_get_qnodes_and_qweights(R::Type{<:AbstractReferenceShape{D}}, N) where DReturns the N-point symmetric gaussian qnodes and qweights (x, w) for integration over R.
WavePropBase.Integration.integrate — Methodintegrate(f,q::AbstractQuadrature)
integrate(f,x,w)Integrate the function f using the quadrature rule q. This is simply sum(f.(x) .* w), where x and w are the quadrature nodes and weights, respectively.
WavePropBase.Integration.qnodes — Methodqnodes(Y)Return the quadrature nodes associated with Y.
WavePropBase.Integration.qrule_for_reference_shape — Methodqrule_for_reference_shape(ref,order)Given a reference shape and a desired quadrature order, return an appropiate quadrature rule.
WavePropBase.Integration.qweights — Methodqweights(Y)Return the quadrature weights associated with Y.
WavePropBase.Integration.singular_quadrature — Methodsingular_quadrature(k,q::SingularQuadratureRule,s)Return nodes and weights to integrate a function over domain(q) with a factored weight k.
WavePropBase.Integration.singular_weights — Methodsingular_weights(k,xi,q::SingularQuadratureRule,s)WavePropBase.Mesh.AbstractMesh — Typeabstract type AbstractMesh{N,T}An abstract mesh structure in dimension N with primite data of type T (e.g. Float64 for double precision representation).
Concrete subtypes of AbstractMesh should implement ElementIterator for accessing the mesh elements, and/or NodeIterator for accesing the mesh nodes.
See also: GenericMesh, UniformCartesianMesh
WavePropBase.Mesh.ElementIterator — Typestruct ElementIterator{E,M}Return an iterator for all elements of type E on a mesh of type M.
Besides the methods listed in the iterator iterface of Julia, some functions also require the getindex(iter,i::Int) method for accessing the i-th element directly.
WavePropBase.Mesh.GenericMesh — Typestruct GenericMesh{N,T} <: AbstractMesh{N,T}Data structure representing a generic mesh in an ambient space of dimension N, with data of type T.
WavePropBase.Mesh.NodeIterator — Typestruct NodeIterator{M}Iterator for all the nodes in a mesh of type M.
WavePropBase.Mesh.SubMesh — Typestruct SubMesh{N,T} <: AbstractMesh{N,T}Create a view of a parent mesh over a given domain.
A submesh implements the interface for AbstractMesh; therefore you can iterate over elements of the submesh just like you would with a mesh.
WavePropBase.Mesh.UniformCartesianMesh — Typestruct UniformCartesianMesh{N,T} <: AbstractMesh{N,T}An N-dimensional cartesian grid given as the tensor-product of N one-dimensional LinRange{T} grids.
Iterating over a UniformCartesianMesh generates the elements which compose the mesh; i.e. the HyperRectangle cells.
WavePropBase.Mesh.UniformCartesianMesh — MethodUniformCartesianMesh(;domain::HyperRectangle,sz::NTuple)Construct a uniform UniformCartesianMesh with sz[d] elements along dimension d.
WavePropBase.Mesh.decompose — Methoddecompose(s::AbstractReferenceShape,x,[target_shape])Decompose an AbstractReferenceShape into LagrangeElements so that x is a vertex of the children elements.
Examples
s = ReferenceLine() el1, el2 = decompose(s,0.3) el1(1) == el2(0) == 0.3 # true
WavePropBase.Mesh.dom2elt — Methoddom2elt(m::GenericMesh,Ω,E)Compute the element indices idxs of the elements of type E composing Ω, so that m[E][idxs] gives all the elements of type E meshing Ω.
WavePropBase.Mesh.dom2elt — Methoddom2elt(m::GenericMesh,Ω)Return a Dict with keys being the element types of m, and values being the indices of the elements in Ω of that type.
WavePropBase.Mesh.dom2elt — Methoddom2elt(m::SubMesh,[E])A dictionary with keys being the element types of m, and values being the element indices in the parent mesh. If a type E is given, return the values associated with that key.
WavePropBase.IO.etype_to_vtk_cell_type — Constantconst etype_to_vtk_cell_typeOrderedDictionary mapping internal element types to a tuple containing: - the corresponding WriteVTK cell types (following the convention chosen by VTK, see below); - the indices in the elements column that defines the element. This is because we want to support the export of more than just the flat elements available in the VTK specification, hence which may require a conversion of some sort.
See VTK specification [Fig. 2] on http://www.vtk.org/VTK/img/file-formats.pdf
- VTK_VERTEX (=1)
- VTKPOLYVERTEX (=2)
- VTK_LINE (=3)
- VTKPOLYLINE (=4)
- VTK_TRIANGLE (=5)
- VTKTRIANGLESTRIP (=6)
- VTK_POLYGON (=7)
- VTK_PIXEL (=8)
- VTK_QUAD (=9)
- VTK_TETRA (=10)
- VTK_VOXEL (=11)
- VTK_HEXAHEDRON (=12)
- VTK_WEDGE (=13)
- VTK_PYRAMID (=14)
WavePropBase.IO.PlotPoints — Typestruct PlotPointsStructure used for dispatching SVector to plot recipes without type-piracy.
WavePropBase.IO.PlotTree — Typestruct PlotTreeUsed to plot entire tree associated with a tree node, instead of just the node.
WavePropBase.IO._vtk_cells — Function_vtk_cells(mesh::GenericMesh, E::DataType)
_vtk_cells(mesh::GenericMesh, Ω::Domain)Creates the vector of all elements contained in the mesh in the format required by WriteVTK for a particular element type E<:AbstractElement or a Domain instance.
WavePropBase.IO._vtk_points — Method_vtk_points(mesh::GenericMesh)Creates the matrix of nodes in the format required by WriteVTK.
WavePropBase.IO.vtk_mesh_file — Methodvtk_mesh_file(mesh::GenericMesh[, Ω::Domain], name::String)Creates a VTK file (.vtu) with name name containing the mesh information. It is possible to export only a Domain (i.e. only a part of the mesh).
Note that all the heavy lifting is done by the package WriteVTK. We refer to its documentation for more information.
Warning: the output is not an actual file (on disk). To save it, simply write:
vtk_mesh_file(mesh, "my_mesh") |> vtk_saveTo add some data (scalar or vector values at the mesh nodes or mesh cells) for visualization purposes, you can do for instance:
vtkfile = vtk_mesh_file(mesh, name)
vtkfile["my_point_data", VTKPointData()] = pdata
vtkfile["my_cell_data", VTKCellData()] = cdata
vtk_save(vtkfile)It is possible also to export a partition Ωs::Vector{Domain} using Multiblock files (.vtm), for instance like so
vtmfile = vtk_multiblock(name)
for (Ω, pdata) in zip(Ωs, pdatas)
vtkfile = vtk_mesh_file(mesh, Ω, name)
vtkfile["my_point_data", VTKPointData()] = pdata
end
vtk_save(vtmfile)To save a sequence of solutions (time steps, iterations), simply append the number of the element to the file name. Paraview will recognize the sequence automatically.