![]() |
Block-Structured AMR Software Framework
|
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 | |
| BoxArray & | operator= (BoxArray const &rhs)=default |
| BoxArray & | operator= (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. | |
| BoxArray & | maxSize (int block_size) |
Split any Box whose side length exceeds block_size. | |
| BoxArray & | maxSize (const IntVect &block_size) |
Split any Box whose dimensions exceed block_size. | |
| BoxArray & | minmaxSize (const IntVect &min_size, const IntVect &max_size) |
Constrain Box sizes between min_size and max_size. | |
| BoxArray & | refine (int refinement_ratio) |
Refine each Box in the BoxArray by refinement_ratio. | |
| BoxArray & | refine (const IntVect &iv) |
Refine each Box in the BoxArray by iv. | |
| BoxArray & | coarsen (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. | |
| BoxArray & | coarsen (const IntVect &iv) |
Coarsen each Box in the BoxArray by iv. | |
| BoxArray & | growcoarsen (int n, const IntVect &iv) |
Expand boxes by n cells in every direction, then coarsen by iv. | |
| BoxArray & | growcoarsen (IntVect const &ngrow, const IntVect &iv) |
Expand boxes by anisotropic grow cells, then coarsen by iv. | |
| BoxArray & | grow (int n) |
Grow each Box by n cells in every direction. | |
| BoxArray & | grow (const IntVect &iv) |
Grow each Box by iv cells. | |
| BoxArray & | grow (int idir, int n_cell) |
Grow each Box on both ends in dimension idir. | |
| BoxArray & | growLo (int idir, int n_cell) |
Grow each Box on the lower side of dimension idir. | |
| BoxArray & | growHi (int idir, int n_cell) |
Grow each Box on the upper side of dimension idir. | |
| BoxArray & | surroundingNodes () |
| Convert the BoxArray to nodal type in all directions. | |
| BoxArray & | surroundingNodes (int dir) |
Convert the BoxArray to nodal type in direction dir. | |
| BoxArray & | enclosedCells () |
| Convert the BoxArray to cell-centered type in all directions. | |
| BoxArray & | enclosedCells (int dir) |
Convert the BoxArray to cell-centered type in direction dir. | |
| BoxArray & | convert (IndexType typ) |
| Set the IndexType of the BoxArray. | |
| BoxArray & | convert (const IntVect &iv) |
| Set the IndexType of the BoxArray from an IntVect of flags. | |
| BoxArray & | convert (Box(*fp)(const Box &)) |
Apply fp to every Box in the BoxArray. | |
| BoxArray & | shift (int dir, int nzones) |
Shift each Box in the BoxArray by nzones cells in direction dir. | |
| BoxArray & | shift (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 |
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.
|
noexcept |
Construct an empty BoxArray.
|
default |
|
defaultnoexcept |
|
defaultnoexcept |
|
explicit |
Make a BoxArray out of a single box.
| bx | Box to insert. |
|
explicit |
Construct a BoxArray with n empty boxes.
Construct a BoxArray from an array of Boxes.
| bxvec | Pointer to an array of Boxes. |
| nbox | Number of Boxes referenced by bxvec. |
|
explicitnoexcept |
| amrex::BoxArray::BoxArray | ( | const BoxArray & | rhs, |
| const BATransformer & | trans | ||
| ) |
|
inlinenoexcept |
Return the number of boxes that can be held in the current allocated storage.
|
noexcept |
Are the BoxArrays equal after conversion to cell-centered.
| void amrex::BoxArray::clear | ( | ) |
Remove all Boxes from the BoxArray.
| void amrex::BoxArray::clear_hash_bin | ( | ) | const |
Clear out the internal hash table used by intersections.
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.
| iv | Direction-wise coarsening factors. |
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.
| refinement_ratio | Uniform coarsening factor. |
| 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.
| refinement_ratio | Direction-wise integer factors. |
| min_width | Minimum acceptable post-coarsening lengths per dimension. |
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.
| refinement_ratio | Direction-wise integer factors. |
| min_width | Minimum post-coarsening length allowed in any dimension. |
min_width cells after coarsening. 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.
| refinement_ratio | Uniform integer factor for coarsening. |
| min_width | Minimum post-coarsening length allowed in any dimension. |
min_width cells after coarsening. | BoxList amrex::BoxArray::complementIn | ( | const Box & | b, |
| const Periodicity & | period | ||
| ) | const |
Return box - periodic boxarray.
| 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.
| ba | BoxArray to test. |
| period | Periodicity describing the allowed shifts. |
| bool amrex::BoxArray::contains | ( | const IntVect & | v | ) | const |
Return true if the cell v is within any box in the array.
| v | Index to test. |
Apply fp to every Box in the BoxArray.
This transforms each box individually, so it can be expensive for large BoxArrays.
| fp | Function mapping a Box to a new Box. |
Set the IndexType of the BoxArray from an IntVect of flags.
Inexpensive — only the IndexType in the BATransformer is updated.
| iv | IntVect of 0 (cell-centered) / 1 (nodal) flags per direction. |
Set the IndexType of the BoxArray.
Inexpensive — only the IndexType in the BATransformer is updated.
| typ | Desired index type. |
|
noexcept |
Returns the total number of cells (in double type) contained in all boxes in the BoxArray.
|
noexcept |
| void amrex::BoxArray::define | ( | const Box & | bx | ) |
| void amrex::BoxArray::define | ( | const BoxList & | bl | ) |
|
inlinenoexcept |
Return whether the BoxArray is empty.
| BoxArray & amrex::BoxArray::enclosedCells | ( | ) |
Convert the BoxArray to cell-centered type in all directions.
Inexpensive — only the IndexType in the BATransformer is updated.
Convert the BoxArray to cell-centered type in direction dir.
Inexpensive — only the IndexType in the BATransformer is updated.
| dir | Direction to make cell-centered. |
|
static |
Return cell-centered box at element index of this BoxArray.
|
inlinenoexcept |
Return a unique ID of the reference.
| std::shared_ptr< BARef > & amrex::BoxArray::getSharedRef | ( | ) |
Return a modifiable shared pointer to the Box storage.
| std::shared_ptr< BARef > const & amrex::BoxArray::getSharedRef | ( | ) | const |
Return the shared pointer to the Box storage.
| std::weak_ptr< BARef > amrex::BoxArray::getWeakRef | ( | ) | const |
Return a weak pointer to the shared Box storage.
Grow each Box by iv cells.
This grows every box individually, so it can be expensive for large BoxArrays.
| iv | Direction-wise growth amounts. |
Grow each Box on both ends in dimension idir.
This grows every box individually, so it can be expensive for large BoxArrays.
| idir | Coordinate direction. |
| n_cell | Number of cells to add on each side. |
Grow each Box by n cells in every direction.
This grows every box individually, so it can be expensive for large BoxArrays.
| n | Number of cells to add on each side. |
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.
| n | Symmetric grow cells applied before coarsening. |
| iv | Direction-wise coarsening ratio. |
Expand boxes by anisotropic grow cells, then coarsen by iv.
This processes every box individually, so it can be expensive for large BoxArrays.
| ngrow | Direction-wise grow cells applied before coarsening. |
| iv | Direction-wise coarsening ratio. |
Grow each Box on the upper side of dimension idir.
This grows every box individually, so it can be expensive for large BoxArrays.
| idir | Coordinate direction. |
| n_cell | Number of cells to add. |
Grow each Box on the lower side of dimension idir.
This grows every box individually, so it can be expensive for large BoxArrays.
| idir | Coordinate direction. |
| n_cell | Number of cells to add. |
|
static |
| 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.
| bx | Box to intersect. |
| isects | Output vector of index/Box pairs. |
| bool amrex::BoxArray::isDisjoint | ( | ) | const |
Return true if set of intersecting Boxes in BoxArray is null.
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.
| block_size | Direction-wise maximum sizes. |
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.
| block_size | Uniform maximum size per dimension. |
| Box amrex::BoxArray::minimalBox | ( | ) | const |
Return smallest Box that contains all Boxes in this BoxArray.
Return minimal enclosing box and average points per box.
| npts_avg_box | Output average number of points per box. |
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.
| min_size | Direction-wise minimum sizes. |
| max_size | Direction-wise maximum sizes. |
|
noexcept |
Returns the total number of cells contained in all boxes in the BoxArray.
| bool amrex::BoxArray::ok | ( | ) | const |
|
noexcept |
Are the BoxArrays not equal?
|
noexcept |
Are the BoxArrays equal?
Return element index of this BoxArray.
Return element index of this BoxArray.
| 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().
| is | Input stream containing serialized boxes. |
AMREX_SPACEDIM). Refine each Box in the BoxArray by iv.
This refines every box individually, so it can be expensive for large BoxArrays.
| iv | Direction-wise refinement factors. |
Refine each Box in the BoxArray by refinement_ratio.
This refines every box individually, so it can be expensive for large BoxArrays.
| refinement_ratio | Uniform refinement factor. |
| void amrex::BoxArray::removeOverlap | ( | bool | simplify = true | ) |
| void amrex::BoxArray::resize | ( | Long | len | ) |
Resize the BoxArray. See Vector<T>::resize() for the gory details.
whether two BoxArrays share the same data
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.
| i | Box index. |
| ibox | New box value. |
Shift each Box in the BoxArray by iv.
This shifts every box individually, so it can be expensive for large BoxArrays.
| iv | Direction-wise shift amounts. |
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.
| dir | Coordinate direction. |
| nzones | Number of cells to shift. |
| BoxArray amrex::BoxArray::simplified | ( | ) | const |
Return a simplified BoxArray; regular AMR grids only.
| BoxList const & amrex::BoxArray::simplified_list | ( | ) | const |
Return (and cache) a simplified BoxList representation; regular AMR grids only.
| BoxArray & amrex::BoxArray::surroundingNodes | ( | ) |
Convert the BoxArray to nodal type in all directions.
The operation is inexpensive — it only adjusts the internal BATransformer.
Convert the BoxArray to nodal type in direction dir.
The operation is inexpensive — it only adjusts the internal BATransformer.
| dir | Direction to make nodal. |
| BATransformer const & amrex::BoxArray::transformer | ( | ) | const |
Return the transformer describing index-type/coarsening metadata.
| void amrex::BoxArray::uniqify | ( | ) |
Make ourselves unique.
| std::ostream & amrex::BoxArray::writeOn | ( | std::ostream & | os | ) | const |
Output this BoxArray to a checkpoint file.
|
friend |
|
friend |
|
static |