IBAMR  IBAMR version 0.19.
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SAMRAI::hier::PatchConfigurationUtilities< DIM > Class Template Reference

Class PatchConfigurationUtilities contains routines that provide information about spatial relationships among patches on an AMR patch hierarchy. Such information is useful for building operations on patch data that must account for these relationships.
Examples include knowing which patches are neighbors of a given patch on the same patch level and the positions of those neighbors with respect to the patch, and knowing which patches on a finer patch level overlap a given patch, etc. More...

#include <PatchConfigurationUtilities.h>

Classes

struct  NeighborPatchInfo
 
struct  PatchInfo
 
struct  PatchLevelInfo
 

Public Member Functions

 PatchConfigurationUtilities (const std::string &object_name, tbox::Pointer< PatchHierarchy< DIM > > hierarchy=0)
 
virtual ~PatchConfigurationUtilities ()
 
bool levelIsSet (const LevelNumber &level_num) const
 
bool patchIsSet (const PatchNumber &patch_num, const LevelNumber &level_num) const
 
void initialize (tbox::Pointer< PatchLevel< DIM > > level=0)
 
void clear (tbox::Pointer< PatchLevel< DIM > > level=0)
 
const tbox::Array< typename PatchConfigurationUtilities< DIM >::NeighborPatchInfo > & getNodeNeighborInfo (const PatchNumber &patch_num, const LevelNumber &level_num=LevelNumber(-1)) const
 
const tbox::Array< typename PatchConfigurationUtilities< DIM >::NeighborPatchInfo > & getEdgeNeighborInfo (const PatchNumber &patch_num, const LevelNumber &level_num=LevelNumber(-1)) const
 
const tbox::Array< typename PatchConfigurationUtilities< DIM >::NeighborPatchInfo > & getFaceNeighborInfo (const PatchNumber &patch_num, const LevelNumber &level_num=LevelNumber(-1)) const
 
const tbox::Array< typename PatchConfigurationUtilities< DIM >::NeighborPatchInfo > & getCodimensionNeighborPatchInfo (int codim, const PatchNumber &patch_num, const LevelNumber &level_num=LevelNumber(-1)) const
 
const tbox::Array< int > & getFinerLevelOverlapPatchIndices (const PatchNumber &patch_num, const LevelNumber &level_num) const
 
const Box< DIM > & getCoarsenedFinerLevelPatchBox (const PatchNumber &finer_level_patch_num, const LevelNumber &level_num) const
 
const tbox::Array< int > & getCoarserLevelOverlapPatchIndices (const PatchNumber &patch_num, const LevelNumber &level_num) const
 
const Box< DIM > & getRefinedCoarserLevelPatchBox (const PatchNumber &coarser_level_patch_num, const LevelNumber &level_num) const
 
void printPatchLevelData (const LevelNumber &level_num=LevelNumber(-1), std::ostream &os=tbox::plog) const
 
void printPatchData (const PatchNumber &patch_num, const LevelNumber &level_num=LevelNumber(-1), std::ostream &os=tbox::plog) const
 

Private Member Functions

 PatchConfigurationUtilities ()
 
 PatchConfigurationUtilities (const PatchConfigurationUtilities< DIM > &)
 
void operator= (const PatchConfigurationUtilities< DIM > &)
 
void setPatchLevelInfo (tbox::Pointer< PatchLevel< DIM > > level, int array_slot=-1)
 
void setNeighborPatchInfo (int array_slot)
 
void setFinerPatchLevelInfo (int array_slot)
 
void setCoarserPatchLevelInfo (int array_slot)
 
void clearPatchLevelInfo (int array_slot)
 
void findPatchNeighbors (PatchInfo &patch_info, tbox::Pointer< Patch< DIM > > patch, tbox::Pointer< PatchLevel< DIM > > level, const tbox::Array< int > &neighbor_patch_ids, tbox::Array< bool > &done_with_neighbor, int codim)
 
bool levelMatch (tbox::Pointer< PatchLevel< DIM > > level, int array_slot=-1)
 
void allocatePatchLevelInfoArray (int nlevels)
 
