Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::BoxArray Class Reference

Reference-counted collection of Boxes. More...

#include <AMReX_BoxArray.H>

Classes

struct  RefID
 

Public Member Functions

 BoxArray () noexcept
 Construct an empty BoxArray.
 
 BoxArray (const BoxArray &rhs)=default
 
 BoxArray (BoxArray &&rhs) noexcept=default
 
BoxArrayoperator= (BoxArray const &rhs)=default
 
BoxArrayoperator= (BoxArray &&rhs) noexcept=default
 
 ~BoxArray () noexcept=default
 
 BoxArray (const Box &bx)
 Make a BoxArray out of a single box.
 
 BoxArray (size_t n)
 Construct a BoxArray with n empty boxes.
 
 BoxArray (const Box *bxvec, int nbox)
 Construct a BoxArray from an array of Boxes.
 
 BoxArray (const BoxList &bl)
 Construct a BoxArray from a BoxList.
 
 BoxArray (BoxList &&bl) noexcept
 
 BoxArray (const BoxArray &rhs, const BATransformer &trans)
 Construct a BoxArray by applying a transformer to another array.
 
 BoxArray (BoxList &&bl, IntVect const &max_grid_size)
 Construct from a BoxList with a maximum grid size constraint.
 
void define (const Box &bx)
 Initialize the BoxArray from a single box.
 
void define (const BoxList &bl)
 Initialize the BoxArray from the supplied BoxList.
 
void define (BoxList &&bl) noexcept
 
void clear ()
 Remove all Boxes from the BoxArray.
 
void resize (Long len)
 Resize the BoxArray. See Vector<T>::resize() for the gory details.
 
Long size () const noexcept
 Return the number of boxes in the BoxArray.
 
Long capacity () const noexcept
 Return the number of boxes that can be held in the current allocated storage.
 
bool empty () const noexcept
 Return whether the BoxArray is empty.
 
Long numPts () const noexcept
 Returns the total number of cells contained in all boxes in the BoxArray.
 
double d_numPts () const noexcept
 Returns the total number of cells (in double type) contained in all boxes in the BoxArray.
 
int readFrom (std::istream &is)
 Initialize the BoxArray from the supplied istream.
 
std::ostream & writeOn (std::ostream &) const
 Output this BoxArray to a checkpoint file.
 
bool operator== (const BoxArray &rhs) const noexcept
 Are the BoxArrays equal?
 
bool operator!= (const BoxArray &rhs) const noexcept
 Are the BoxArrays not equal?
 
bool operator== (const Vector< Box > &bv) const noexcept
 
bool operator!= (const Vector< Box > &bv) const noexcept
 
bool CellEqual (const BoxArray &rhs) const noexcept
 Are the BoxArrays equal after conversion to cell-centered.
 
BoxArraymaxSize (int block_size)
 Split any Box whose side length exceeds block_size.
 
BoxArraymaxSize (const IntVect &block_size)
 Split any Box whose dimensions exceed block_size.
 
BoxArrayminmaxSize (const IntVect &min_size, const IntVect &max_size)
 Constrain Box sizes between min_size and max_size.
 
BoxArrayrefine (int refinement_ratio)
 Refine each Box in the BoxArray by refinement_ratio.
 
BoxArrayrefine (const IntVect &iv)
 Refine each Box in the BoxArray by iv.
 
BoxArraycoarsen (int refinement_ratio)
 Coarsen each Box in the BoxArray by refinement_ratio.
 
bool coarsenable (int refinement_ratio, int min_width=1) const
 Check whether every Box is coarsenable by refinement_ratio.
 
bool coarsenable (const IntVect &refinement_ratio, int min_width=1) const
 Check whether every Box is coarsenable by refinement_ratio.
 
bool coarsenable (const IntVect &refinement_ratio, const IntVect &min_width) const
 Check whether every Box is coarsenable by refinement_ratio.
 
BoxArraycoarsen (const IntVect &iv)
 Coarsen each Box in the BoxArray by iv.
 
BoxArraygrowcoarsen (int n, const IntVect &iv)
 Expand boxes by n cells in every direction, then coarsen by iv.
 
