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

A list of Boxes sharing a common IndexType. More...

#include <AMReX_BoxList.H>

Inheritance diagram for amrex::BoxList:
amrex::BoxDomain

Public Types

using iterator = Vector< Box >::iterator
 
using const_iterator = Vector< Box >::const_iterator
 

Public Member Functions

 BoxList ()
 Construct an empty BoxList with IndexType::TheCellType().
 
 BoxList (const Box &bx)
 Make a boxList consisting of a single Box.
 
 BoxList (IndexType _btype)
 Construct an empty BoxList with IndexType _btype.
 
 BoxList (const BoxArray &ba)
 Construct a BoxList from a BoxArray.
 
 BoxList (Vector< Box > &&bxs)
 Construct a boxlist from a rvalue Vector<Box>.
 
 BoxList (const Box &bx, const IntVect &tilesize)
 Make a boxList consisting of non-overlapping tile box from a single Box.
 
 BoxList (const Box &bx, int nboxes)
 Make a BoxList consisting of nboxes Boxes from a single Box.
 
 BoxList (const Box &bx, int nboxes, Direction dir)
 Make a BoxList consisting of nboxes Boxes chopped in dir-direction from a single Box.
 
 ~BoxList ()=default
 
 BoxList (const BoxList &rhs)=default
 
 BoxList (BoxList &&rhs)=default
 
BoxListoperator= (const BoxList &rhs)=default
 
BoxListoperator= (BoxList &&rhs)=default
 
void reserve (std::size_t n)
 Reserve storage for at least n Boxes.
 
void push_back (const Box &bn)
 Append a Box to this BoxList.
 
Boxfront () noexcept
 Return a reference to the first Box in the list.
 
const Boxfront () const noexcept
 Return a const reference to the first Box in the list.
 
void join (const BoxList &blist)
 Join the BoxList to ourselves.
 
void join (const Vector< Box > &barr)
 Join the Array of Boxes to ourselves.
 
void catenate (BoxList &blist)
 Catenate the BoxList to ourselves. Removes entries from blist.
 
void clear ()
 Remove all Boxes from this BoxList.
 
Long size () const noexcept
 The number of Boxes in this BoxList.
 
std::size_t capacity () const noexcept
 Return the current allocated capacity.
 
iterator begin () noexcept
 Return an iterator to the first Box.
 
const_iterator begin () const noexcept
 Return a const iterator to the first Box.
 
const_iterator cbegin () const noexcept
 Return a const iterator to the first Box.
 
iterator end () noexcept
 Return an iterator past the last Box.
 
const_iterator end () const noexcept
 Return a const iterator past the last Box.
 
const_iterator cend () const noexcept
 Return a const iterator past the last Box.
 
bool ok () const noexcept
 True if this BoxList is valid; i.e. all the Boxes are valid and they all have the same IndexType. Also returns true if the BoxList is empty.
 
bool operator== (const BoxList &rhs) const
 Is this BoxList equal to rhs?
 
bool operator!= (const BoxList &rhs) const
 Is this BoxList notequal to rhs?
 
bool isEmpty () const noexcept
 Is this BoxList empty?
 
bool isNotEmpty () const noexcept
 Is this BoxList not empty?
 
bool isDisjoint () const
 True if the set of intersecting Boxes is empty.
 
bool contains (const BoxList &bl) const
 True if all Boxes in bl are contained in this BoxList.
 
BoxListintersect (const Box &b)
 Modify this BoxList to contain only its intersection with Box b.
 
BoxListintersect (const BoxList &bl)
 Modify this BoxList to contain only its intersection with BoxList bl.
 
BoxListremoveEmpty ()
 Remove empty Boxes from this BoxList.
 
BoxListcomplementIn (const Box &b, const BoxList &bl)
 Set this BoxList to the complement of BoxList bl in Box b.
 
BoxListcomplementIn (const Box &b, BoxList &&bl)
 Set this BoxList to the complement of BoxList bl (moved) in Box b.
 
