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 <source/hierarchy/patches/PatchConfigurationUtilities.h>

List of all members.

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

Classes

struct  NeighborPatchInfo


Detailed Description

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

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.

See also:
hier::PatchLevel

hier::PatchHierarchy


Constructor & Destructor Documentation

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_name String 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.
hierarchy Optional 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.

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

Virtual destructor for utilities objects.


Member Function Documentation

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_num Const 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.

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_num Const 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_num Const 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.

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:
level Optional 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.

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:
level Optional 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.

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_num Const 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_num Optional 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.

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_num Const 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_num Optional 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.

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_num Const 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_num Optional 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.

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:
codim Integer codimension of neighbor boundary. The value should satisfy 0 < codim <= DIM. If not, an array of size zero will be returned.
patch_num Const 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_num Optional 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.

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_num Const 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_num Const 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.

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_num Const 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_num Const 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.

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_num Const 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_num Const 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.

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_num Const 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_num Const 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.

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_num Optional 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.
os Optional output stream. If not given, tbox::plog is used.

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_num Const 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_num Optional 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.
os Optional output stream. If not given, tbox::plog is used.


The documentation for this class was generated from the following files:
Generated on Thu Jun 18 11:28:29 2009 for SAMRAI by  doxygen 1.5.1