BoxArraygrowcoarsen (IntVect const &ngrow, const IntVect &iv)
 Expand boxes by anisotropic grow cells, then coarsen by iv.
 
BoxArraygrow (int n)
 Grow each Box by n cells in every direction.
 
BoxArraygrow (const IntVect &iv)
 Grow each Box by iv cells.
 
BoxArraygrow (int idir, int n_cell)
 Grow each Box on both ends in dimension idir.
 
BoxArraygrowLo (int idir, int n_cell)
 Grow each Box on the lower side of dimension idir.
 
BoxArraygrowHi (int idir, int n_cell)
 Grow each Box on the upper side of dimension idir.
 
BoxArraysurroundingNodes ()
 Convert the BoxArray to nodal type in all directions.
 
BoxArraysurroundingNodes (int dir)
 Convert the BoxArray to nodal type in direction dir.
 
BoxArrayenclosedCells ()
 Convert the BoxArray to cell-centered type in all directions.
 
BoxArrayenclosedCells (int dir)
 Convert the BoxArray to cell-centered type in direction dir.
 
BoxArrayconvert (IndexType typ)
 Set the IndexType of the BoxArray.
 
BoxArrayconvert (const IntVect &iv)
 Set the IndexType of the BoxArray from an IntVect of flags.
 
BoxArrayconvert (Box(*fp)(const Box &))
 Apply fp to every Box in the BoxArray.
 
BoxArrayshift (int dir, int nzones)
 Shift each Box in the BoxArray by nzones cells in direction dir.
 
BoxArrayshift (const IntVect &iv)
 Shift each Box in the BoxArray by iv.
 
void set (int i, const Box &ibox)
 Set element i to ibox if no coarsening transformer is active.
 
Box operator[] (int index) const noexcept
 Return element index of this BoxArray.
 
Box operator[] (const MFIter &mfi) const noexcept
 Return element index of this BoxArray.
 
Box get (int index) const noexcept
 Return element index of this BoxArray.
 
Box getCellCenteredBox (int index) const noexcept
 Return cell-centered box at element index of this BoxArray.
 
bool ok () const
 Return true if the BoxArray is empty or every Box reports ok().
 
bool isDisjoint () const
 Return true if set of intersecting Boxes in BoxArray is null.
 
BoxList boxList () const
 Create a BoxList from this BoxArray.
 
bool contains (const IntVect &v) const
 Return true if the cell v is within any box in the array.
 
bool contains (const Box &b, bool assume_disjoint_ba=false, const IntVect &ng=IntVect(0)) const
 True if the Box is contained in this BoxArray(+ng).
 
bool contains (const BoxArray &ba, bool assume_disjoint_ba=false, const IntVect &ng=IntVect(0)) const
 True if all Boxes in ba are contained in this BoxArray(+ng).
 
bool contains (const BoxArray &ba, Periodicity const &period) const
 True if all indices in ba are periodically contained in this BoxArray.
 
Box minimalBox () const
 Return smallest Box that contains all Boxes in this BoxArray.
 
Box minimalBox (Long &npts_avg_box) const
 Return minimal enclosing box and average points per box.
 
bool intersects (const Box &b, int ng=0) const
 True if b intersects this BoxArray(+ng).
 
bool intersects (const Box &b, const IntVect &ng) const
 True if b intersects this BoxArray(+ng).
 
std::vector< std::pair< int, Box > > intersections (const Box &bx) const
 Return all intersections of bx with this BoxArray.
 
std::vector< std::pair< int, Box > > intersections (const Box &bx, bool first_only, int ng) const
 Return intersections of Box and BoxArray(+ghostcells).
 
std::vector< std::pair< int, Box > > intersections (const Box &bx, bool first_only, const IntVect &ng) const
 Return intersections of Box and BoxArray(+ghostcells).
 
void intersections (const Box &bx, std::vector< std::pair< int, Box > > &isects) const
 Intersect bx with the BoxArray and store the result in isects.
 
void intersections (const Box &bx, std::vector< std::pair< int, Box > > &isects, bool first_only, int ng) const
 Intersect bx with the BoxArray(+ghostcells) and store the result in isects.
 
void intersections (const Box &bx, std::vector< std::pair< int, Box > > &isects, bool first_only, const IntVect &ng) const
 Intersect bx with the BoxArray(+ghostcells) and store the result in isects.
 
