Proto  3.2
Public Member Functions | Friends | List of all members
Proto::DisjointBoxLayout Class Reference

Disjoint Box Layout. More...

#include <Proto_DisjointBoxLayout.H>

Public Member Functions

 DisjointBoxLayout ()
 Default Constructor. More...
 
 DisjointBoxLayout (const ProblemDomain &a_problemDomain, const Point &a_boxSize)
 Constructor (Full Domain) More...
 
 DisjointBoxLayout (const ProblemDomain &a_problemDomain, const vector< Point > &a_coarsenedPatches, const Point &a_boxSize)
 Constructor (Partial Domain) More...
 
 DisjointBoxLayout (const ProblemDomain &a_problemDomain, const Box &a_region, const Point &a_boxSize)
 Constructor (Partial Domain - Simple) More...
 
 DisjointBoxLayout (std::shared_ptr< BoxPartition > a_partition, const Point &a_boxSize)
 
void define (std::shared_ptr< BoxPartition > a_partition, const Point &a_boxSize)
 Direct Define. More...
 
 DisjointBoxLayout (const DisjointBoxLayout &a_layout)
 Copy Constructor. More...
 
void define (const ProblemDomain &a_problemDomain, const Point &a_boxSize)
 Define (Full Domain) More...
 
void define (const ProblemDomain &a_problemDomain, const vector< PatchID > &a_patchIDs, const Point &a_boxSize)
 Define (Partial Domain) More...
 
void define (const ProblemDomain &a_problemDomain, const Box &a_region, const Point &a_boxSize)
 Define (Partial Domaini - Simple) More...
 
DisjointBoxLayout sorted () const
 Get Sorted Version of This. More...
 
bool isSorted () const
 
void loadBalance (unsigned int a_startProc, unsigned int a_endProc)
 Load Balance. More...
 
template<typename... Args>
void loadAssign (Args... a_args)
 Load Assign. More...
 
void loadAssign (std::vector< std::pair< int, unsigned int >> &a_assignment)
 Load Assign. More...
 
DisjointBoxLayoutoperator= (const DisjointBoxLayout &a_input)
 Assignment. More...
 
bool operator== (const DisjointBoxLayout &a_input) const
 Equality Operator. More...
 

Friends

template<typename P >
class DataIndex
 
template<typename P >
class DataIterator
 
class NeighborIterator
 
std::ostream & operator<< (std::ostream &os, const DisjointBoxLayout &a_dbl)
 

Access operators.

ProblemDomain m_problemDomain
 
Point m_boxSize
 
std::shared_ptr< BoxPartitionm_partition
 
const std::vector< pair< Point, unsigned int > > boxes () const
 Get All Boxes. More...
 
Box operator[] (const LevelIndex &a_index) const
 Index Access. More...
 
Box box (const LevelIndex &a_index) const
 Box Indexing. More...
 
Point point (const LevelIndex &a_index) const
 Point Indexing. More...
 
int procID (const LevelIndex &a_index) const
 Get Process ID. More...
 
unsigned int offset (int a_proc) const
 Patch Offset. More...
 
unsigned int offset () const
 This Patch Offset. More...
 
LevelIndex index (Point &a_patchPoint) const
 Get Index From Point. More...
 
unsigned int size () const
 Size. More...
 
unsigned int numBoxes () const
 NumBoxes. More...
 
unsigned int localSize () const
 Local Size. More...
 
LevelIndex index (unsigned int a_intIndex) const
 Global Indexing. More...
 
LevelIndex localIndex (unsigned int a_myIndexInt) const
 Local Indexing. More...
 
Point boxSize () const
 Get Box Size. More...
 
ProblemDomain domain () const
 Get Problem Domain. More...
 
ProblemDomain patchDomain () const
 Get Problem Domain in Patch Space. More...
 
std::shared_ptr< BoxPartitionpartition ()
 
LevelIndex find (const Point &a_pt) const
 Find Index. More...
 
bool contains (const Point &a_pt) const
 Find Tile Point. More...
 
bool onDomainBoundary (const Point &a_pt) const
 On Domain Boundary. More...
 
bool isDomainBoundary (const LevelIndex &a_patch, const Point &a_dir) const
 
bool onLevelBoundary (const Point &a_pt) const
 On Level Boundary. More...
 
LevelIterator end () const
 Iterator End. More...
 
LevelIterator begin () const
 Get Iterator. More...
 
bool coarsenable (const Point &a_refRatio) const
 Coarsenable Query. More...
 
