Array with MeshGrids

GreenFunc.MeshArrays.MeshArrayType
struct 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 data
  • MT: 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

    1. Meshes defined in the MeshGrids module.
    2. UnitRange such as 1:10, etc.
    3. Product of meshes MeshProduct defined in the MeshGrids 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.
  • data: Array{T,N}: the data.

  • dims: dimension of the data

source
GreenFunc.MeshArrays.MeshArrayMethod
function 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 of MeshArray 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 the dims size containing elements of dtype.
source
Base.eltypeMethod
eltype(obj::AbstractMeshArray)

Return the type of the elements contained in obj.data.

source
Base.getindexMethod
getindex(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.

source
Base.setindex!Method
setindex!(obj::MeshArray, v, inds...)
obj[inds...] = v

Store values from array v within some subset of obj.data as specified by inds.

source
Base.similarMethod
Base.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 as obj.data.
  • Base.similar(obj::MeshArray, ::Type{S}): Return a new MeshArray with the same meshes, but with the uninitialized data of type S.
source
Base.sizeMethod
size(obj::AbstractMeshArray)

Return a tuple containing the dimensions of obj.data (obj.dims).

source
GreenFunc.MeshArrays._checkMethod
function _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.

source