BoxListcomplementIn (const Box &b, const BoxArray &ba)
 Set this BoxList to the complement of BoxArray ba in Box b.
 
BoxListparallelComplementIn (const Box &b, const BoxList &bl)
 Parallel version of complementIn using BoxList.
 
BoxListparallelComplementIn (const Box &b, BoxList &&bl)
 Parallel version of complementIn using BoxList (moved).
 
BoxListparallelComplementIn (const Box &b, const BoxArray &ba)
 Parallel version of complementIn using BoxArray.
 
BoxListrefine (int ratio)
 Refine each Box in the BoxList by a uniform ratio.
 
BoxListrefine (const IntVect &ratio)
 Refine each Box in the BoxList by direction-dependent ratios.
 
BoxListcoarsen (int ratio)
 Coarsen each Box in the BoxList by a uniform ratio.
 
BoxListcoarsen (const IntVect &ratio)
 Coarsen each Box in the BoxList by direction-dependent ratios.
 
BoxListaccrete (int sz)
 Grow each Box in the BoxList by sz cells in every direction.
 
BoxListaccrete (const IntVect &sz)
 Grow each Box in the BoxList by sz cells (per direction).
 
BoxListshift (int dir, int nzones)
 Apply Box::shift(dir, nzones) to every Box in the list.
 
BoxListshiftHalf (int dir, int num_halfs)
 Apply Box::shiftHalf(dir, num_halfs) to every Box in the list.
 
BoxListshiftHalf (const IntVect &iv)
 Apply Box::shiftHalf(const IntVect&) to every Box in the list.
 
int simplify (bool best=false)
 Merge adjacent Boxes in this BoxList. Return the number of Boxes merged. If "best" is specified we do a single bruteforce pass over the list checking each Box against all Boxes after it in the list to see if they can be merged. If "best" is not specified we limit how fair afield we look for possible matches. The "best" algorithm is O(N-squared) while the other algorithm is O(N).
 
int ordered_simplify ()
 Merge adjacent Boxes assuming the list is already sorted/ordered.
 
BoxListmaxSize (int chunk)
 Forces each Box in the BoxList to have sides of length <= chunk.
 
BoxListmaxSize (const IntVect &chunk)
 Forces each Box in the BoxList to have dimth side of length <= chunk[dim].
 
Box minimalBox () const
 Returns smallest Box that contains all Boxes in this BoxList.
 
IndexType ixType () const noexcept
 Returns the IndexType of Boxes in this BoxList.
 
void set (IndexType ixtyp) noexcept
 Set the type of the BoxList. It's an error if the BoxList isn't empty.
 
BoxListsurroundingNodes () noexcept
 Applies surroundingNodes(Box) to each Box in BoxArray. See the documentation of Box for details.
 
BoxListsurroundingNodes (int dir) noexcept
 Applies surroundingNodes(Box,int) to each Box in BoxList. See the documentation of Box for details.
 
BoxListenclosedCells () noexcept
 Applies Box::enclosedCells() to each Box in the BoxList.
 
BoxListenclosedCells (int dir) noexcept
 Applies Box::enclosedCells(int) to each Box in the BoxList.
 
BoxListconvert (IndexType typ) noexcept
 Applies Box::convert(IndexType) to each Box in the BoxList.
 
Vector< Box > & data () noexcept
 Returns a reference to the Vector<Box>.
 
const Vector< Box > & data () const noexcept
 Returns a constant reference to the Vector<Box>.
 
void swap (BoxList &rhs) noexcept
 Swap contents with another BoxList.
 
void Bcast ()
 Broadcast this BoxList from the I/O processor to all other processors.
 

Friends

class BoxDomain
 

Detailed Description

A list of Boxes sharing a common IndexType.

BoxList implements complement, intersection, refinement, coarsening, and other operations on collections of Boxes.

Member Typedef Documentation

◆ const_iterator

using amrex::BoxList::const_iterator = Vector<Box>::const_iterator

◆ iterator

using amrex::BoxList::iterator = Vector<Box>::iterator

Constructor & Destructor Documentation

