Meshgrid
Replacement for Matlab's meshgrid function with helper for obtaining a triangulation and plotting the grid.
BaseUtilities.MeshGrid — Typegrid = MeshGrid(X, Y)
grid = MeshGrid(x, y = x)
grid = MeshGrid(meshgrid(x, y))Generate data structure that captures contents generated by meshgrid.
The constructor calls meshgrid for non-matrix arguments x, y. A MeshGrid object can be deconstructed by
X, Y = grid[]You can "enumerate" all vertex positions as SVector{2, T} with
collect(grid[:])
map(grid[:]) do x
@SVector[x..., 0]
endYou can pass grid::MeshGrid to Plots.plot
plot(grid, scatter=false, ...)Base.getindex — Methodcollect(grid[:])Enumerate vertices of MeshGrid.
Base.getindex — MethodX, Y = MeshGrid(X, Y)Deconstruct MeshGrid to tuple (X, Y).
Base.size — MethodBaseUtilities.dual — Methodd = dual(grid)Get dual MeshGrid such that each knot in grid refers to a cell in the dual d.
See also primal
BaseUtilities.meshgrid — FunctionX, Y = meshgrid(t)
X, Y = meshgrid(x, y)Replacement for Matlab's meshgrid.
BaseUtilities.perturb! — Functionperturb!(grid, p=0.05; boundary::Bool = true)Perturb vertex positions of grid with uniform random noise. p is the maximum amplitude relative to the cell size. If boundary = false, boundary vertices will not be perturbed.
See also MeshGrid
BaseUtilities.primal — Methodp = primal(grid)Get primal MeshGrid from dual grid such that every cell in grid refers to a knot in p.
BaseUtilities.ranges — Methodgrid = MeshGrid(x, y)
x, y = ranges(grid)Get ranges x and y that generate MeshGrid grid.
BaseUtilities.spacing — Methodhx, hy = spacing(grid)Get distances between knots in x- and y-directions, i.e., the cell size of the dual grid.
See also MeshGrid
BaseUtilities.triangles — Methodtriangles(grid) :: VectorCollect triangles in MeshGrid with each cell split into two triangles. Each triangle is represented as a triple of linear vertex indices.
See also MeshGrid