API Reference

Grid Queries

CartesianGrids.grid1dFunction
grid1d(g::CartesianGrid, dim)

Return the 1D grid points along the specified dimension dim of the Cartesian grid g.

CartesianGrids.meshsizeFunction
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_spacingFunction
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_centerFunction
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.

Missing docstring.

Missing docstring for interior_indices. Check Documenter's build log for details.

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) fills v in linear (column-major) order.
  • collect!(A::AbstractArray{<:Any,N}, g::CartesianGrid{N}) fills the N-dimensional array A using 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 nodes
  • Base.getindex(g::CartesianGrid, I::CartesianIndex) — Access a grid point
  • Base.eachindex(g::CartesianGrid) — Iterate over all grid indices
  • Base.CartesianIndices(g::CartesianGrid) — Get CartesianIndices for the grid
  • Base.iterate(g::CartesianGrid) — Iterate over all grid points