◆ BoxList() [1/10]

amrex::BoxList::BoxList ( )

Construct an empty BoxList with IndexType::TheCellType().

◆ BoxList() [2/10]

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

Make a boxList consisting of a single Box.

◆ BoxList() [3/10]

amrex::BoxList::BoxList ( IndexType  _btype)
explicit

Construct an empty BoxList with IndexType _btype.

◆ BoxList() [4/10]

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

Construct a BoxList from a BoxArray.

◆ BoxList() [5/10]

amrex::BoxList::BoxList ( Vector< Box > &&  bxs)
explicit

Construct a boxlist from a rvalue Vector<Box>.

◆ BoxList() [6/10]

amrex::BoxList::BoxList ( const Box bx,
const IntVect tilesize 
)

Make a boxList consisting of non-overlapping tile box from a single Box.

◆ BoxList() [7/10]

amrex::BoxList::BoxList ( const Box bx,
int  nboxes 
)

Make a BoxList consisting of nboxes Boxes from a single Box.

◆ BoxList() [8/10]

amrex::BoxList::BoxList ( const Box bx,
int  nboxes,
Direction  dir 
)

Make a BoxList consisting of nboxes Boxes chopped in dir-direction from a single Box.

◆ ~BoxList()

amrex::BoxList::~BoxList ( )
default

◆ BoxList() [9/10]

amrex::BoxList::BoxList ( const BoxList rhs)
default

◆ BoxList() [10/10]

amrex::BoxList::BoxList ( BoxList &&  rhs)
default

Member Function Documentation

◆ accrete() [1/2]

BoxList & amrex::BoxList::accrete ( const IntVect sz)

Grow each Box in the BoxList by sz cells (per direction).

Parameters
szDirection-wise growth vector.

◆ accrete() [2/2]

BoxList & amrex::BoxList::accrete ( int  sz)

Grow each Box in the BoxList by sz cells in every direction.

Parameters
szCells added on each side in every direction (negative values shrink).

◆ Bcast()

void amrex::BoxList::Bcast ( )

Broadcast this BoxList from the I/O processor to all other processors.

◆ begin() [1/2]

const_iterator amrex::BoxList::begin ( ) const
inlinenoexcept

Return a const iterator to the first Box.

◆ begin() [2/2]

iterator amrex::BoxList::begin ( )
inlinenoexcept

Return an iterator to the first Box.

◆ capacity()

std::size_t amrex::BoxList::capacity ( ) const
inlinenoexcept

Return the current allocated capacity.

◆ catenate()

void amrex::BoxList::catenate ( BoxList blist)

Catenate the BoxList to ourselves. Removes entries from blist.

◆ cbegin()

const_iterator amrex::BoxList::cbegin ( ) const
inlinenoexcept

Return a const iterator to the first Box.

◆ cend()

const_iterator amrex::BoxList::cend ( ) const
inlinenoexcept

Return a const iterator past the last Box.

◆ clear()

void amrex::BoxList::clear ( )

Remove all Boxes from this BoxList.

◆ coarsen() [1/2]

BoxList & amrex::BoxList::coarsen ( const IntVect ratio)

Coarsen each Box in the BoxList by direction-dependent ratios.

Parameters
ratioComponent-wise coarsening factors.

◆ coarsen() [2/2]

BoxList & amrex::BoxList::coarsen ( int  ratio)

Coarsen each Box in the BoxList by a uniform ratio.

Parameters
ratioCoarsening factor applied in every direction.

◆ complementIn() [1/3]

BoxList & amrex::BoxList::complementIn ( const Box b,
BoxList &&  bl 
)

Set this BoxList to the complement of BoxList bl (moved) in Box b.

Parameters
bBounding box that defines the full domain.
blRegion to exclude (consumed by the call).
Returns
Reference to *this.

◆ complementIn() [2/3]

BoxList & amrex::BoxList::complementIn ( const Box b,
const BoxArray ba 
)

Set this BoxList to the complement of BoxArray ba in Box b.

