#include <source/hierarchy/patches/PatchHierarchy.h>
Inheritance diagram for SAMRAI::hier::PatchHierarchy< DIM >:
Public Member Functions | |
PatchHierarchy (const std::string &object_name, tbox::Pointer< GridGeometry< DIM > > geometry, bool register_for_restart=true) | |
~PatchHierarchy () | |
tbox::Pointer< hier::PatchHierarchy< DIM > > | makeRefinedPatchHierarchy (const std::string &fine_hierarchy_name, const hier::IntVector< DIM > &refine_ratio, bool register_for_restart) const |
tbox::Pointer< hier::PatchHierarchy< DIM > > | makeCoarsenedPatchHierarchy (const std::string &coarse_hierarchy_name, const hier::IntVector< DIM > &coarsen_ratio, bool register_for_restart) const |
void | makeNewPatchLevel (const int l, const IntVector< DIM > &ratio_to_coarsest, const BoxArray< DIM > &patch_boxes, const ProcessorMapping &mapping, const bool defer_boundary_box_creation=false) |
void | removePatchLevel (const int l) |
tbox::Pointer< BasePatchLevel< DIM > > | getPatchLevel (const int l) const |
tbox::Pointer< PatchDescriptor< DIM > > | getPatchDescriptor () const |
bool | levelExists (const int l) const |
bool | finerLevelExists (const int l) const |
int | getNumberOfLevels () const |
int | getFinestLevelNumber () const |
void | setPatchFactory (tbox::Pointer< PatchFactory< DIM > > factory) |
void | setPatchLevelFactory (tbox::Pointer< PatchLevelFactory< DIM > > factory) |
tbox::Pointer< GridGeometry< DIM > > | getGridGeometry () const |
void | putToDatabase (tbox::Pointer< tbox::Database > database) |
void | putToDatabase (tbox::Pointer< tbox::Database > database, const ComponentSelector &patchdata_write_table) |
void | getFromRestart (const int max_levels) |
void | getFromDatabase (tbox::Pointer< tbox::Database > database, const ComponentSelector component_selector, const int max_levels=-1) |
int | recursivePrint (std::ostream &os, const std::string &border=std::string(), unsigned short depth=0) |
Print a patch hierarchy to varying details. |
SAMRAI::hier::PatchHierarchy< DIM >::PatchHierarchy | ( | const std::string & | object_name, | |
tbox::Pointer< GridGeometry< DIM > > | geometry, | |||
bool | register_for_restart = true | |||
) |
The constructor for the PatchHierarchy initializes the number of levels to zero, sets the geometry for the PatchHierarchy, and registers the PatchHierarchy for restart with the specified name when the boolean argument is true. Whether the hierarchy object will write its state to restart files during program execution is determined by this argument. Note that it has a default state of true.
Errors: passing in an empty string or a null grid geometry pointer will result in an unrecoverable assertion when assertion checking is active.
SAMRAI::hier::PatchHierarchy< DIM >::~PatchHierarchy | ( | ) |
Destructor for patch hierarchy objects.
tbox::Pointer< hier::PatchHierarchy< DIM > > SAMRAI::hier::PatchHierarchy< DIM >::makeRefinedPatchHierarchy | ( | const std::string & | fine_hierarchy_name, | |
const hier::IntVector< DIM > & | refine_ratio, | |||
bool | register_for_restart | |||
) | const |
Create and return pointer to a patch hierarchy that is a refined version of this patch hierarchy object. That is, the data members of the returned patch hierarchy are set by refining information on this hierarchy by the given ratio. The refined hierarchy will cover the same physical space as this hierarchy and will have the same number of levels and same mapping of patches to processors on each level. However, the index space of each level will be refined by the specified ratio. Note that this function does not allocate patch data so this must be done before any data operations can be performed on the new hierarchy.
tbox::Pointer< hier::PatchHierarchy< DIM > > SAMRAI::hier::PatchHierarchy< DIM >::makeCoarsenedPatchHierarchy | ( | const std::string & | coarse_hierarchy_name, | |
const hier::IntVector< DIM > & | coarsen_ratio, | |||
bool | register_for_restart | |||
) | const |
Create and return pointer to a patch hierarchy that is a coarsened version of this patch hierarchy object. That is, the data members of the returned patch hierarchy are set by coarsening information on this hierarchy by the given ratio. The coarsened hierarchy will cover the same physical space as this hierarchy and will have the same number of levels and same mapping of patches to processors on each level. However, the index space of each level will be coarsened by the specified ratio. Note that this function does not allocate patch data so this must be done before any data operations can be performed on the new hierarchy.
void SAMRAI::hier::PatchHierarchy< DIM >::makeNewPatchLevel | ( | const int | l, | |
const IntVector< DIM > & | ratio_to_coarsest, | |||
const BoxArray< DIM > & | patch_boxes, | |||
const ProcessorMapping & | mapping, | |||
const bool | defer_boundary_box_creation = false | |||
) |
Construct new patch level in hierarchy at given level number. Level construction involves making patches whose boxes correspond to given box arrays and assigning those patches to the patch level. Boxes are assigned to processors based on the processor mapping. The argument ratio to coarsest gives the ratio to the reference refinement level (typically the coarsest level; i.e., level zero).
void SAMRAI::hier::PatchHierarchy< DIM >::removePatchLevel | ( | const int | l | ) |
Remove PatchLevel and adjust number of levels accordingly.
tbox::Pointer< BasePatchLevel< DIM > > SAMRAI::hier::PatchHierarchy< DIM >::getPatchLevel | ( | const int | l | ) | const [inline, virtual] |
Return a pointer to the specified patch level.
Implements SAMRAI::hier::BasePatchHierarchy< DIM >.
tbox::Pointer< PatchDescriptor< DIM > > SAMRAI::hier::PatchHierarchy< DIM >::getPatchDescriptor | ( | ) | const [inline] |
Return a pointer to the patch descriptor used for the patches in the patch hierarchy.
bool SAMRAI::hier::PatchHierarchy< DIM >::levelExists | ( | const int | l | ) | const [inline] |
Returns true if the array of patch levels contains the specified patch level.
bool SAMRAI::hier::PatchHierarchy< DIM >::finerLevelExists | ( | const int | l | ) | const [inline, virtual] |
Returns true if the array of patch levels contains a patch level finer than the specified patch level. Otherwise, false is returned.
Implements SAMRAI::hier::BasePatchHierarchy< DIM >.
int SAMRAI::hier::PatchHierarchy< DIM >::getNumberOfLevels | ( | ) | const [inline, virtual] |
Return the number of levels that currently exist in the hierarchy.
Implements SAMRAI::hier::BasePatchHierarchy< DIM >.
int SAMRAI::hier::PatchHierarchy< DIM >::getFinestLevelNumber | ( | ) | const [inline, virtual] |
Return the level number of the finest resolution patch level residing in the hierarchy.
Implements SAMRAI::hier::BasePatchHierarchy< DIM >.
void SAMRAI::hier::PatchHierarchy< DIM >::setPatchFactory | ( | tbox::Pointer< PatchFactory< DIM > > | factory | ) | [inline] |
Set the factory used to create patch objects. If a factory is not specified, then the default factory will create patch objects of type Patch<DIM>.
void SAMRAI::hier::PatchHierarchy< DIM >::setPatchLevelFactory | ( | tbox::Pointer< PatchLevelFactory< DIM > > | factory | ) | [inline] |
Set the factory used to create patch level objects. If a factory is not specified, then the default factory will create patch level objects of type PatchLevel<DIM>.
tbox::Pointer< GridGeometry< DIM > > SAMRAI::hier::PatchHierarchy< DIM >::getGridGeometry | ( | ) | const [inline] |
Return a pointer to the grid geometry object.
void SAMRAI::hier::PatchHierarchy< DIM >::putToDatabase | ( | tbox::Pointer< tbox::Database > | database | ) | [virtual] |
Writes the state of the PatchHierarchy object and the PatchLevels it contains to the database. It should be noted that only those patch data which have been registered for restart with the VariableDatabase<DIM> will be written to the database. This method implements the pure virtual method in tbox::Serializable class which is used by the tbox::RestartManager for writing the PatchHierarchy to a restart file.
When assertion checking is active, the database pointer must be non-null.
Implements SAMRAI::hier::BasePatchHierarchy< DIM >.
void SAMRAI::hier::PatchHierarchy< DIM >::putToDatabase | ( | tbox::Pointer< tbox::Database > | database, | |
const ComponentSelector & | patchdata_write_table | |||
) | [virtual] |
Writes the state of the PatchHierarchy object and the PatchLevels it contains to the database. Only those patchdata corresponding to the set bits in the ComponentSelector are written to the specified database.
When assertion checking is active, the database pointer must be non-null.
Implements SAMRAI::hier::BasePatchHierarchy< DIM >.
void SAMRAI::hier::PatchHierarchy< DIM >::getFromRestart | ( | const int | max_levels | ) | [virtual] |
Read in the entire hierarchy from the restart file. The database from which the restart data is read is determined by the object_name specified in the constructor.
Notes:
When assertion checking is active, the max_levels argument must be greater than zero. An unrecoverable exception will result if the database cannot be found in the restart file or the data in the restart file is erroneous.
Implements SAMRAI::hier::BasePatchHierarchy< DIM >.
void SAMRAI::hier::PatchHierarchy< DIM >::getFromDatabase | ( | tbox::Pointer< tbox::Database > | database, | |
const ComponentSelector | component_selector, | |||
const int | max_levels = -1 | |||
) |
Read in the entire hierarchy from the specified database. The component_selector argument specifies which patch data components are to be read in from the database. The max_levels argument indicates the highest level in the hierarchy that is read in from the database.
Notes:
Assertion checks:
int SAMRAI::hier::PatchHierarchy< DIM >::recursivePrint | ( | std::ostream & | os, | |
const std::string & | border = std::string() , |
|||
unsigned short | depth = 0 | |||
) |
Print a patch hierarchy to varying details.
If depth>0, print function will be called for each level in the hierarchy.