Block-Structured AMR Software Framework
AMReX_Box.H File Reference
#include <AMReX_Config.H>
#include <AMReX_Algorithm.H>
#include <AMReX_ArrayLim.H>
#include <AMReX_ccse-mpi.H>
#include <AMReX_IntVect.H>
#include <AMReX_IndexType.H>
#include <AMReX_Orientation.H>
#include <AMReX_SPACE.H>
#include <AMReX_Array.H>
#include <AMReX_Array4.H>
#include <AMReX_Vector.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_GpuControl.H>
#include <AMReX_Math.H>
#include <iosfwd>

Go to the source code of this file.

Classes

class  amrex::BoxND< dim >
 A Rectangular Domain on an Integer Lattice. More...
 
class  amrex::BoxCommHelper
 
class  amrex::BoxConverter
 
struct  amrex::BoxIndexerND< dim >
 
struct  amrex::BoxIndexerND< 1 >
 

Namespaces

 amrex
 
 amrex::detail
 

Typedefs

using amrex::BoxIndexer = BoxIndexerND< AMREX_SPACEDIM >
 

Functions

void amrex::AllGatherBoxes (Vector< Box > &bxs, int n_extra_reserve)
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::grow (const BoxND< dim > &b, int i) noexcept
 Grow BoxND in all directions by given amount. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::grow (const BoxND< dim > &b, const IntVectND< dim > &v) noexcept
 Grow BoxND in each direction by specified amount. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::grow (const BoxND< dim > &b, int idir, int n_cell) noexcept
 Grow BoxND in direction idir be n_cell cells. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::grow (const BoxND< dim > &b, Direction d, int n_cell) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::growLo (const BoxND< dim > &b, int idir, int n_cell) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::growLo (const BoxND< dim > &b, Direction d, int n_cell) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::growHi (const BoxND< dim > &b, int idir, int n_cell) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::growHi (const BoxND< dim > &b, Direction d, int n_cell) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::coarsen (const BoxND< dim > &b, int ref_ratio) noexcept
 Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio. NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1). That is, refinement of coarsened BoxND must contain the original BoxND. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::coarsen (const BoxND< dim > &b, const IntVectND< dim > &ref_ratio) noexcept
 Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/ratio and hi <- hi/ratio. NOTE: if type(dir) = NODE centered: lo <- lo/ratio and hi <- hi/ratio + ((hiratio)==0 ? 0 : 1). That is, refinement of coarsened BoxND must contain the original BoxND. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::refine (const BoxND< dim > &b, int ref_ratio) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::refine (const BoxND< dim > &b, const IntVectND< dim > &ref_ratio) noexcept
 Refine BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo*ratio and hi <- (hi+1)*ratio - 1. NOTE: if type(dir) = NODE centered: lo <- lo*ratio and hi <- hi*ratio. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::shift (const BoxND< dim > &b, int dir, int nzones) noexcept
 Return a BoxND with indices shifted by nzones in dir direction. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::shift (const BoxND< dim > &b, const IntVectND< dim > &nzones) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::surroundingNodes (const BoxND< dim > &b, int dir) noexcept
 Returns a BoxND with NODE based coordinates in direction dir that encloses BoxND b. NOTE: equivalent to b.convert(dir,NODE) NOTE: error if b.type(dir) == NODE. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::surroundingNodes (const BoxND< dim > &b, Direction d) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::surroundingNodes (const BoxND< dim > &b) noexcept
 Returns a BoxND with NODE based coordinates in all directions that encloses BoxND b. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::convert (const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
 Returns a BoxND with different type. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::convert (const BoxND< dim > &b, const IndexTypeND< dim > &typ) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::enclosedCells (const BoxND< dim > &b, int dir) noexcept
 Returns a BoxND with CELL based coordinates in direction dir that is enclosed by b. NOTE: equivalent to b.convert(dir,CELL) NOTE: error if b.type(dir) == CELL. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::enclosedCells (const BoxND< dim > &b, Direction d) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::enclosedCells (const BoxND< dim > &b) noexcept
 Returns a BoxND with CELL based coordinates in all directions that is enclosed by b. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::bdryLo (const BoxND< dim > &b, int dir, int len=1) noexcept
 Returns the edge-centered BoxND (in direction dir) defining the low side of BoxND b. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::bdryHi (const BoxND< dim > &b, int dir, int len=1) noexcept
 Returns the edge-centered BoxND (in direction dir) defining the high side of BoxND b. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE 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 box b. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::adjCellLo (const BoxND< dim > &b, int dir, int len=1) noexcept
 Returns the cell centered BoxND of length len adjacent to b on the low end along the coordinate direction dir. The return BoxND is identical to b in the other directions. The return BoxND and b have an empty intersection. NOTE: len >= 1 NOTE: BoxND retval = b.adjCellLo(b,dir,len) is equivalent to the following set of operations: BoxND retval(b); retval.convert(dir,BoxND::CELL); retval.setrange(dir,retval.smallEnd(dir)-len,len);. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::adjCellHi (const BoxND< dim > &b, int dir, int len=1) noexcept
 Similar to adjCellLo but builds an adjacent BoxND on the high end. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::adjCell (const BoxND< dim > &b, Orientation face, int len=1) noexcept
 Similar to adjCellLo and adjCellHi; operates on given face. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::minBox (const BoxND< dim > &b1, const BoxND< dim > &b2) noexcept
 Modify BoxND to that of the minimum BoxND containing both the original BoxND and the argument. Both BoxNDes must have identical type. More...
 
std::ostream & amrex::detail::box_write (std::ostream &os, const int *smallend, const int *bigend, const int *type, int dim)
 
std::istream & amrex::detail::box_read (std::istream &is, int *smallend, int *bigend, int *type, int dim)
 
template<std::size_t... Ns, class T , class U >
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE auto amrex::detail::BoxSplit_imp (std::index_sequence< Ns... >, const T &lo, const T &hi, const U &typ) noexcept
 
template<int dim>
std::ostream & amrex::operator<< (std::ostream &os, const BoxND< dim > &bx)
 Write an ASCII representation to the ostream. More...
 
template<int dim>
std::istream & amrex::operator>> (std::istream &is, BoxND< dim > &bx)
 Read from istream. More...
 
template<int d, int... dims>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE BoxND< detail::get_sum< d, dims... >)> amrex::BoxCat (const BoxND< d > &bx, const BoxND< dims > &...boxes) noexcept
 Returns a BoxND obtained by concatenating the input BoxNDs. The dimension of the return value equals the sum of the dimensions of the inputted BoxNDs. More...
 
