Array with MeshGrids
GreenFunc.MeshArrays.MeshArray
— Typestruct MeshArray{T,N,MT} <: AbstractMeshArray{T,N}
Multi-dimensional array that is defined on a mesh. The mesh is a tuple of meshgrid objects. The mesh is stored in the field mesh
and the data is stored in the field data
.
Parameters:
T
: type of dataMT
: type of mesh, e.g., Tuple{MeshType1, MeshType2, ...}N
: number of dimensions
Members:
mesh
(MT): the mesh is a tuple of meshes. The mesh should be an iterable object that contains an ordered list of grid points. Examples are the- Meshes defined in the
MeshGrids
module. - UnitRange such as
1:10
, etc. - Product of meshes
MeshProduct
defined in theMeshGrids
module.
If a mesh is defined on a continuous manifold and supports the following methods, then one can perform interpolation, derivatives, etc. on the mesh:
locate(mesh, value)
: find the index of the closest grid point for given value;volume(mesh, index)
: find the volume of grid space near the point at griven index.volume(mesh, gridpoint)
: locate the corresponding index of a given grid point and than find the volume spanned by the grid point.
- Meshes defined in the
data
: Array{T,N}: the data.dims
: dimension of the data
GreenFunc.MeshArrays.MeshArray
— Methodfunction MeshArray(;
mesh...;
dtype = Float64,
data::Union{Nothing,AbstractArray}=nothing) where {T}
Create a Green struct. Its memeber dims
is setted as the tuple consisting of the length of all meshes.
Arguments
mesh
: meshes of Green's function. See the docs ofMeshArray
for more details. Mesh could be any iterable object, examples are vector, tuple, array, number, UnitRange (say, 1:5).dtype
: data type of Green's function's value.data
: the data of the Green's function. By default,data
is constructed to an unintialized Array with thedims
size containing elements ofdtype
.
GreenFunc.MeshArrays.MeshMatrix
— TypeMeshMatrix{T}
Alias for MeshArray{T,2,MT}
.
GreenFunc.MeshArrays.MeshVector
— TypeMeshVector{T}
Alias for MeshArray{T,1,MT}
.
Base.eltype
— Methodeltype(obj::AbstractMeshArray)
Return the type of the elements contained in obj.data
.
Base.getindex
— Methodgetindex(obj::MeshArray, inds...)
Return a subset of obj
's data as specified by inds
, where each inds
may be, for example, an Int, an AbstractRange, or a Vector.
Base.setindex!
— Methodsetindex!(obj::MeshArray, v, inds...)
obj[inds...] = v
Store values from array v
within some subset of obj.data
as specified by inds
.
Base.similar
— MethodBase.similar(obj::MeshArray{T,N,MT}, ::Type{S}) where {T,MT,N,S}
Base.similar(obj::MeshArray{T,N,MT}) where {T,MT,N} = Base.similar(obj, T)
Return type:
Base.similar(obj::MeshArray)
: Return a new MeshArray with the same meshes, and the uninitialized data of the same type asobj.data
.Base.similar(obj::MeshArray, ::Type{S})
: Return a new MeshArray with the same meshes, but with the uninitialized data of typeS
.
Base.size
— Methodsize(obj::AbstractMeshArray)
Return a tuple containing the dimensions of obj.data
(obj.dims
).
GreenFunc.MeshArrays._check
— Methodfunction _check(objL::MeshArray, objR::MeshArray)
Check if the Green's functions objL
and objR
are on the same meshes. Throw an AssertionError if any check is false.
GreenFunc.MeshArrays.rank
— Methodfunction rank(obj::MeshArray)
Return the dimension of obj.data
(N
).