void printPatchLevelInfo (std::ostream &os, int ln) const
 

Private Attributes

std::string d_object_name
 
tbox::Array< typename PatchConfigurationUtilities< DIM >::PatchLevelInfod_patch_level_info
 
tbox::Pointer< PatchHierarchy< DIM > > d_patch_hierarchy
 
tbox::Array< intd_empty_array
 
Box< DIM > d_empty_box
 

Detailed Description

template<int DIM>
class SAMRAI::hier::PatchConfigurationUtilities< DIM >

See also
hier::PatchLevel
hier::PatchHierarchy

Constructor & Destructor Documentation

◆ PatchConfigurationUtilities() [1/3]

template<int DIM>
SAMRAI::hier::PatchConfigurationUtilities< DIM >::PatchConfigurationUtilities ( const std::string &  object_name,
tbox::Pointer< PatchHierarchy< DIM > >  hierarchy = 0 
)

The constructor for PatchConfigurationUtilities initializes the utilities object to manage data operations for the given patch hierarchy.

Note that the constructed utilities object cannot do anything useful until hierarchy patch level information is initialized via the initialize() or reset() methods.

Parameters
object_nameString name identifier for utilities object. Cannot be empty when assertion checking is turned on. Should be unique among names used for other utilities objects for proper error checking and restart functionality.
hierarchyOptional pointer to patch hierarchy containing patch levels for which requests for patch information will be made.
If null (default), then this object can only be used to obtain information about relationships between patches on a single level, which is set in the call to initialize() or reset.

◆ ~PatchConfigurationUtilities()

template<int DIM>
virtual SAMRAI::hier::PatchConfigurationUtilities< DIM >::~PatchConfigurationUtilities ( )
virtual

Virtual destructor for utilities objects.

◆ PatchConfigurationUtilities() [2/3]

◆ PatchConfigurationUtilities() [3/3]

Member Function Documentation

◆ levelIsSet()

template<int DIM>
bool SAMRAI::hier::PatchConfigurationUtilities< DIM >::levelIsSet ( const LevelNumber level_num) const

Check whether information is set for given level number.

Returns
Boolean true if level is set; false otherwise.
Parameters
level_numConst reference to hier::LevelNumber type indicating level number of interest. When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy.

◆ patchIsSet()

template<int DIM>
bool SAMRAI::hier::PatchConfigurationUtilities< DIM >::patchIsSet ( const PatchNumber patch_num,
const LevelNumber level_num 
) const

Check whether information is set for given patch and level number.

Note that this routine will always return false if the patch is not mapped to this processor.

Returns
Boolean true if patch is is set; false otherwise.
Parameters
patch_numConst reference to hier::PatchNumber type indicating patch number of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numConst reference to hier::LevelNumber type indicating level number of interest. When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy.

◆ initialize()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::initialize ( tbox::Pointer< PatchLevel< DIM > >  level = 0)

Initialize utilities object so that it can service requests for patch information for the given patch level or for all patch levels in the hierarchy.

If this method is called more than once, then patch information is built only for patch levels for which information has not been built already. In particular, if the method is called with the same patch level more than once, each call after the first is essentially a no-op.

This method cannot be used to replace patch info associated with a given patch level number with that for a new level with the same level number.
For that to occur, the clear() method must be called first.

For consistency and to prevent unexpected behavior, this routine issues warnings and will not perform operations in certain situations. These situations include: the given patch level is not in the patch hierarchy passed to the constructor when this object was created, and the given patch level does not match the level with the same level number used to build patch information in the most recent call to this initialization routine. Either of these situations indicates potentially erroneous usage such as mixing levels from different patch hierarchied in a single utilities object.

Parameters
levelOptional pointer to patch level. If a non-null level pointer is supplied, patch information is built only for the level. Otherwise, information is built for all hierarchy levels for which it has not been built already.

◆ clear()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::clear ( tbox::Pointer< PatchLevel< DIM > >  level = 0)

Clear patch information for the given patch level or for all patch levels in the hierarchy.