bool compatible (const DisjointBoxLayout &a_layout) const
 Compatibility Query. More...
 
bool compatible (const LevelIterator &a_iter) const
 Compatibility Query. More...
 
bool compatible (const LevelIndex &a_iter) const
 Compatibility Query. More...
 
DisjointBoxLayout coarsen (const Point &a_refRatio) const
 Simple Coarsen. More...
 
DisjointBoxLayout coarsen (const Point &a_refRatio, const Point &a_boxSize) const
 Coarsen. More...
 
DisjointBoxLayout refine (const Point &a_refRatio) const
 Refine. More...
 
Box boundingBox () const
 Get Bounding Box. More...
 
void print (std::string a_name="") const
 Print. More...
 
bool radialSymmetry (Point a_origin) const
 Check Radial Symmetry. More...
 
bool mirrorSymmetry (Point a_origin, int a_coord) const
 Check Mirror Symmetry. More...
 

Detailed Description

Disjoint Box Layout.

Layout of disjoint, logically rectangular regions of DIM-dimensional space. This object is a simplified generalization of the DisjointBoxLayout class used in Chombo, now specialized to use fixed box sizes.

Constructor & Destructor Documentation

◆ DisjointBoxLayout() [1/6]

Proto::DisjointBoxLayout::DisjointBoxLayout ( )
inline

Default Constructor.

◆ DisjointBoxLayout() [2/6]

Proto::DisjointBoxLayout::DisjointBoxLayout ( const ProblemDomain a_problemDomain,
const Point a_boxSize 
)
inline

Constructor (Full Domain)

Creates a DisjointBoxLayout by tiling an input ProblemDomain completely with boxes of a predetermined size. If MPI is used, boxes will be distributed over available processors using Morton ordering. If a_problemDomain.coarsenable(a_boxSize) != true this results in an error.

Parameters
a_problemDomainA ProblemDomain
a_boxSizeA set of box sizes

◆ DisjointBoxLayout() [3/6]

Proto::DisjointBoxLayout::DisjointBoxLayout ( const ProblemDomain a_problemDomain,
const vector< Point > &  a_coarsenedPatches,
const Point a_boxSize 
)
inline

Constructor (Partial Domain)

Creates a DisjointBoxLayout by partially tiling an input ProblemDomain with boxes according to a set of Points. Each element of a_coarsenedPatches represents a box in the layout which has been coarsened by boxSize (resulting in a Box with a single element). In parallel applications, a_coarsenedPatches should contain the patches in the layout on ALL ranks, not just locally.

Parameters
a_problemDomainProblemDomain containing the DBL.
a_coarsenedPatchesAn array of points corresponding to patches in the tiled layout
a_boxSizePossibly anisotropic size of each Box in the layout

◆ DisjointBoxLayout() [4/6]

Proto::DisjointBoxLayout::DisjointBoxLayout ( const ProblemDomain a_problemDomain,
const Box a_region,
const Point a_boxSize 
)
inline

Constructor (Partial Domain - Simple)

Creats a DisjointBoxLayout by partially covering an input ProblemDomain with all patches in an input region. The sub-region must also be coarsenable by the box size, and must be a contained within the problem domain. Useful for quick debugging, but not practically useful for most real problems.

Parameters
a_problemDomainProblemDomain containing the DBL.
a_regionSub-region of the domain which will be tiled in the layout.
a_boxSizePossibly anisotropic size of each Box in the layout.

◆ DisjointBoxLayout() [5/6]

Proto::DisjointBoxLayout::DisjointBoxLayout ( std::shared_ptr< BoxPartition a_partition,
const Point a_boxSize 
)
inline

◆ DisjointBoxLayout() [6/6]

Proto::DisjointBoxLayout::DisjointBoxLayout ( const DisjointBoxLayout a_layout)
inline

Copy Constructor.

Copies share pointers to the internal structure hence this is relatively cheap.

Parameters
a_layoutAnother DisjointBoxLayout

Member Function Documentation

◆ define() [1/4]

void Proto::DisjointBoxLayout::define ( std::shared_ptr< BoxPartition a_partition,
const Point a_boxSize 
)
inline

Direct Define.

Creates a DisjointBoxLayout which is linked to an existing BoxPartition object. This constructor is used internally and is not recommended for public use.

◆ define() [2/4]

void Proto::DisjointBoxLayout::define ( const ProblemDomain a_problemDomain,
const Point a_boxSize 
)
inline