BoxList complementIn (const Box &b) const
 Return box - boxarray.
 
void complementIn (BoxList &bl, const Box &b) const
 
BoxList complementIn (const Box &b, const Periodicity &period) const
 Return box - periodic boxarray.
 
void clear_hash_bin () const
 Clear out the internal hash table used by intersections.
 
void removeOverlap (bool simplify=true)
 Change the BoxArray to one with no overlap and then simplify it (see the simplify function in BoxList).
 
RefID getRefID () const noexcept
 Return a unique ID of the reference.
 
IndexType ixType () const noexcept
 Return index type of this BoxArray.
 
IntVect crseRatio () const noexcept
 Return crse ratio of this BoxArray.
 
void uniqify ()
 Make ourselves unique.
 
BoxList const & simplified_list () const
 Return (and cache) a simplified BoxList representation; regular AMR grids only.
 
BoxArray simplified () const
 Return a simplified BoxArray; regular AMR grids only.
 
BATransformer const & transformer () const
 Return the transformer describing index-type/coarsening metadata.
 
std::weak_ptr< BARef > getWeakRef () const
 Return a weak pointer to the shared Box storage.
 
std::shared_ptr< BARef > const & getSharedRef () const
 Return the shared pointer to the Box storage.
 
std::shared_ptr< BARef > & getSharedRef ()
 Return a modifiable shared pointer to the Box storage.
 

Static Public Member Functions

static bool SameRefs (const BoxArray &lhs, const BoxArray &rhs)
 whether two BoxArrays share the same data
 
static void Initialize ()
 
static void Finalize ()
 

Static Public Attributes

static bool initialized = false
 

Friends

class AmrMesh
 
class FabArrayBase
 

Detailed Description

Reference-counted collection of Boxes.

A BoxArray stores Boxes in integer index space along with optional transformations (e.g., nodal flags or coarsening ratios). Most operations modify the array in place, while free functions provide out-of-place variants.

Constructor & Destructor Documentation

◆ BoxArray() [1/10]

amrex::BoxArray::BoxArray ( )
noexcept

Construct an empty BoxArray.

◆ BoxArray() [2/10]

amrex::BoxArray::BoxArray ( const BoxArray rhs)
default

◆ BoxArray() [3/10]

amrex::BoxArray::BoxArray ( BoxArray &&  rhs)
defaultnoexcept

◆ ~BoxArray()

amrex::BoxArray::~BoxArray ( )
defaultnoexcept

◆ BoxArray() [4/10]

amrex::BoxArray::BoxArray ( const Box bx)
explicit

Make a BoxArray out of a single box.

Parameters
bxBox to insert.

◆ BoxArray() [5/10]

amrex::BoxArray::BoxArray ( size_t  n)
explicit

Construct a BoxArray with n empty boxes.

◆ BoxArray() [6/10]

amrex::BoxArray::BoxArray ( const Box bxvec,
int  nbox 
)

Construct a BoxArray from an array of Boxes.

Parameters
bxvecPointer to an array of Boxes.
nboxNumber of Boxes referenced by bxvec.

◆ BoxArray() [7/10]

amrex::BoxArray::BoxArray ( const BoxList bl)
explicit

Construct a BoxArray from a BoxList.

◆ BoxArray() [8/10]

amrex::BoxArray::BoxArray ( BoxList &&  bl)
explicitnoexcept

◆ BoxArray() [9/10]

amrex::BoxArray::BoxArray ( const BoxArray rhs,
const BATransformer &  trans 
)

Construct a BoxArray by applying a transformer to another array.

Parameters
rhsSource BoxArray.
transTransformer describing additional index-type/coarsening rules.

◆ BoxArray() [10/10]

amrex::BoxArray::BoxArray ( BoxList &&  bl,
IntVect const &  max_grid_size 
)

Construct from a BoxList with a maximum grid size constraint.

Parameters
blInput list of boxes.
max_grid_sizeMaximum allowed extent per dimension.

Member Function Documentation

◆ boxList()

BoxList amrex::BoxArray::boxList ( ) const

Create a BoxList from this BoxArray.

◆ capacity()