For consistency and to prevent unexpected behavior, this routine issues warnings and will not perform operations in certain situations. These situations include: the given patch level is not in the patch hierarchy passed to the constructor when this object was created, and the given patch level does not match the level with the same level number used to build patch information in the most recent call to the initialization routine. Either of these situations indicates potentially erroneous usage such as mixing levels from different patch hierarchied in a single utilities object.

If no patch level argument is supplied. this method returns state of object to default state at construction. In particular, only the object name and hierarchy (if passed to constructor originally) remain intact.

Parameters
levelOptional pointer to patch level. If a non-null level pointer is supplied, patch information is cleared only for the level. Otherwise, information is cleared for all hierarchy levels.

◆ getNodeNeighborInfo()

template<int DIM>
const tbox::Array< typename PatchConfigurationUtilities<DIM>::NeighborPatchInfo >& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getNodeNeighborInfo ( const PatchNumber patch_num,
const LevelNumber level_num = LevelNumber(-1) 
) const

Get an array of NeighborPatchInfo structs describing the patches on the same patch level that are node neighbors of the given patch.
A node neighbor intersects the patch at a single corner point.

Returns
Const reference to array of NeighborPatchInfo for node neighbors. If the patch has no node neighbors, the array will have size zero.
Parameters
patch_numConst reference to hier::PatchNumber type indicating patch number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numOptional const reference to hier::LevelNumber type indicating level number of patch of interest. The level number must be given when this object is used to manage information for a patch hierarchy (as opposed to a single level). When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy. If no patch hierarchy was passed to the constructor when this object was created, then the level number is ignored.

◆ getEdgeNeighborInfo()

template<int DIM>
const tbox::Array< typename PatchConfigurationUtilities<DIM>::NeighborPatchInfo >& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getEdgeNeighborInfo ( const PatchNumber patch_num,
const LevelNumber level_num = LevelNumber(-1) 
) const

Get an array of NeighborPatchInfo structs describing the patches on the same patch level that are edge neighbors of the given patch. An edge neighbor intersects the patch along a 1-dimensional edge.

Returns
Const reference to array of NeighborPatchInfo for node neighbors. If the patch has no edge neighbors, or when DIM < 2, this routine returns an array of size zero.
Parameters
patch_numConst reference to hier::PatchNumber type indicating patch number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numOptional const reference to hier::LevelNumber type indicating level number of patch of interest. The level number must be given when this object is used to manage information for a patch hierarchy (as opposed to a single level). When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy. If no patch hierarchy was passed to the constructor when this object was created, then the level number is ignored.

◆ getFaceNeighborInfo()

template<int DIM>
const tbox::Array< typename PatchConfigurationUtilities<DIM>::NeighborPatchInfo >& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getFaceNeighborInfo ( const PatchNumber patch_num,
const LevelNumber level_num = LevelNumber(-1) 
) const

Get an array of NeighborPatchInfo structs describing the patches on the same patch level that are face neighbors of the given patch. A face neighbor intersects the patch along a 2-dimensional face.

Returns
Const reference to array of NeighborPatchInfo for node neighbors. If the patch has no face neighbors, or when DIM < 3, this routine returns an array of size zero.
Parameters
patch_numConst reference to hier::PatchNumber type indicating patch number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numOptional const reference to hier::LevelNumber type indicating level number of patch of interest. The level number must be given when this object is used to manage information for a patch hierarchy (as opposed to a single level). When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy. If no patch hierarchy was passed to the constructor when this object was created, then the level number is ignored.

◆ getCodimensionNeighborPatchInfo()

template<int DIM>
const tbox::Array< typename PatchConfigurationUtilities<DIM>::NeighborPatchInfo >& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getCodimensionNeighborPatchInfo ( int  codim,
const PatchNumber patch_num,
const LevelNumber level_num = LevelNumber(-1) 
) const

Get an array of NeighborPatchInfo structs describing the patches on the same patch level that are neighbors along an (DIM - codim)-dimensional region of the given patch.

For spatial dimensions less than 4, this routine operates similarly to the functions above. Specifically,

if DIM == 1: (codim == 1) => same components as getNodeBoundary.

if DIM == 2, (codim == 1) => same components as getEdgeBoundary. (codim == 2) => same components as getNodeBoundary.