Define (Full Domain)

Construct a DisjointBoxLayout lazily or redefine an existing one.

◆ define() [3/4]

void Proto::DisjointBoxLayout::define ( const ProblemDomain a_problemDomain,
const vector< PatchID > &  a_patchIDs,
const Point a_boxSize 
)
inline

Define (Partial Domain)

Construct a DisjointBoxLayout lazily or redefine an existing one.

◆ define() [4/4]

void Proto::DisjointBoxLayout::define ( const ProblemDomain a_problemDomain,
const Box a_region,
const Point a_boxSize 
)
inline

Define (Partial Domaini - Simple)

Construct a DisjointBoxLayout lazily or redefine an existing one.

◆ sorted()

DisjointBoxLayout Proto::DisjointBoxLayout::sorted ( ) const
inline

Get Sorted Version of This.

◆ isSorted()

bool Proto::DisjointBoxLayout::isSorted ( ) const
inline

References loadBalance(), and m_partition.

◆ loadBalance()

void Proto::DisjointBoxLayout::loadBalance ( unsigned int  a_startProc,
unsigned int  a_endProc 
)
inline

Load Balance.

Distribute the load of this layout over the range of processors whose indices span [a_startProc, a_endProc-1].

Referenced by isSorted().

◆ loadAssign() [1/2]

template<typename... Args>
void Proto::DisjointBoxLayout::loadAssign ( Args...  a_args)
inline

Load Assign.

Manually assign the load of this layout using the syntax loadAssign(P0, N0, P1, N1, ..., Pk, Nk) where process Pi is assigned Ni boxes. The sum over all Ni should be equal to the size of this layout.

◆ loadAssign() [2/2]

void Proto::DisjointBoxLayout::loadAssign ( std::vector< std::pair< int, unsigned int >> &  a_assignment)
inline

Load Assign.

Manually assign the load of this layout. The input is a vector of pair<int, unsigned int> where the first entry of each pair is a process and the second is the number of boxes to be assigned to that process.

◆ operator=()

DisjointBoxLayout & Proto::DisjointBoxLayout::operator= ( const DisjointBoxLayout a_input)
inline

Assignment.

Copies share pointers to the same internal structure

◆ operator==()

bool Proto::DisjointBoxLayout::operator== ( const DisjointBoxLayout a_input) const
inline

Equality Operator.

◆ boxes()

const std::vector< std::pair< Point, unsigned int > > Proto::DisjointBoxLayout::boxes ( ) const
inline

Get All Boxes.

Get a copy of the patches in the layout. The output is a vector of pair<Point, int> where for each element item, item.first contains a Point corresponding to the Box Box(item.first, item.first).refine(boxSize()). item.second contains the integer rank of the process which handles the patch.

Note that this function returns data for all patches on all parallel processes.

◆ operator[]()

Box Proto::DisjointBoxLayout::operator[] ( const LevelIndex a_index) const
inline

Index Access.

Return the Box associated with a DataIndex. Fails if the index is not compatible with *this.

Parameters
a_indexA DataIndex

◆ box()

Box Proto::DisjointBoxLayout::box ( const LevelIndex a_index) const
inline

Box Indexing.

Return the Box associated with a DataIndex. Identical to operator[] Fails if the index is not compatible with *this.

Parameters
a_indexA DataIndex

◆ point()

Point Proto::DisjointBoxLayout::point ( const LevelIndex a_index) const
inline

Point Indexing.

Return the Point version of the Box associated with a DataIndex. Fails if the index is not compatible with *this.

Parameters
a_indexA DataIndex

◆ procID()

int Proto::DisjointBoxLayout::procID ( const LevelIndex a_index) const
inline

Get Process ID.

Get the process ID associated with a DataIndex. Fails if the index is not compatible with *this.

Parameters
a_indexA DataIndex

Referenced by Proto::NeighborIterator::procID().

◆ offset() [1/2]

unsigned int Proto::DisjointBoxLayout::offset ( int  a_proc) const
inline

Patch Offset.

Returns the linear offset (in number of boxes) of the first patch on proc a_proc. Used for serialization.

Parameters
a_procAn MPI rank

◆ offset() [2/2]

unsigned int Proto::DisjointBoxLayout::offset ( ) const
inline

This Patch Offset.

Returns the linear offset (in number of boxes) of the first patch on this proc. Used for linearization.

References offset(), and Proto::procID().

Referenced by offset().