Long amrex::BoxArray::capacity ( ) const
inlinenoexcept

Return the number of boxes that can be held in the current allocated storage.

◆ CellEqual()

bool amrex::BoxArray::CellEqual ( const BoxArray rhs) const
noexcept

Are the BoxArrays equal after conversion to cell-centered.

◆ clear()

void amrex::BoxArray::clear ( )

Remove all Boxes from the BoxArray.

◆ clear_hash_bin()

void amrex::BoxArray::clear_hash_bin ( ) const

Clear out the internal hash table used by intersections.

◆ coarsen() [1/2]

BoxArray & amrex::BoxArray::coarsen ( const IntVect iv)

Coarsen each Box in the BoxArray by iv.

Inexpensive — only the internal coarsening ratio stored in the BATransformer is updated; the boxes themselves are not touched.

Parameters
ivDirection-wise coarsening factors.

◆ coarsen() [2/2]

BoxArray & amrex::BoxArray::coarsen ( int  refinement_ratio)

Coarsen each Box in the BoxArray by refinement_ratio.

Inexpensive — only the internal coarsening ratio stored in the BATransformer is updated; the boxes themselves are not touched.

Parameters
refinement_ratioUniform coarsening factor.

◆ coarsenable() [1/3]

bool amrex::BoxArray::coarsenable ( const IntVect refinement_ratio,
const IntVect min_width 
) const

Check whether every Box is coarsenable by refinement_ratio.

A Box is coarsenable when box.coarsen(refinement_ratio).refine(refinement_ratio) recovers the original Box — stronger than the extent being a multiple of the ratio: with ratio 2, cell-centered [0,2] (3 cells) and even-sized cell-centered [1,2] (odd small end) are not coarsenable, but nodal [0,2] (3 nodes) is.

Parameters
refinement_ratioDirection-wise integer factors.
min_widthMinimum acceptable post-coarsening lengths per dimension.
Returns
true if all boxes remain above the supplied per-dimension limits.

◆ coarsenable() [2/3]

bool amrex::BoxArray::coarsenable ( const IntVect refinement_ratio,
int  min_width = 1 
) const

Check whether every Box is coarsenable by refinement_ratio.

A Box is coarsenable when box.coarsen(refinement_ratio).refine(refinement_ratio) recovers the original Box — stronger than the extent being a multiple of the ratio: with ratio 2, cell-centered [0,2] (3 cells) and even-sized cell-centered [1,2] (odd small end) are not coarsenable, but nodal [0,2] (3 nodes) is.

Parameters
refinement_ratioDirection-wise integer factors.
min_widthMinimum post-coarsening length allowed in any dimension.
Returns
true if all boxes remain at least min_width cells after coarsening.

◆ coarsenable() [3/3]

bool amrex::BoxArray::coarsenable ( int  refinement_ratio,
int  min_width = 1 
) const

Check whether every Box is coarsenable by refinement_ratio.

A Box is coarsenable when box.coarsen(refinement_ratio).refine(refinement_ratio) recovers the original Box — stronger than the extent being a multiple of the ratio: with ratio 2, cell-centered [0,2] (3 cells) and even-sized cell-centered [1,2] (odd small end) are not coarsenable, but nodal [0,2] (3 nodes) is.

Parameters
refinement_ratioUniform integer factor for coarsening.
min_widthMinimum post-coarsening length allowed in any dimension.
Returns
true if all boxes remain at least min_width cells after coarsening.

◆ complementIn() [1/3]

void amrex::BoxArray::complementIn ( BoxList bl,
const Box b 
) const

◆ complementIn() [2/3]

BoxList amrex::BoxArray::complementIn ( const Box b) const

Return box - boxarray.

◆ complementIn() [3/3]

BoxList amrex::BoxArray::complementIn ( const Box b,
const Periodicity period 
) const

Return box - periodic boxarray.

◆ contains() [1/4]

bool amrex::BoxArray::contains ( const Box b,
bool  assume_disjoint_ba = false,
const IntVect ng = IntVect(0) 
) const

True if the Box is contained in this BoxArray(+ng).

The Box must also have the same IndexType as those in this BoxArray.

