API Reference
Grid Queries
CartesianGrids.dimension — Function
dimension(g::CartesianGrid)Return the dimension of the Cartesian grid g.
CartesianGrids.grid1d — Function
grid1d(g::CartesianGrid, dim)Return the 1D grid points along the specified dimension dim of the Cartesian grid g.
CartesianGrids.meshsize — Function
meshsize(g::CartesianGrid)Return the grid spacing (node spacing) of the Cartesian grid g in each dimension. This is computed as (hc - lc) / (n - 1), since there are n-1 intervals between n nodes.
CartesianGrids.cell_spacing — Function
cell_spacing(g::CartesianGrid)Return the cell spacing between cell centers in each dimension of the Cartesian grid g. This is computed as (hc - lc) / n, since there are n cells spanning the distance from lc to hc.
CartesianGrids.cell_center — Function
cell_center(g::CartesianGrid, I)Return the center coordinates of the cell indexed by I in the Cartesian grid g. The cell center is computed as lc + (I - 0.5) * Δ, where Δ is the cell spacing.
CartesianGrids.collect! — Function
collect!(dest, g)Fill a preallocated container dest with the node coordinates from the Cartesian grid g. This avoids allocating a new array (unlike collect(g)).
Supported forms:
collect!(v::AbstractVector, g::CartesianGrid)fillsvin linear (column-major) order.collect!(A::AbstractArray{<:Any,N}, g::CartesianGrid{N})fills the N-dimensional arrayAusing the same index layout as the grid.
Indexing and Iteration
Base.size(g::CartesianGrid)— Get grid size (number of nodes per dimension)Base.length(g::CartesianGrid)— Get total number of nodesBase.getindex(g::CartesianGrid, I::CartesianIndex)— Access a grid pointBase.eachindex(g::CartesianGrid)— Iterate over all grid indicesBase.CartesianIndices(g::CartesianGrid)— Get CartesianIndices for the gridBase.iterate(g::CartesianGrid)— Iterate over all grid points