◆ index() [1/2]

LevelIndex Proto::DisjointBoxLayout::index ( Point a_patchPoint) const
inline

Get Index From Point.

Find the DataIndex associated with an input patch point. This function is the inverse of DisjointBoxLayout::point(DataIndex).

Input Points must be in this->patchDomain() or be a valid periodic image thereof, otherwise this function will fail by assertion.

Parameters
a_patchPointA point representing a patch in the layout or a periodic image

◆ size()

unsigned int Proto::DisjointBoxLayout::size ( ) const
inline

Size.

Return the number of Boxes contained in *this including those on other processors. Deprecated: Use numBoxes() instead for improved in situe documentation.

◆ numBoxes()

unsigned int Proto::DisjointBoxLayout::numBoxes ( ) const
inline

NumBoxes.

Returns the number of Boxes contained in *this including those on other processors. This function is identical to the deprecated function size()

◆ localSize()

unsigned int Proto::DisjointBoxLayout::localSize ( ) const
inline

Local Size.

Return the number of Boxes on this processor.

◆ index() [2/2]

LevelIndex Proto::DisjointBoxLayout::index ( unsigned int  a_intIndex) const
inline

Global Indexing.

Get the DataIndex associated with a global integer index. Inputs are integers in [0, this->size())

Parameters
a_intIndexA valid integer index

◆ localIndex()

LevelIndex Proto::DisjointBoxLayout::localIndex ( unsigned int  a_myIndexInt) const
inline

Local Indexing.

Get the DataIndex associated with a local integer index. Inputs are integers in [0, this->localSize())

Parameters
a_intIndexA valid integer index

◆ boxSize()

Point Proto::DisjointBoxLayout::boxSize ( ) const
inline

Get Box Size.

Return the constant size of all boxes in the layout.

References m_boxSize.

Referenced by patchDomain().

◆ domain()

ProblemDomain Proto::DisjointBoxLayout::domain ( ) const
inline

Get Problem Domain.

References m_problemDomain.

Referenced by Proto::MBDisjointBoxLayout::blockDomainBox(), and patchDomain().

◆ patchDomain()

ProblemDomain Proto::DisjointBoxLayout::patchDomain ( ) const
inline

Get Problem Domain in Patch Space.

Returns the problem domain box in patch-space.

References boxSize(), Proto::ProblemDomain::coarsen(), and domain().

◆ partition()

std::shared_ptr<BoxPartition> Proto::DisjointBoxLayout::partition ( )
inline

References m_partition.

◆ find()

LevelIndex Proto::DisjointBoxLayout::find ( const Point a_pt) const
inline

Find Index.

Given a patch Point, return the DataIndex of the associated Box if it is in the layout including periodic images. If the Point does not represent a patch in this layout, this function returns this->end()

Parameters
a_ptA patch Point.

◆ contains()

bool Proto::DisjointBoxLayout::contains ( const Point a_pt) const
inline

Find Tile Point.

Returns true if the tile a_pt (or a periodic image thereof) is contained in the layout

◆ onDomainBoundary()

bool Proto::DisjointBoxLayout::onDomainBoundary ( const Point a_pt) const
inline

On Domain Boundary.

Returns true if a_pt corresponds to a patch that is adjacent to a non-periodic domain boundary. If a_pt does not represent a valid patch in this layout, this function fails by assertion.

Parameters
a_ptA valid patch Point.

◆ isDomainBoundary()

bool Proto::DisjointBoxLayout::isDomainBoundary ( const LevelIndex a_patch,
const Point a_dir 
) const
inline

◆ onLevelBoundary()

bool Proto::DisjointBoxLayout::onLevelBoundary ( const Point a_pt) const
inline

On Level Boundary.

Returns true if a_pt corresponds to a patch that is adjacent to a non-periodic layout boundary (including domain boundaries). In other words, this function returns false if and only if a_pt represents a patch that is completely surrounded by other patches in the layout. If a_pt does not represent a valid patch in this layout, this function fails by assertion.

Parameters
a_ptA valid patch Point.

◆ end()

LevelIterator Proto::DisjointBoxLayout::end ( ) const
inline

Iterator End.

◆ begin()

LevelIterator Proto::DisjointBoxLayout::begin ( ) const
inline

Get Iterator.

◆ coarsenable()

bool Proto::DisjointBoxLayout::coarsenable ( const Point a_refRatio) const
inline

Coarsenable Query.