Parameters
bBox to test.
assume_disjoint_baHint that this BoxArray is disjoint, enabling a faster test path.
ngGhost cells to inflate this BoxArray.

◆ contains() [2/4]

bool amrex::BoxArray::contains ( const BoxArray ba,
bool  assume_disjoint_ba = false,
const IntVect ng = IntVect(0) 
) const

True if all Boxes in ba are contained in this BoxArray(+ng).

Parameters
baBoxArray to test.
assume_disjoint_baHint that this BoxArray is disjoint, enabling a faster test path.
ngGhost cells to inflate this BoxArray.

◆ contains() [3/4]

bool amrex::BoxArray::contains ( const BoxArray ba,
Periodicity const &  period 
) const

True if all indices in ba are periodically contained in this BoxArray.

An index is periodically contained if, after being shifted by an integer multiple of the period, it falls inside this BoxArray.

Parameters
baBoxArray to test.
periodPeriodicity describing the allowed shifts.

◆ contains() [4/4]

bool amrex::BoxArray::contains ( const IntVect v) const

Return true if the cell v is within any box in the array.

Parameters
vIndex to test.

◆ convert() [1/3]

BoxArray & amrex::BoxArray::convert ( Box(*)(const Box &)  fp)

Apply fp to every Box in the BoxArray.

This transforms each box individually, so it can be expensive for large BoxArrays.

Parameters
fpFunction mapping a Box to a new Box.

◆ convert() [2/3]

BoxArray & amrex::BoxArray::convert ( const IntVect iv)

Set the IndexType of the BoxArray from an IntVect of flags.

Inexpensive — only the IndexType in the BATransformer is updated.

Parameters
ivIntVect of 0 (cell-centered) / 1 (nodal) flags per direction.

◆ convert() [3/3]

BoxArray & amrex::BoxArray::convert ( IndexType  typ)

Set the IndexType of the BoxArray.

Inexpensive — only the IndexType in the BATransformer is updated.

Parameters
typDesired index type.

◆ crseRatio()

IntVect amrex::BoxArray::crseRatio ( ) const
inlinenoexcept

Return crse ratio of this BoxArray.

◆ d_numPts()

double amrex::BoxArray::d_numPts ( ) const
noexcept

Returns the total number of cells (in double type) contained in all boxes in the BoxArray.

◆ define() [1/3]

void amrex::BoxArray::define ( BoxList &&  bl)
noexcept

◆ define() [2/3]

void amrex::BoxArray::define ( const Box bx)

Initialize the BoxArray from a single box.

It is an error if the BoxArray has already been initialized.

Parameters
bxBox to assign.

◆ define() [3/3]

void amrex::BoxArray::define ( const BoxList bl)

Initialize the BoxArray from the supplied BoxList.

It is an error if the BoxArray has already been initialized.

Parameters
blList of boxes to assign.

◆ empty()

bool amrex::BoxArray::empty ( ) const
inlinenoexcept

Return whether the BoxArray is empty.

◆ enclosedCells() [1/2]

BoxArray & amrex::BoxArray::enclosedCells ( )

Convert the BoxArray to cell-centered type in all directions.

Inexpensive — only the IndexType in the BATransformer is updated.

◆ enclosedCells() [2/2]

BoxArray & amrex::BoxArray::enclosedCells ( int  dir)

Convert the BoxArray to cell-centered type in direction dir.

Inexpensive — only the IndexType in the BATransformer is updated.

Parameters
dirDirection to make cell-centered.

◆ Finalize()

void amrex::BoxArray::Finalize ( )
static

◆ get()

Box amrex::BoxArray::get ( int  index) const
inlinenoexcept

Return element index of this BoxArray.

◆ getCellCenteredBox()

Box amrex::BoxArray::getCellCenteredBox ( int  index) const
inlinenoexcept

Return cell-centered box at element index of this BoxArray.

◆ getRefID()

RefID amrex::BoxArray::getRefID ( ) const
inlinenoexcept

Return a unique ID of the reference.

◆ getSharedRef() [1/2]

std::shared_ptr< BARef > & amrex::BoxArray::getSharedRef ( )

Return a modifiable shared pointer to the Box storage.

◆ getSharedRef() [2/2]

std::shared_ptr< BARef > const & amrex::BoxArray::getSharedRef ( ) const

