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 aCartesianIndexbynalong 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 allaxesor a specifiedaxisexpand_lower: Expand adomain:CartesianIndices{N}byn(or contract by-n) along the lower bound on all along allaxesor a specifiedaxisexpand_upper: Expand adomain:CartesianIndices{N}byn(or contract by-n) along the upper bound on all along allaxesor a specifiedaxisextract_from_lower: Extract a subdomain at the lower bound fromdomain:CartesianIndices{N}along all axes or a giveaxiswith a width ofnextract_from_upper: Extract a subdomain from the upper bound fromdomain:CartesianIndices{N}along all axes or a giveaxiswith a width ofnhaloedge_regions: Extract halo and corresponding edge regions from a domain along a given axis, where the subdomain has a sizenhaloalong a givenaxis. The user can also specifynedgeif the edge region needs to be a smaller size thannhalo