Checks if the layout is coarsenable by a (possibly anisotropic) refinement ratio. This property requires the ProblemDomain to be coarsenable as well as boxSize() % a_refRatio == (0,0,....)

Parameters
a_refRatioRefinement ratios

◆ compatible() [1/3]

bool Proto::DisjointBoxLayout::compatible ( const DisjointBoxLayout a_layout) const
inline

Compatibility Query.

Checks if *this and another layout have the same patch configuration. This is to say, both layouts have boxes in the same tile positions and on the same processors, but the boxes themselves may be different sizes. If true, objects built from these layouts can be processed together in the same DataIterator loop.

Parameters
a_layoutA DisjointBoxLayout

◆ compatible() [2/3]

bool Proto::DisjointBoxLayout::compatible ( const LevelIterator a_iter) const
inline

Compatibility Query.

Checks if this layout can be iterated through using a DataIterator instance.

Parameters
a_layoutA DataIterator

◆ compatible() [3/3]

bool Proto::DisjointBoxLayout::compatible ( const LevelIndex a_iter) const
inline

Compatibility Query.

Checks if a DataIndex is associated with a compatible DataIterator.

Parameters
a_layoutA DataIterator

◆ coarsen() [1/2]

DisjointBoxLayout Proto::DisjointBoxLayout::coarsen ( const Point a_refRatio) const
inline

Simple Coarsen.

Coarsens the layout by an input (possibly anisotropic) refinement ratio. coarsenable(a_refRatio) must be true or this function will result in an error. The output of this function will always have the same size as the input and will always be compatible in the DataIterator sense.

The coarsened layout has: crseLayout.domain().box() == fineLayout.problemDomain.box().coarsen(refRatio) crseLayout[ii] == fineLayout[ii].coarsen(refRatio) for each ii in [0, size())

Parameters
a_refRatioA refinement ratio

◆ coarsen() [2/2]

DisjointBoxLayout Proto::DisjointBoxLayout::coarsen ( const Point a_refRatio,
const Point a_boxSize 
) const
inline

Coarsen.

Creates a new DisjointBoxLayout with a specified box size that has been coarsened by a valid ratio. coarsenable(refRatio) must be true or this function will result in an error. The output of this function will in general have a different size than the input and is not guaranteed to be compatible in the DataIterator sense.

Parameters
a_refRatioA refinement ratio
a_boxSizeSize of the output layout's boxes

◆ refine()

DisjointBoxLayout Proto::DisjointBoxLayout::refine ( const Point a_refRatio) const
inline

Refine.

Refines the layout by an input (possibly anisotropic) refinement ratio. Unline coarsen(...), this function should always be possible. The output of this function will always have the same size as the input and will always be compatible in the DataIterator sense.

The refined layout has: fineLayout.domain().box() == crseLayout.problemDomain.box().refine(refRatio) fineLayout[ii] == crseLayout[ii].refine(refRatio) for each ii in [0, size())

Parameters
a_refRatioA refinement ratio

◆ boundingBox()

Box Proto::DisjointBoxLayout::boundingBox ( ) const
inline

Get Bounding Box.

Returns the smallest Box containing all of the boxes in the layout. Output is guaranteed to be coarsenable by boxSize().

◆ radialSymmetry()

bool Proto::DisjointBoxLayout::radialSymmetry ( Point  a_origin) const
inlineprivate

Check Radial Symmetry.

For debugging mesh refinement procedures

◆ mirrorSymmetry()

bool Proto::DisjointBoxLayout::mirrorSymmetry ( Point  a_origin,
int  a_coord 
) const
inlineprivate

Check Mirror Symmetry.

For debugging mesh refinement procedures

◆ print()

void Proto::DisjointBoxLayout::print ( std::string  a_name = "") const
inline

Print.

Friends And Related Function Documentation

◆ DataIndex

template<typename P >
friend class DataIndex
friend

◆ DataIterator

template<typename P >
friend class DataIterator
friend

◆ NeighborIterator

friend class NeighborIterator
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const DisjointBoxLayout a_dbl 
)
friend

Member Data Documentation

◆ m_problemDomain

ProblemDomain Proto::DisjointBoxLayout::m_problemDomain
private

Referenced by domain().

◆ m_boxSize

Point Proto::DisjointBoxLayout::m_boxSize
private

Referenced by boxSize().

◆ m_partition

std::shared_ptr<BoxPartition> Proto::DisjointBoxLayout::m_partition
private

Referenced by isSorted(), and partition().


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