Return the shared pointer to the Box storage.

◆ getWeakRef()

std::weak_ptr< BARef > amrex::BoxArray::getWeakRef ( ) const

Return a weak pointer to the shared Box storage.

◆ grow() [1/3]

BoxArray & amrex::BoxArray::grow ( const IntVect iv)

Grow each Box by iv cells.

This grows every box individually, so it can be expensive for large BoxArrays.

Parameters
ivDirection-wise growth amounts.

◆ grow() [2/3]

BoxArray & amrex::BoxArray::grow ( int  idir,
int  n_cell 
)

Grow each Box on both ends in dimension idir.

This grows every box individually, so it can be expensive for large BoxArrays.

Parameters
idirCoordinate direction.
n_cellNumber of cells to add on each side.

◆ grow() [3/3]

BoxArray & amrex::BoxArray::grow ( int  n)

Grow each Box by n cells in every direction.

This grows every box individually, so it can be expensive for large BoxArrays.

Parameters
nNumber of cells to add on each side.

◆ growcoarsen() [1/2]

BoxArray & amrex::BoxArray::growcoarsen ( int  n,
const IntVect iv 
)

Expand boxes by n cells in every direction, then coarsen by iv.

This processes every box individually, so it can be expensive for large BoxArrays.

Parameters
nSymmetric grow cells applied before coarsening.
ivDirection-wise coarsening ratio.
Returns
Reference to this BoxArray for chaining.

◆ growcoarsen() [2/2]

BoxArray & amrex::BoxArray::growcoarsen ( IntVect const &  ngrow,
const IntVect iv 
)

Expand boxes by anisotropic grow cells, then coarsen by iv.

This processes every box individually, so it can be expensive for large BoxArrays.

Parameters
ngrowDirection-wise grow cells applied before coarsening.
ivDirection-wise coarsening ratio.
Returns
Reference to this BoxArray for chaining.

◆ growHi()

BoxArray & amrex::BoxArray::growHi ( int  idir,
int  n_cell 
)

Grow each Box on the upper side of dimension idir.

This grows every box individually, so it can be expensive for large BoxArrays.

Parameters
idirCoordinate direction.
n_cellNumber of cells to add.

◆ growLo()

BoxArray & amrex::BoxArray::growLo ( int  idir,
int  n_cell 
)

Grow each Box on the lower side of dimension idir.

This grows every box individually, so it can be expensive for large BoxArrays.

Parameters
idirCoordinate direction.
n_cellNumber of cells to add.

◆ Initialize()

void amrex::BoxArray::Initialize ( )
static

◆ intersections() [1/6]

std::vector< std::pair< int, Box > > amrex::BoxArray::intersections ( const Box bx) const

Return all intersections of bx with this BoxArray.

Parameters
bxBox to intersect.
Returns
Vector of (box index, intersection Box) pairs.

◆ intersections() [2/6]

std::vector< std::pair< int, Box > > amrex::BoxArray::intersections ( const Box bx,
bool  first_only,
const IntVect ng 
) const

Return intersections of Box and BoxArray(+ghostcells).

Parameters
bxBox to intersect.
first_onlyIf true, stop after first intersection.
ngDirection-wise ghost cells to inflate this BoxArray.

◆ intersections() [3/6]

std::vector< std::pair< int, Box > > amrex::BoxArray::intersections ( const Box bx,
bool  first_only,
int  ng 
) const

Return intersections of Box and BoxArray(+ghostcells).

Parameters
bxBox to intersect.
first_onlyIf true, stop after first intersection.
ngGhost cells to inflate this BoxArray.

◆ intersections() [4/6]

void amrex::BoxArray::intersections ( const Box bx,
std::vector< std::pair< int, Box > > &  isects 
) const

Intersect bx with the BoxArray and store the result in isects.

Parameters
bxBox to intersect.
isectsOutput vector of index/Box pairs.

◆ intersections() [5/6]

void amrex::BoxArray::intersections ( const Box bx,
std::vector< std::pair< int, Box > > &  isects,
bool  first_only,
const IntVect ng 
) const

Intersect bx with the BoxArray(+ghostcells) and store the result in isects.

