Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
Integer Index Space

Types and operations for discrete integer index space in AMReX. More...

Classes

struct  amrex::Dim3
 A simple struct holding 3 int values for a 3D index. More...
 
struct  amrex::CellIndexEnum
 Type for defining CellIndex so that all IndexTypeND with different dimensions have the same CellIndex type. More...
 
class  amrex::BoxND< dim >
 A Rectangular Domain on an Integer Lattice. More...
 
class  amrex::BoxIteratorND< dim >
 Iterator over all IntVects in a Box. More...
 
class  amrex::BoxList
 A list of Boxes sharing a common IndexType. More...
 
class  amrex::IndexTypeND< dim >
 Cell-Based or Node-Based Indices. More...
 
class  amrex::IntVectND< dim >
 An Integer Vector in dim-Dimensional Space. More...
 

Typedefs

using amrex::BoxIterator = BoxIteratorND< 3 >
 

Functions

template<int dim>
__host__ __device__ BoxND< dim > amrex::grow (const BoxND< dim > &b, int i) noexcept
 Return a copy of b grown uniformly by i cells in every direction.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::grow (const BoxND< dim > &b, const IntVectND< dim > &v) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::grow (const BoxND< dim > &b, int idir, int n_cell) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::grow (const BoxND< dim > &b, Direction d, int n_cell) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::growLo (const BoxND< dim > &b, int idir, int n_cell) noexcept
 Return a copy of b with the low end grown by n_cell cells in direction idir.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::growLo (const BoxND< dim > &b, Direction d, int n_cell) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::growHi (const BoxND< dim > &b, int idir, int n_cell) noexcept
 Return a copy of b with the high end grown by n_cell cells in direction idir.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::growHi (const BoxND< dim > &b, Direction d, int n_cell) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::coarsen (const BoxND< dim > &b, int ref_ratio) noexcept
 Return a copy of b coarsened by the isotropic ratio ref_ratio.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::coarsen (const BoxND< dim > &b, const IntVectND< dim > &ref_ratio) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::refine (const BoxND< dim > &b, int ref_ratio) noexcept
 Return a copy of b refined by the isotropic ratio ref_ratio.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::refine (const BoxND< dim > &b, const IntVectND< dim > &ref_ratio) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::shift (const BoxND< dim > &b, int dir, int nzones) noexcept
 Return a copy of b shifted by nzones cells in direction dir.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::shift (const BoxND< dim > &b, const IntVectND< dim > &nzones) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::surroundingNodes (const BoxND< dim > &b, int dir) noexcept
 Return a BoxND with NODE based coordinates in direction dir that encloses BoxND b.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::surroundingNodes (const BoxND< dim > &b, Direction d) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::surroundingNodes (const BoxND< dim > &b) noexcept
 Return a BoxND with NODE based coordinates in all directions that encloses BoxND b.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::convert (const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
 Return a copy of b converted to the nodal flags typ.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::convert (const BoxND< dim > &b, const IndexTypeND< dim > &typ) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::enclosedCells (const BoxND< dim > &b, int dir) noexcept
 Return a BoxND with CELL based coordinates in direction dir that is enclosed by b.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::enclosedCells (const BoxND< dim > &b, Direction d) noexcept
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::enclosedCells (const BoxND< dim > &b) noexcept
 Return a BoxND with CELL based coordinates in all directions that is enclosed by b.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::bdryLo (const BoxND< dim > &b, int dir, int len=1) noexcept
 Return the BoxND of length len on the low boundary of b along coordinate direction dir.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::bdryHi (const BoxND< dim > &b, int dir, int len=1) noexcept
 Return the BoxND of length len on the high boundary of b along coordinate direction dir.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::bdryNode (const BoxND< dim > &b, Orientation face, int len=1) noexcept
 Similar to bdryLo and bdryHi except that it operates on the given face of BoxND b.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::adjCellLo (const BoxND< dim > &b, int dir, int len=1) noexcept
 Return the BoxND of length len adjacent to b on the low end along coordinate direction dir.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::adjCellHi (const BoxND< dim > &b, int dir, int len=1) noexcept
 Return the BoxND of length len adjacent to b on the high end along coordinate direction dir.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::adjCell (const BoxND< dim > &b, Orientation face, int len=1) noexcept
 Similar to adjCellLo and adjCellHi except that it operates on the given face of BoxND b.
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::minBox (const BoxND< dim > &b1, const BoxND< dim > &b2) noexcept
 Return the minimal BoxND containing both b1 and b2.
 
template<int dim>
BoxND< dim > amrex::getIndexBounds (BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
 Return the minimal index-space box covering b1 and b2.
 
template<int dim = 3>
requires ( 1<=dim && dim<=3 )
__host__ __device__ BoxND< dim > amrex::makeSingleCellBox (int i, int j, int k, IndexTypeND< dim > typ=IndexTypeND< dim >::TheCellType())
 Create a single-cell box at coordinates (i,j,k).
 
template<int dim>
__host__ __device__ BoxND< dim > amrex::makeSingleCellBox (IntVectND< dim > const &vect, IndexTypeND< dim > typ=IndexTypeND< dim >::TheCellType())
 Create a single-cell box at vect.
 

Detailed Description

Types and operations for discrete integer index space in AMReX.

These types define the integer space on which AMReX data structures are defined. They are independent of physical coordinates and units.

Central types include:

Common operations include:

Typedef Documentation

◆ BoxIterator

using amrex::BoxIterator = typedef BoxIteratorND<3>

Alias for BoxIteratorND<AMREX_SPACEDIM>.

Function Documentation

◆ adjCell()

template<int dim>
__host__ __device__ BoxND< dim > amrex::adjCell ( const BoxND< dim > &  b,
Orientation  face,
int  len = 1 
)
inlinenoexcept

Similar to adjCellLo and adjCellHi except that it operates on the given face of BoxND b.

The returned BoxND is CELL based in the face direction and identical to b in the other directions.

Parameters
bInput Box.
faceThe face of b to operate on.
lenLength of the adjacent box along the face direction.

◆ adjCellHi()

template<int dim>
__host__ __device__ BoxND< dim > amrex::adjCellHi ( const BoxND< dim > &  b,
int  dir,
int  len = 1 
)
inlinenoexcept

Return the BoxND of length len adjacent to b on the high end along coordinate direction dir.

The returned BoxND is CELL based in direction dir and identical to b in the other directions.

Parameters
bInput Box.
dirCoordinate direction.
lenLength of the adjacent box in direction dir.

◆ adjCellLo()

template<int dim>
__host__ __device__ BoxND< dim > amrex::adjCellLo ( const BoxND< dim > &  b,
int  dir,
int  len = 1 
)
inlinenoexcept

Return the BoxND of length len adjacent to b on the low end along coordinate direction dir.

The returned BoxND is CELL based in direction dir and identical to b in the other directions.

Parameters
bInput Box.
dirCoordinate direction.
lenLength of the adjacent box in direction dir.

◆ bdryHi()

template<int dim>
__host__ __device__ BoxND< dim > amrex::bdryHi ( const BoxND< dim > &  b,
int  dir,
int  len = 1 
)
inlinenoexcept

Return the BoxND of length len on the high boundary of b along coordinate direction dir.

The returned BoxND is NODE based in direction dir and identical to b in the other directions.

Parameters
bInput Box.
dirCoordinate direction.
lenLength of the boundary box in direction dir.

◆ bdryLo()

template<int dim>
__host__ __device__ BoxND< dim > amrex::bdryLo ( const BoxND< dim > &  b,
int  dir,
int  len = 1 
)
inlinenoexcept

Return the BoxND of length len on the low boundary of b along coordinate direction dir.

The returned BoxND is NODE based in direction dir and identical to b in the other directions.

Parameters
bInput Box.
dirCoordinate direction.
lenLength of the boundary box in direction dir.

◆ bdryNode()

template<int dim>
__host__ __device__ BoxND< dim > amrex::bdryNode ( const BoxND< dim > &  b,
Orientation  face,
int  len = 1 
)
inlinenoexcept

Similar to bdryLo and bdryHi except that it operates on the given face of BoxND b.

The returned BoxND is NODE based in the face direction and identical to b in the other directions.

Parameters
bInput Box.
faceThe face of b to operate on.
lenLength of the boundary box along the face direction.

◆ coarsen() [1/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::coarsen ( const BoxND< dim > &  b,
const IntVectND< dim > &  ref_ratio 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
bBox to coarsen.
ref_ratioDirection-wise positive refinement ratios.
Returns
A copy of b after coarsening.

◆ coarsen() [2/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::coarsen ( const BoxND< dim > &  b,
int  ref_ratio 
)
inlinenoexcept

Return a copy of b coarsened by the isotropic ratio ref_ratio.

Refinement of the coarsened box is guaranteed to contain the original box (taking nodal types into account). The two are equal only when the original box is coarsenable.

Parameters
bBox to coarsen.
ref_ratioPositive refinement ratio applied to every direction.
Returns
A copy of b after coarsening.

◆ convert() [1/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::convert ( const BoxND< dim > &  b,
const IndexTypeND< dim > &  typ 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
bBox to convert.
typTarget index type descriptor.
Returns
A copy of b after conversion.

◆ convert() [2/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::convert ( const BoxND< dim > &  b,
const IntVectND< dim > &  typ 
)
inlinenoexcept

Return a copy of b converted to the nodal flags typ.

Parameters
bBox to convert.
typDirection-wise nodal flags (0 cell, 1 node).
Returns
A copy of b after conversion.

◆ enclosedCells() [1/3]

template<int dim>
__host__ __device__ BoxND< dim > amrex::enclosedCells ( const BoxND< dim > &  b)
inlinenoexcept

Return a BoxND with CELL based coordinates in all directions that is enclosed by b.

◆ enclosedCells() [2/3]

template<int dim>
__host__ __device__ BoxND< dim > amrex::enclosedCells ( const BoxND< dim > &  b,
Direction  d 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ enclosedCells() [3/3]

template<int dim>
__host__ __device__ BoxND< dim > amrex::enclosedCells ( const BoxND< dim > &  b,
int  dir 
)
inlinenoexcept

Return a BoxND with CELL based coordinates in direction dir that is enclosed by b.

◆ getIndexBounds()

template<int dim>
BoxND< dim > amrex::getIndexBounds ( BoxND< dim > const &  b1,
BoxND< dim > const &  b2 
)
inlinenoexcept

Return the minimal index-space box covering b1 and b2.

The index types of b1 and b2 do not need to be the same. The result adopts the index type of b2.

Parameters
b1First box.
b2Second box (also supplies the target index type).
Returns
A box covering both inputs.

◆ grow() [1/4]

template<int dim>
__host__ __device__ BoxND< dim > amrex::grow ( const BoxND< dim > &  b,
const IntVectND< dim > &  v 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
bInput Box.
vDirection-wise cell counts to add (negative shrinks).
Returns
A copy of b after the grow operation.

◆ grow() [2/4]

template<int dim>
__host__ __device__ BoxND< dim > amrex::grow ( const BoxND< dim > &  b,
Direction  d,
int  n_cell 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ grow() [3/4]

template<int dim>
__host__ __device__ BoxND< dim > amrex::grow ( const BoxND< dim > &  b,
int  i 
)
inlinenoexcept

Return a copy of b grown uniformly by i cells in every direction.

Negative i values shrink the box by that many cells per direction.

Parameters
bInput Box.
iNumber of cells to add (negative shrinks).
Returns
A copy of b after the grow operation.

◆ grow() [4/4]

template<int dim>
__host__ __device__ BoxND< dim > amrex::grow ( const BoxND< dim > &  b,
int  idir,
int  n_cell 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
bInput Box.
idirCoordinate direction to grow.
n_cellNumber of cells to add to the given direction (negative shrinks).
Returns
A copy of b after the grow operation.

◆ growHi() [1/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::growHi ( const BoxND< dim > &  b,
Direction  d,
int  n_cell 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ growHi() [2/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::growHi ( const BoxND< dim > &  b,
int  idir,
int  n_cell 
)
inlinenoexcept

Return a copy of b with the high end grown by n_cell cells in direction idir.

Negative values shrink the high end of the returned box.

Parameters
bInput Box.
idirCoordinate direction to grow.
n_cellNumber of cells to add (negative shrinks).
Returns
A copy of b after the asymmetric grow.

◆ growLo() [1/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::growLo ( const BoxND< dim > &  b,
Direction  d,
int  n_cell 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ growLo() [2/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::growLo ( const BoxND< dim > &  b,
int  idir,
int  n_cell 
)
inlinenoexcept

Return a copy of b with the low end grown by n_cell cells in direction idir.

Negative values shrink the low end of the returned box.

Parameters
bInput Box.
idirCoordinate direction to grow.
n_cellNumber of cells to add (negative shrinks).
Returns
A copy of b after the asymmetric grow.

◆ makeSingleCellBox() [1/2]

template<int dim = 3>
requires ( 1<=dim && dim<=3 )
__host__ __device__ BoxND< dim > amrex::makeSingleCellBox ( int  i,
int  j,
int  k,
IndexTypeND< dim >  typ = IndexTypeND<dim>::TheCellType() 
)
inline

Create a single-cell box at coordinates (i,j,k).

Parameters
iCell index along x.
jCell index along y.
kCell index along z.
typTarget index type (cell by default).
Returns
A single-cell box.

◆ makeSingleCellBox() [2/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::makeSingleCellBox ( IntVectND< dim > const &  vect,
IndexTypeND< dim >  typ = IndexTypeND<dim>::TheCellType() 
)
inline

Create a single-cell box at vect.

Parameters
vectCell indices of the single cell.
typTarget index type (cell by default).
Returns
A single-cell box.

◆ minBox()

template<int dim>
__host__ __device__ BoxND< dim > amrex::minBox ( const BoxND< dim > &  b1,
const BoxND< dim > &  b2 
)
inlinenoexcept

Return the minimal BoxND containing both b1 and b2.

The boxes must share the same index type.

Parameters
b1First box.
b2Second box.
Returns
The minimal box that contains both inputs.

◆ refine() [1/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::refine ( const BoxND< dim > &  b,
const IntVectND< dim > &  ref_ratio 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
bBox to refine.
ref_ratioDirection-wise positive refinement ratios.
Returns
A copy of b after refinement.

◆ refine() [2/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::refine ( const BoxND< dim > &  b,
int  ref_ratio 
)
inlinenoexcept

Return a copy of b refined by the isotropic ratio ref_ratio.

Each direction is scaled by ref_ratio while respecting whether the box is cell-centered or nodal so that coarsening by the same ratio recovers the original extent.

Parameters
bBox to refine.
ref_ratioPositive refinement ratio applied to every direction.
Returns
A copy of b after refinement.

◆ shift() [1/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::shift ( const BoxND< dim > &  b,
const IntVectND< dim > &  nzones 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
bBox to shift.
nzonesDirection-wise signed cell offsets.
Returns
A copy of b after shifting.

◆ shift() [2/2]

template<int dim>
__host__ __device__ BoxND< dim > amrex::shift ( const BoxND< dim > &  b,
int  dir,
int  nzones 
)
inlinenoexcept

Return a copy of b shifted by nzones cells in direction dir.

Parameters
bBox to shift.
dirCoordinate direction to shift.
nzonesSigned number of cells to shift by.
Returns
A copy of b after shifting.

◆ surroundingNodes() [1/3]

template<int dim>
__host__ __device__ BoxND< dim > amrex::surroundingNodes ( const BoxND< dim > &  b)
inlinenoexcept

Return a BoxND with NODE based coordinates in all directions that encloses BoxND b.

◆ surroundingNodes() [2/3]

template<int dim>
__host__ __device__ BoxND< dim > amrex::surroundingNodes ( const BoxND< dim > &  b,
Direction  d 
)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ surroundingNodes() [3/3]

template<int dim>
__host__ __device__ BoxND< dim > amrex::surroundingNodes ( const BoxND< dim > &  b,
int  dir 
)
inlinenoexcept

Return a BoxND with NODE based coordinates in direction dir that encloses BoxND b.