if DIM == 3, (codim == 1) => same components as getFaceBoundary. (codim == 2) => same components as getEdgeBoundary. (codim == 3) => same components as getNodeBoundary.

Returns
Const reference to array of NeighborPatchInfo for node neighbors. If the patch has no neighbors corresponding to the codimension, or when codim <= 0 or codim > DIM, the array will have size zero.
Parameters
codimInteger codimension of neighbor boundary. The value should satisfy 0 < codim <= DIM. If not, an array of size zero will be returned.
patch_numConst reference to hier::PatchNumber type indicating patch number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numOptional const reference to hier::LevelNumber type indicating level number of patch of interest. The level number must be given when this object is used to manage information for a patch hierarchy (as opposed to a single level). When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy. If no patch hierarchy was passed to the constructor when this object was created, then the level number is ignored.

◆ getFinerLevelOverlapPatchIndices()

template<int DIM>
const tbox::Array<int>& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getFinerLevelOverlapPatchIndices ( const PatchNumber patch_num,
const LevelNumber level_num 
) const

Get array of integer patch numbers of patches on the next finer hierarchy level that overlap the specified patch.

Returns
Const reference to int array of patch numbers of finer level patches that overlap given patch. When the level number corresponds to the finest hierarchy level, or when a null patch hierarchy pointer was passed to the constructor, the array will be size zero.
Parameters
patch_numConst reference to hier::PatchNumber type indicating patch number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numConst reference to hier::LevelNumber type indicating level number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a level in patch hierarchy if a non-null patch hierarchy pointer was passed to the constructor.

◆ getCoarsenedFinerLevelPatchBox()

template<int DIM>
const Box<DIM>& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getCoarsenedFinerLevelPatchBox ( const PatchNumber finer_level_patch_num,
const LevelNumber level_num 
) const

Get box representing the coarsening of a patch box on the next finer hierarchy level to the index space of the specified level.

Returns
Const reference to finer level patch box coarsened to index space of specified next coarser level. When the level number corresponds to the finest hierarchy level, or when a null patch hierarchy pointer was passed to the constructor, the box will be empty.
Parameters
finer_level_patch_numConst reference to hier::PatchNumber type indicating patch number of patch on next finer level. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numConst reference to hier::LevelNumber type indicating level number of interest. When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy.

◆ getCoarserLevelOverlapPatchIndices()

template<int DIM>
const tbox::Array<int>& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getCoarserLevelOverlapPatchIndices ( const PatchNumber patch_num,
const LevelNumber level_num 
) const

Get array of integer patch numbers of patches on the next coarser hierarchy level that overlap the specified patch.

Returns
Const reference to int array of patch numbers of coarser level patches that overlap given patch. When the level number corresponds to the coarsest hierarchy level, or when a null patch hierarchy pointer was passed to the constructor, the array will be size zero.
Parameters
patch_numConst reference to hier::PatchNumber type indicating patch number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numConst reference to hier::LevelNumber type indicating level number of patch of interest. When assertion checking is active, an assertion is thrown if number does not correspond to a level in patch hierarchy if a non-null patch hierarchy pointer was passed to the constructor.

◆ getRefinedCoarserLevelPatchBox()

template<int DIM>
const Box<DIM>& SAMRAI::hier::PatchConfigurationUtilities< DIM >::getRefinedCoarserLevelPatchBox ( const PatchNumber coarser_level_patch_num,
const LevelNumber level_num 
) const

Get box representing the refinement of a patch box on the next coarser hierarchy level to the index space of the specified level.

Returns
Const reference to coarser level patch box refined to index space of specified next finer level. When the level number corresponds to the coarsest hierarchy level (i.e., level 0), or when a null patch hierarchy pointer was passed to the constructor, the box will be empty.
Parameters
coarser_level_patch_numConst reference to hier::PatchNumber type indicating patch number of patch on next coarser level. When assertion checking is active, an assertion is thrown if number does not correspond to a patch on the patch level.
level_numConst reference to hier::LevelNumber type indicating level number of interest. When assertion checking is active, an assertion is thrown if number does not correspond to level in patch hierarchy.