Parameters
bBounding box that defines the full domain.
baRegion to exclude (provided as a BoxArray).
Returns
Reference to *this.

◆ complementIn() [3/3]

BoxList & amrex::BoxList::complementIn ( const Box b,
const BoxList bl 
)

Set this BoxList to the complement of BoxList bl in Box b.

Parameters
bBounding box that defines the full domain.
blRegion to exclude.
Returns
Reference to *this.

◆ contains()

bool amrex::BoxList::contains ( const BoxList bl) const

True if all Boxes in bl are contained in this BoxList.

◆ convert()

BoxList & amrex::BoxList::convert ( IndexType  typ)
noexcept

Applies Box::convert(IndexType) to each Box in the BoxList.

◆ data() [1/2]

const Vector< Box > & amrex::BoxList::data ( ) const
inlinenoexcept

Returns a constant reference to the Vector<Box>.

◆ data() [2/2]

Vector< Box > & amrex::BoxList::data ( )
inlinenoexcept

Returns a reference to the Vector<Box>.

◆ enclosedCells() [1/2]

BoxList & amrex::BoxList::enclosedCells ( )
noexcept

Applies Box::enclosedCells() to each Box in the BoxList.

◆ enclosedCells() [2/2]

BoxList & amrex::BoxList::enclosedCells ( int  dir)
noexcept

Applies Box::enclosedCells(int) to each Box in the BoxList.

◆ end() [1/2]

const_iterator amrex::BoxList::end ( ) const
inlinenoexcept

Return a const iterator past the last Box.

◆ end() [2/2]

iterator amrex::BoxList::end ( )
inlinenoexcept

Return an iterator past the last Box.

◆ front() [1/2]

const Box & amrex::BoxList::front ( ) const
inlinenoexcept

Return a const reference to the first Box in the list.

◆ front() [2/2]

Box & amrex::BoxList::front ( )
inlinenoexcept

Return a reference to the first Box in the list.

◆ intersect() [1/2]

BoxList & amrex::BoxList::intersect ( const Box b)

Modify this BoxList to contain only its intersection with Box b.

◆ intersect() [2/2]

BoxList & amrex::BoxList::intersect ( const BoxList bl)

Modify this BoxList to contain only its intersection with BoxList bl.

◆ isDisjoint()

bool amrex::BoxList::isDisjoint ( ) const

True if the set of intersecting Boxes is empty.

◆ isEmpty()

bool amrex::BoxList::isEmpty ( ) const
inlinenoexcept

Is this BoxList empty?

◆ isNotEmpty()

bool amrex::BoxList::isNotEmpty ( ) const
inlinenoexcept

Is this BoxList not empty?

◆ ixType()

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

Returns the IndexType of Boxes in this BoxList.

◆ join() [1/2]

void amrex::BoxList::join ( const BoxList blist)

Join the BoxList to ourselves.

◆ join() [2/2]

void amrex::BoxList::join ( const Vector< Box > &  barr)

Join the Array of Boxes to ourselves.

◆ maxSize() [1/2]

BoxList & amrex::BoxList::maxSize ( const IntVect chunk)

Forces each Box in the BoxList to have dimth side of length <= chunk[dim].

◆ maxSize() [2/2]

BoxList & amrex::BoxList::maxSize ( int  chunk)

Forces each Box in the BoxList to have sides of length <= chunk.

◆ minimalBox()

Box amrex::BoxList::minimalBox ( ) const

Returns smallest Box that contains all Boxes in this BoxList.

◆ ok()

bool amrex::BoxList::ok ( ) const
noexcept

True if this BoxList is valid; i.e. all the Boxes are valid and they all have the same IndexType. Also returns true if the BoxList is empty.

◆ operator!=()

bool amrex::BoxList::operator!= ( const BoxList rhs) const

Is this BoxList notequal to rhs?

◆ operator=() [1/2]

BoxList & amrex::BoxList::operator= ( BoxList &&  rhs)
default

◆ operator=() [2/2]

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

◆ operator==()

