CartesianDomains.jl
is a lightweight library used to work with Cartesian domains and provide conveinent indexing functions. This arose from a need to write dimension-agnostic code for stencil-like operations and halo-aware domains.
The currently exported functions include:
shift
: Shift aCartesianIndex
byn
along a given axis. This is useful for getting indices like[i+1,j,k]
but in a dimension agnostic mannerexpand
: Expand adomain:CartesianIndices{N}
byn
(or contract by-n
) along allaxes
or a specifiedaxis
expand_lower
: Expand adomain:CartesianIndices{N}
byn
(or contract by-n
) along the lower bound on all along allaxes
or a specifiedaxis
expand_upper
: Expand adomain:CartesianIndices{N}
byn
(or contract by-n
) along the upper bound on all along allaxes
or a specifiedaxis
extract_from_lower
: Extract a subdomain at the lower bound fromdomain:CartesianIndices{N}
along all axes or a giveaxis
with a width ofn
extract_from_upper
: Extract a subdomain from the upper bound fromdomain:CartesianIndices{N}
along all axes or a giveaxis
with a width ofn
haloedge_regions
: Extract halo and corresponding edge regions from a domain along a given axis, where the subdomain has a sizenhalo
along a givenaxis
. The user can also specifynedge
if the edge region needs to be a smaller size thannhalo