#include <source/hierarchy/variables/PatchDescriptor.h>
Public Member Functions | |
PatchDescriptor () | |
virtual | ~PatchDescriptor () |
int | definePatchDataComponent (const std::string &name, tbox::Pointer< PatchDataFactory< DIM > > factory) |
void | removePatchDataComponent (int id) |
tbox::Pointer< PatchDataFactory< DIM > > | getPatchDataFactory (int id) const |
tbox::Pointer< PatchDataFactory< DIM > > | getPatchDataFactory (const std::string &name) const |
int | getMaxNumberRegisteredComponents () const |
int | mapNameToIndex (const std::string &name) const |
const std::string & | mapIndexToName (const int id) const |
IntVector< DIM > | getMaxGhostWidth () const |
virtual void | printClassData (std::ostream &stream=tbox::plog) const |
Patch data factory objects (and associated names) are explicitly added to the PatchDescriptor using the definePatchDataComponent() member function. This function returns an integer index that can be used to identify the corresponding patch data on a a patch. Factories can be removed from the PatchDescriptor using the removePatchDataComponent() member function, which returns the integer index associated with the removed factory to a "free list" so that it can be used again. At any time, the valid range of indices is >= 0 and < getMaxNumberRegisteredComponents().
Note that the SAMRAIManager utility establishes a maximum number of patch data object that may live on a Patch object which, for consistency, must be the same as the number of patch data factories a PatchDescriptor will hold. See the documentation of the SAMRAIManager utility for information about changing this maximum value.
hier::PatchDataData
SAMRAI::hier::PatchDescriptor< DIM >::PatchDescriptor | ( | ) |
The default constructor for a patch descriptor initializes the descriptor to hold zero patch data factory entries.
SAMRAI::hier::PatchDescriptor< DIM >::~PatchDescriptor | ( | ) | [virtual] |
The virtual destructor for a patch descriptor deallocates the internal data structures.
int SAMRAI::hier::PatchDescriptor< DIM >::definePatchDataComponent | ( | const std::string & | name, | |
tbox::Pointer< PatchDataFactory< DIM > > | factory | |||
) |
Add a new patch data factory and name string identifier to the patch descriptor. The factory will be given the specified name which must be unique for the mapNameToIndex() function to execute as expected. However, there is no internal checking done to ensure that names are unique.
name | string name to be associated in name list with given factory, which must be non-empty when assertion checking is active. | |
factory | pointer to factory to add to patch descriptor, which must be non-null when assertion checking is active. |
void SAMRAI::hier::PatchDescriptor< DIM >::removePatchDataComponent | ( | int | id | ) |
Deallocate the patch data factory in the patch descriptor identified by the given index. The index may be assigned to another factory in the future. However, index will be invalid as a patch data index until it is re-allocated by the definePatchDataComponent() member function. An invalid id value passed to this function is silently ignored.
id | int index of factory to remove from patch descriptor. |
tbox::Pointer< PatchDataFactory< DIM > > SAMRAI::hier::PatchDescriptor< DIM >::getPatchDataFactory | ( | int | id | ) | const [inline] |
Retrieve a patch data factory by integer index identifier. The identifier is the one previously returned by definePatchDataComponent(). Note that the factory pointer will be null if the index is is not currently assigned.
id | int index of factory to return, which must be >= 0 and < the return value of getMaxNumberRegisteredComponents(); |
tbox::Pointer< PatchDataFactory< DIM > > SAMRAI::hier::PatchDescriptor< DIM >::getPatchDataFactory | ( | const std::string & | name | ) | const |
Retrieve a patch data factory by name string identifier. Recall that uniqueness of names is not strictly enforced. So if more than one factory matches the given name, then only one of them is returned. If no matching factory is found, then a null pointer is returned.
name | string name of factory. |
int SAMRAI::hier::PatchDescriptor< DIM >::getMaxNumberRegisteredComponents | ( | ) | const [inline] |
Get the maximum number of components currently known to the patch descriptor. That is, this number indicates the largest number of components that have been registered with the descriptor via the definePatchDataComponent() function, which is equal to the largest known patch data component index + 1. Note that the total number of registered components is reduced by calls to removePatchDataComponent(), but the max number remains the same when components are removed. In that case, the corresponding indices are placed on a list of "free" values to be re-used in subsequent calls to definePatchDataComponent().
int SAMRAI::hier::PatchDescriptor< DIM >::mapNameToIndex | ( | const std::string & | name | ) | const |
Lookup a factory by string name and return its integer index identifier. Note that more than one factory may have the same name. In this case, the identifier of one of the factories is chosen. If no matching factory is found, then an invalid negative index is returned.
const std::string & SAMRAI::hier::PatchDescriptor< DIM >::mapIndexToName | ( | const int | id | ) | const [inline] |
Lookup a factory by identifier and return its name.
IntVector< DIM > SAMRAI::hier::PatchDescriptor< DIM >::getMaxGhostWidth | ( | ) | const |
Return the IntVector indicating the maximum ghost cell width of all registered patch data components.
void SAMRAI::hier::PatchDescriptor< DIM >::printClassData | ( | std::ostream & | stream = tbox::plog |
) | const [virtual] |
Print patch descriptor data to given output stream (plog by default).