◆ printPatchLevelData()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::printPatchLevelData ( const LevelNumber level_num = LevelNumber(-1),
std::ostream &  os = tbox::plog 
) const

Print internal data structures for patch level to given output stream.

Parameters
level_numOptional const reference to hier::LevelNumber type indicating number of patch level of interest. If not given and this utilities object is set up for a patch hierarchy, data for all patch levels is output.
If a valid level number is given and this utilities object is set up for a patch hierarchy, only data for the specified level is output. If the value is not a valid hierarchy level number, the routine does nothing.
In the case that this utilities object is set up for a single patch level, the value is ignored and data for the level is output.
osOptional output stream. If not given, tbox::plog is used.

◆ printPatchData()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::printPatchData ( const PatchNumber patch_num,
const LevelNumber level_num = LevelNumber(-1),
std::ostream &  os = tbox::plog 
) const

Print internal data structures for patch to given output stream.

Parameters
patch_numConst reference to hier::PatchNumber type indicating number of patch of interest. When assertion checking is active, an assertion results when this value is not a valid patch number for the level of interest.
level_numOptional const reference to hier::LevelNumber type indicating number of patch level of interest. When this utilities object is set up for a single patch level, the value is ignored and level passed in to the constructor of this object is assumed. If this object is set up for a patch hierarchy, this value must be given and must be a valid level number for the patch hierarchy. If not, an assertion results, when assertion checking is active.
osOptional output stream. If not given, tbox::plog is used.

◆ operator=()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::operator= ( const PatchConfigurationUtilities< DIM > &  )
private

◆ setPatchLevelInfo()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::setPatchLevelInfo ( tbox::Pointer< PatchLevel< DIM > >  level,
int  array_slot = -1 
)
private

◆ setNeighborPatchInfo()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::setNeighborPatchInfo ( int  array_slot)
private

◆ setFinerPatchLevelInfo()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::setFinerPatchLevelInfo ( int  array_slot)
private

◆ setCoarserPatchLevelInfo()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::setCoarserPatchLevelInfo ( int  array_slot)
private

◆ clearPatchLevelInfo()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::clearPatchLevelInfo ( int  array_slot)
private

◆ findPatchNeighbors()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::findPatchNeighbors ( PatchInfo patch_info,
tbox::Pointer< Patch< DIM > >  patch,
tbox::Pointer< PatchLevel< DIM > >  level,
const tbox::Array< int > &  neighbor_patch_ids,
tbox::Array< bool > &  done_with_neighbor,
int  codim 
)
private

◆ levelMatch()

template<int DIM>
bool SAMRAI::hier::PatchConfigurationUtilities< DIM >::levelMatch ( tbox::Pointer< PatchLevel< DIM > >  level,
int  array_slot = -1 
)
private

◆ allocatePatchLevelInfoArray()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::allocatePatchLevelInfoArray ( int  nlevels)
private

◆ printPatchLevelInfo()

template<int DIM>
void SAMRAI::hier::PatchConfigurationUtilities< DIM >::printPatchLevelInfo ( std::ostream &  os,
int  ln 
) const
private

Member Data Documentation

◆ d_object_name

template<int DIM>
std::string SAMRAI::hier::PatchConfigurationUtilities< DIM >::d_object_name
private

◆ d_patch_level_info

template<int DIM>
tbox::Array< typename PatchConfigurationUtilities<DIM>::PatchLevelInfo > SAMRAI::hier::PatchConfigurationUtilities< DIM >::d_patch_level_info
private

◆ d_patch_hierarchy

template<int DIM>
tbox::Pointer< PatchHierarchy<DIM> > SAMRAI::hier::PatchConfigurationUtilities< DIM >::d_patch_hierarchy
private

◆ d_empty_array

template<int DIM>
tbox::Array<int> SAMRAI::hier::PatchConfigurationUtilities< DIM >::d_empty_array
private

◆ d_empty_box

template<int DIM>
Box<DIM> SAMRAI::hier::PatchConfigurationUtilities< DIM >::d_empty_box
private

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