template<int d, int... dims>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE GpuTuple< BoxND< d >, BoxND< dims >... > amrex::BoxSplit (const BoxND< detail::get_sum< d, dims... >()> &bx) noexcept
 Returns a tuple of BoxNDs obtained by splitting the input BoxND according to the dimensions specified by the template arguments. More...
 
template<int new_dim, int old_dim>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE BoxND< new_dim > amrex::BoxShrink (const BoxND< old_dim > &bx) noexcept
 Returns a new BoxND of dimension new_dim and assigns the first new_dim dimension of this BoxND to it. More...
 
template<int new_dim, int old_dim>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE BoxND< new_dim > amrex::BoxExpand (const BoxND< old_dim > &bx) noexcept
 Returns a new BoxND of size new_dim and assigns all values of this BoxND to it and (small=0, big=0, typ=CELL) to the remaining elements. More...
 
template<int new_dim, int old_dim>
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE BoxND< new_dim > amrex::BoxResize (const BoxND< old_dim > &bx) noexcept
 Returns a new BoxND of size new_dim by either shrinking or expanding this BoxND. More...
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::lbound_iv (BoxND< dim > const &box) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::ubound_iv (BoxND< dim > const &box) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::begin_iv (BoxND< dim > const &box) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::end_iv (BoxND< dim > const &box) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::length_iv (BoxND< dim > const &box) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::max_lbound_iv (BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::max_lbound_iv (BoxND< dim > const &b1, IntVectND< dim > const &lo) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::min_ubound_iv (BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::min_ubound_iv (BoxND< dim > const &b1, IntVectND< dim > const &hi) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::lbound (BoxND< dim > const &box) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::ubound (BoxND< dim > const &box) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::begin (BoxND< dim > const &box) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::end (BoxND< dim > const &box) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::length (BoxND< dim > const &box) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::max_lbound (BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::max_lbound (BoxND< dim > const &b1, Dim3 const &lo) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::min_ubound (BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
 
template<int dim, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 amrex::min_ubound (BoxND< dim > const &b1, Dim3 const &hi) noexcept
 
template<int dim>
AMREX_FORCE_INLINE BoxND< dim > amrex::getIndexBounds (BoxND< dim > const &b1) noexcept
 
template<int dim>
AMREX_FORCE_INLINE BoxND< dim > amrex::getIndexBounds (BoxND< dim > const &b1, BoxND< dim > const &b2) noexcept
 
template<class T , class ... Ts>
AMREX_FORCE_INLINE auto amrex::getIndexBounds (T const &b1, T const &b2, Ts const &... b3) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > amrex::getCell (BoxND< dim > const *boxes, int nboxes, Long icell) noexcept
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::makeSlab (BoxND< dim > const &b, int direction, int slab_index) noexcept
 
template<int dim = AMREX_SPACEDIM, std::enable_if_t<(1<=dim &&dim<=3), int > = 0>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::makeSingleCellBox (int i, int j, int k, IndexTypeND< dim > typ=IndexTypeND< dim >::TheCellType())
 
template<int dim>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > amrex::makeSingleCellBox (IntVectND< dim > const &vect, IndexTypeND< dim > typ=IndexTypeND< dim >::TheCellType())