Parameters
bxBox to intersect.
isectsOutput vector of index/Box pairs.
first_onlyIf true, stop after first intersection.
ngDirection-wise ghost cells to inflate this BoxArray.

◆ intersections() [6/6]

void amrex::BoxArray::intersections ( const Box bx,
std::vector< std::pair< int, Box > > &  isects,
bool  first_only,
int  ng 
) const

Intersect bx with the BoxArray(+ghostcells) and store the result in isects.

Parameters
bxBox to intersect.
isectsOutput vector of index/Box pairs.
first_onlyIf true, stop after first intersection.
ngGhost cells to inflate this BoxArray.

◆ intersects() [1/2]

bool amrex::BoxArray::intersects ( const Box b,
const IntVect ng 
) const

True if b intersects this BoxArray(+ng).

Parameters
bBox to test.
ngDirection-wise ghost cells to inflate this BoxArray.

◆ intersects() [2/2]

bool amrex::BoxArray::intersects ( const Box b,
int  ng = 0 
) const

True if b intersects this BoxArray(+ng).

Parameters
bBox to test.
ngGhost cells to inflate this BoxArray.

◆ isDisjoint()

bool amrex::BoxArray::isDisjoint ( ) const

Return true if set of intersecting Boxes in BoxArray is null.

◆ ixType()

IndexType amrex::BoxArray::ixType ( ) const
inlinenoexcept

Return index type of this BoxArray.

◆ maxSize() [1/2]

BoxArray & amrex::BoxArray::maxSize ( const IntVect block_size)

Split any Box whose dimensions exceed block_size.

Boxes are recursively split until all extents fit. This may change the number of boxes in the array. This can be expensive for large BoxArrays.

Parameters
block_sizeDirection-wise maximum sizes.
Returns
Reference to this BoxArray for chaining.

◆ maxSize() [2/2]

BoxArray & amrex::BoxArray::maxSize ( int  block_size)

Split any Box whose side length exceeds block_size.

Boxes are recursively split until all extents fit. This may change the number of boxes in the array. This can be expensive for large BoxArrays.

Parameters
block_sizeUniform maximum size per dimension.

◆ minimalBox() [1/2]

Box amrex::BoxArray::minimalBox ( ) const

Return smallest Box that contains all Boxes in this BoxArray.

◆ minimalBox() [2/2]

Box amrex::BoxArray::minimalBox ( Long npts_avg_box) const

Return minimal enclosing box and average points per box.

Parameters
npts_avg_boxOutput average number of points per box.

◆ minmaxSize()

BoxArray & amrex::BoxArray::minmaxSize ( const IntVect min_size,
const IntVect max_size 
)

Constrain Box sizes between min_size and max_size.

This can be expensive for large BoxArrays. It's the caller's responsibility to make sure both the BoxArray and max_size are coarsenable by min_size.

Parameters
min_sizeDirection-wise minimum sizes.
max_sizeDirection-wise maximum sizes.

◆ numPts()

Long amrex::BoxArray::numPts ( ) const
noexcept

Returns the total number of cells contained in all boxes in the BoxArray.

◆ ok()

bool amrex::BoxArray::ok ( ) const

Return true if the BoxArray is empty or every Box reports ok().

A Box is ok() when each direction’s index type is either cell-centered or nodal and every upper bound is greater than or equal to its corresponding lower bound.

◆ operator!=() [1/2]

bool amrex::BoxArray::operator!= ( const BoxArray rhs) const
noexcept

Are the BoxArrays not equal?

◆ operator!=() [2/2]

bool amrex::BoxArray::operator!= ( const Vector< Box > &  bv) const
noexcept

◆ operator=() [1/2]

BoxArray & amrex::BoxArray::operator= ( BoxArray &&  rhs)
defaultnoexcept

◆ operator=() [2/2]

BoxArray & amrex::BoxArray::operator= ( BoxArray const &  rhs)
default

◆ operator==() [1/2]

bool amrex::BoxArray::operator== ( const BoxArray rhs) const
noexcept

Are the BoxArrays equal?

◆ operator==() [2/2]

bool amrex::BoxArray::operator== ( const Vector< Box > &  bv) const
noexcept

◆ operator[]() [1/2]