bool amrex::BoxList::operator== ( const BoxList rhs) const

Is this BoxList equal to rhs?

◆ ordered_simplify()

int amrex::BoxList::ordered_simplify ( )

Merge adjacent Boxes assuming the list is already sorted/ordered.

◆ parallelComplementIn() [1/3]

BoxList & amrex::BoxList::parallelComplementIn ( const Box b,
BoxList &&  bl 
)

Parallel version of complementIn using BoxList (moved).

Parameters
bBounding box that defines the full domain.
blRegion to exclude (consumed by the call).
Returns
Reference to *this.

◆ parallelComplementIn() [2/3]

BoxList & amrex::BoxList::parallelComplementIn ( const Box b,
const BoxArray ba 
)

Parallel version of complementIn using BoxArray.

Parameters
bBounding box that defines the full domain.
baRegion to exclude (provided as BoxArray).
Returns
Reference to *this.

◆ parallelComplementIn() [3/3]

BoxList & amrex::BoxList::parallelComplementIn ( const Box b,
const BoxList bl 
)

Parallel version of complementIn using BoxList.

Parameters
bBounding box that defines the full domain.
blRegion to exclude.
Returns
Reference to *this.

◆ push_back()

void amrex::BoxList::push_back ( const Box bn)
inline

Append a Box to this BoxList.

◆ refine() [1/2]

BoxList & amrex::BoxList::refine ( const IntVect ratio)

Refine each Box in the BoxList by direction-dependent ratios.

Parameters
ratioComponent-wise refinement factors.

◆ refine() [2/2]

BoxList & amrex::BoxList::refine ( int  ratio)

Refine each Box in the BoxList by a uniform ratio.

Parameters
ratioRefinement factor applied in every direction.

◆ removeEmpty()

BoxList & amrex::BoxList::removeEmpty ( )

Remove empty Boxes from this BoxList.

◆ reserve()

void amrex::BoxList::reserve ( std::size_t  n)
inline

Reserve storage for at least n Boxes.

◆ set()

void amrex::BoxList::set ( IndexType  ixtyp)
inlinenoexcept

Set the type of the BoxList. It's an error if the BoxList isn't empty.

◆ shift()

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

Apply Box::shift(dir, nzones) to every Box in the list.

Parameters
dirCoordinate direction to shift.
nzonesNumber of cell widths to shift (positive or negative).

◆ shiftHalf() [1/2]

BoxList & amrex::BoxList::shiftHalf ( const IntVect iv)

Apply Box::shiftHalf(const IntVect&) to every Box in the list.

Parameters
ivVector of half-cell shifts per direction.

◆ shiftHalf() [2/2]

BoxList & amrex::BoxList::shiftHalf ( int  dir,
int  num_halfs 
)

Apply Box::shiftHalf(dir, num_halfs) to every Box in the list.

Parameters
dirCoordinate direction to shift.
num_halfsNumber of half-cell shifts.

◆ simplify()

int amrex::BoxList::simplify ( bool  best = false)

Merge adjacent Boxes in this BoxList. Return the number of Boxes merged. If "best" is specified we do a single bruteforce pass over the list checking each Box against all Boxes after it in the list to see if they can be merged. If "best" is not specified we limit how fair afield we look for possible matches. The "best" algorithm is O(N-squared) while the other algorithm is O(N).

◆ size()

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

The number of Boxes in this BoxList.

◆ surroundingNodes() [1/2]

BoxList & amrex::BoxList::surroundingNodes ( )
noexcept

Applies surroundingNodes(Box) to each Box in BoxArray. See the documentation of Box for details.

◆ surroundingNodes() [2/2]

BoxList & amrex::BoxList::surroundingNodes ( int  dir)
noexcept

Applies surroundingNodes(Box,int) to each Box in BoxList. See the documentation of Box for details.

◆ swap()

void amrex::BoxList::swap ( BoxList rhs)
inlinenoexcept

Swap contents with another BoxList.

Friends And Related Symbol Documentation

◆ BoxDomain

friend class BoxDomain
friend

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