Mesh
Cartesian mesh
Tesserae.CartesianMesh — TypeCartesianMesh([T,] h, (xmin, xmax), (ymin, ymax)...)Construct CartesianMesh with the spacing h.
Examples
julia> CartesianMesh(1.0, (0,3), (1,4))
4×4 CartesianMesh{2, Float64, Vector{Float64}}:
[0.0, 1.0] [0.0, 2.0] [0.0, 3.0] [0.0, 4.0]
[1.0, 1.0] [1.0, 2.0] [1.0, 3.0] [1.0, 4.0]
[2.0, 1.0] [2.0, 2.0] [2.0, 3.0] [2.0, 4.0]
[3.0, 1.0] [3.0, 2.0] [3.0, 3.0] [3.0, 4.0]Tesserae.spacing — Functionspacing(::CartesianMesh)Return the spacing of the mesh.
Tesserae.volume — Functionvolume(::CartesianMesh)Return the volume of the mesh.
Tesserae.extract — Methodextract(mesh::CartesianMesh, (xmin, xmax), (ymin, ymax)...)Extract a portion of the mesh. The extracted mesh retains the original origin and spacing.
Tesserae.isinside — Functionisinside(x::Vec, mesh::CartesianMesh)Check if x is inside the mesh.
Tesserae.whichcell — Functionwhichcell(x::Vec, mesh::CartesianMesh)Return the cell index where x is located.
Examples
julia> mesh = CartesianMesh(1, (0,5), (0,5))
6×6 CartesianMesh{2, Float64, Vector{Float64}}:
[0.0, 0.0] [0.0, 1.0] [0.0, 2.0] [0.0, 3.0] [0.0, 4.0] [0.0, 5.0]
[1.0, 0.0] [1.0, 1.0] [1.0, 2.0] [1.0, 3.0] [1.0, 4.0] [1.0, 5.0]
[2.0, 0.0] [2.0, 1.0] [2.0, 2.0] [2.0, 3.0] [2.0, 4.0] [2.0, 5.0]
[3.0, 0.0] [3.0, 1.0] [3.0, 2.0] [3.0, 3.0] [3.0, 4.0] [3.0, 5.0]
[4.0, 0.0] [4.0, 1.0] [4.0, 2.0] [4.0, 3.0] [4.0, 4.0] [4.0, 5.0]
[5.0, 0.0] [5.0, 1.0] [5.0, 2.0] [5.0, 3.0] [5.0, 4.0] [5.0, 5.0]
julia> whichcell(Vec(1.5, 1.5), mesh)
CartesianIndex(2, 2)