Box amrex::BoxArray::operator[] ( const MFIter mfi) const
noexcept

Return element index of this BoxArray.

◆ operator[]() [2/2]

Box amrex::BoxArray::operator[] ( int  index) const
inlinenoexcept

Return element index of this BoxArray.

◆ readFrom()

int amrex::BoxArray::readFrom ( std::istream &  is)

Initialize the BoxArray from the supplied istream.

It is an error if the BoxArray has already been initialized. Note that the BoxArray in the istream must have been written using writeOn().

Parameters
isInput stream containing serialized boxes.
Returns
The dimensionality stored in the stream (≤ AMREX_SPACEDIM).

◆ refine() [1/2]

BoxArray & amrex::BoxArray::refine ( const IntVect iv)

Refine each Box in the BoxArray by iv.

This refines every box individually, so it can be expensive for large BoxArrays.

Parameters
ivDirection-wise refinement factors.

◆ refine() [2/2]

BoxArray & amrex::BoxArray::refine ( int  refinement_ratio)

Refine each Box in the BoxArray by refinement_ratio.

This refines every box individually, so it can be expensive for large BoxArrays.

Parameters
refinement_ratioUniform refinement factor.

◆ removeOverlap()

void amrex::BoxArray::removeOverlap ( bool  simplify = true)

Change the BoxArray to one with no overlap and then simplify it (see the simplify function in BoxList).

◆ resize()

void amrex::BoxArray::resize ( Long  len)

Resize the BoxArray. See Vector<T>::resize() for the gory details.

◆ SameRefs()

static bool amrex::BoxArray::SameRefs ( const BoxArray lhs,
const BoxArray rhs 
)
inlinestatic

whether two BoxArrays share the same data

◆ set()

void amrex::BoxArray::set ( int  i,
const Box ibox 
)

Set element i to ibox if no coarsening transformer is active.

This mutator is valid only when the BoxArray is cell/nodal converted but not coarsened by a BATransformer.

Parameters
iBox index.
iboxNew box value.

◆ shift() [1/2]

BoxArray & amrex::BoxArray::shift ( const IntVect iv)

Shift each Box in the BoxArray by iv.

This shifts every box individually, so it can be expensive for large BoxArrays.

Parameters
ivDirection-wise shift amounts.

◆ shift() [2/2]

BoxArray & amrex::BoxArray::shift ( int  dir,
int  nzones 
)

Shift each Box in the BoxArray by nzones cells in direction dir.

This shifts every box individually, so it can be expensive for large BoxArrays.

Parameters
dirCoordinate direction.
nzonesNumber of cells to shift.

◆ simplified()

BoxArray amrex::BoxArray::simplified ( ) const

Return a simplified BoxArray; regular AMR grids only.

◆ simplified_list()

BoxList const & amrex::BoxArray::simplified_list ( ) const

Return (and cache) a simplified BoxList representation; regular AMR grids only.

◆ size()

Long amrex::BoxArray::size ( ) const
inlinenoexcept

Return the number of boxes in the BoxArray.

◆ surroundingNodes() [1/2]

BoxArray & amrex::BoxArray::surroundingNodes ( )

Convert the BoxArray to nodal type in all directions.

The operation is inexpensive — it only adjusts the internal BATransformer.

◆ surroundingNodes() [2/2]

BoxArray & amrex::BoxArray::surroundingNodes ( int  dir)

Convert the BoxArray to nodal type in direction dir.

The operation is inexpensive — it only adjusts the internal BATransformer.

Parameters
dirDirection to make nodal.

◆ transformer()

BATransformer const & amrex::BoxArray::transformer ( ) const

Return the transformer describing index-type/coarsening metadata.

◆ uniqify()

void amrex::BoxArray::uniqify ( )

Make ourselves unique.

◆ writeOn()

std::ostream & amrex::BoxArray::writeOn ( std::ostream &  os) const

Output this BoxArray to a checkpoint file.

Friends And Related Symbol Documentation

◆ AmrMesh

friend class AmrMesh
friend

◆ FabArrayBase

friend class FabArrayBase
friend

Member Data Documentation

◆ initialized

bool amrex::BoxArray::initialized = false
static

The documentation for this class was generated from the following files: