#include <source/hierarchy/patches/PatchLevel.h>
Inheritance diagram for SAMRAI::hier::PatchLevel< DIM >:
Public Types | |
typedef PatchLevelIterator< DIM > | Iterator |
Public Member Functions | |
PatchLevel () | |
PatchLevel (const BoxArray< DIM > &boxes, const ProcessorMapping &mapping, const IntVector< DIM > &ratio_to_level_zero, const tbox::Pointer< GridGeometry< DIM > > grid_geometry, const tbox::Pointer< PatchDescriptor< DIM > > descriptor, tbox::Pointer< PatchFactory< DIM > > factory=(0), bool defer_boundary_box_creation=false) | |
PatchLevel (tbox::Pointer< tbox::Database > level_database, tbox::Pointer< GridGeometry< DIM > > grid_geometry, tbox::Pointer< PatchDescriptor< DIM > > descriptor, tbox::Pointer< PatchFactory< DIM > > factory, ComponentSelector component_selector=ComponentSelector(false), bool defer_boundary_box_creation=false) | |
virtual | ~PatchLevel () |
int | getLevelNumber () const |
void | setLevelNumber (const int l) |
int | getNextCoarserHierarchyLevelNumber () const |
void | setNextCoarserHierarchyLevelNumber (const int l) |
bool | inHierarchy () const |
void | setLevelInHierarchy (bool in_hierarchy) |
int | getNumberOfPatches () const |
tbox::Pointer< Patch< DIM > > | getPatch (const int p) const |
tbox::Pointer< PatchDescriptor< DIM > > | getPatchDescriptor () const |
tbox::Pointer< PatchFactory< DIM > > | getPatchFactory () const |
tbox::Pointer< GridGeometry< DIM > > | getGridGeometry () const |
void | setRefinedPatchLevel (const tbox::Pointer< hier::PatchLevel< DIM > > coarse_level, const hier::IntVector< DIM > &refine_ratio, const tbox::Pointer< hier::GridGeometry< DIM > > fine_grid_geometry=(0), bool defer_boundary_box_creation=false) |
void | setCoarsenedPatchLevel (const tbox::Pointer< hier::PatchLevel< DIM > > fine_level, const hier::IntVector< DIM > &coarsen_ratio, const tbox::Pointer< hier::GridGeometry< DIM > > coarse_grid_geom=(0), bool defer_boundary_box_creation=false) |
void | setBoundaryBoxes () |
const BoxArray< DIM > & | getPhysicalDomain () const |
const BoxArray< DIM > & | getBoxes () const |
const tbox::Array< tbox::List< IntVector< DIM > > > & | getShiftsForLevel () const |
const ProcessorMapping & | getProcessorMapping () const |
const IntVector< DIM > & | getRatio () const |
const IntVector< DIM > & | getRatioToCoarserLevel () const |
void | setRatioToCoarserLevel (const IntVector< DIM > &ratio) |
int | getMappingForPatch (const int p) const |
const Box< DIM > & | getBoxForPatch (const int p) const |
const tbox::List< IntVector< DIM > > & | getShiftsForPatch (const int p) const |
bool | patchTouchesRegularBoundary (const int p) const |
bool | patchTouchesPeriodicBoundary (const int p) const |
void | allocatePatchData (const int id, const double timestamp=0.0, tbox::Pointer< tbox::Arena > pool=(0)) |
void | allocatePatchData (const ComponentSelector &components, const double timestamp=0.0, tbox::Pointer< tbox::Arena > pool=(0)) |
bool | checkAllocated (const int id) const |
void | deallocatePatchData (const int id) |
void | deallocatePatchData (const ComponentSelector &components) |
void | setTime (const double timestamp, const int id) |
void | setTime (const double timestamp, const ComponentSelector &components) |
void | setTime (const double timestamp) |
void | getFromDatabase (tbox::Pointer< tbox::Database > database, ComponentSelector component_selector) |
void | putToDatabase (tbox::Pointer< tbox::Database > database, const ComponentSelector &patchdata_write_table) |
int | recursivePrint (std::ostream &os, const std::string &border=std::string(), unsigned short depth=0) |
Print a patch level to varying details. | |
tbox::Pointer< BoxGraph< DIM > > | getBoxGraph () |
tbox::Pointer< BoxTop< DIM > > | getBoxTop () |
tbox::Pointer< BoxTree< DIM > > | getBoxTree () |
tbox::Pointer< BinaryTree< DIM > > | getBinaryTree () |
To iterate over the local patches in a patch level, use the patch level iterator class (PatchLevel<DIM>::Iterator). This iterator will use the owner-computes rule to pick off local patches for computation.
typedef PatchLevelIterator<DIM> SAMRAI::hier::PatchLevel< DIM >::Iterator |
The iterator for the patches on a patch level. The iterator will return the patches that live on the local processor. Use iterator PatchLevel<DIM>::Iterator instead of PatchLevelIterator<DIM>, since the iterator may be defined as a nested class in the future.
SAMRAI::hier::PatchLevel< DIM >::PatchLevel | ( | ) |
Default constructor. PatchLevel must be initialized before it can be used.
SAMRAI::hier::PatchLevel< DIM >::PatchLevel | ( | const BoxArray< DIM > & | boxes, | |
const ProcessorMapping & | mapping, | |||
const IntVector< DIM > & | ratio_to_level_zero, | |||
const tbox::Pointer< GridGeometry< DIM > > | grid_geometry, | |||
const tbox::Pointer< PatchDescriptor< DIM > > | descriptor, | |||
tbox::Pointer< PatchFactory< DIM > > | factory = (0) , |
|||
bool | defer_boundary_box_creation = false | |||
) |
Construct a new patch level given an array of boxes and a processor mapping. The ratio information establishes the ratio between the index space of the new level and some reference level. Typically, the reference level is level zero (i.e., the coarsest level) in some patch hierarchy. Also, the ratio is used by the grid geometry object to initialize the geometry information of the level and the patches on the level. All patch data owned by the local processor are allocated using the specified descriptor. A patch factory can be passed into the level constructor to specify the appropriate patch factory; if no factory is specified, then the standard patch factory will be used.
When assertion checking is active, an unrecoverable assertion results if either the grid geometry pointer or patch descriptor pointer is null, or if the number of boxes in the array does not match the mapping array.
defer_boundary_box_creation, if set to true, will suppress the construction of the boundary boxes.
SAMRAI::hier::PatchLevel< DIM >::PatchLevel | ( | tbox::Pointer< tbox::Database > | level_database, | |
tbox::Pointer< GridGeometry< DIM > > | grid_geometry, | |||
tbox::Pointer< PatchDescriptor< DIM > > | descriptor, | |||
tbox::Pointer< PatchFactory< DIM > > | factory, | |||
ComponentSelector | component_selector = ComponentSelector(false) , |
|||
bool | defer_boundary_box_creation = false | |||
) |
Construct a new patch level from the specified PatchLevel database. The box, mapping, and ratio to level zero data which are normally passed in during the construction of a new patch level are retrieved from the specified database. The component_selector argument specifies which patch data components should be allocated and read in from the level_database. By default, all bits in the component selector are set to false so that no patch data are allocated.
When assertion checking is turned on, the level_database, grid_geometry, and descriptor are checked to make sure that they are not null.
defer_boundary_box_creation, if set to true, will suppress the construction of the boundary boxes.
SAMRAI::hier::PatchLevel< DIM >::~PatchLevel | ( | ) | [virtual] |
The virtual destructor for patch level deallocates all patches.
int SAMRAI::hier::PatchLevel< DIM >::getLevelNumber | ( | ) | const [inline, virtual] |
Return the number of this level in a hierarchy, or the number of a hierarchy level matching the index space of this level. If this level does not align with the index space of a level in the hierarchy, then this value is -1. When the level is in a hierarchy, the return value os the number of the level in the hierarchy. See member function inHierarchy() below.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
void SAMRAI::hier::PatchLevel< DIM >::setLevelNumber | ( | const int | l | ) |
Set the number of this level to the level in the hierarchy aligning with the index space of this level. The default value is -1 meaning the level index space doesn't align with that of any hierarchy level.
int SAMRAI::hier::PatchLevel< DIM >::getNextCoarserHierarchyLevelNumber | ( | ) | const [inline] |
Return the number of the next coarser level in a hierarchy for the purposes of data interpolation from coarser levels. If the level is in a hierarchy, then this value is getLevelNumber() - 1. See member function inHierarchy() below.
void SAMRAI::hier::PatchLevel< DIM >::setNextCoarserHierarchyLevelNumber | ( | const int | l | ) |
Set the number of of the next coarser level in a hierarchy for the purposes of data interpolation from coarser levels. The default is -1 meaning the level doesn't relate to any hierarchy.
bool SAMRAI::hier::PatchLevel< DIM >::inHierarchy | ( | ) | const [inline] |
Return true when this level resides in a hierarchy and false otherwise.
void SAMRAI::hier::PatchLevel< DIM >::setLevelInHierarchy | ( | bool | in_hierarchy | ) |
Set to true if this level resides in a hierarchy; false otherwise. The default setting is false.
int SAMRAI::hier::PatchLevel< DIM >::getNumberOfPatches | ( | ) | const [inline] |
Return the total number of patches on the level.
tbox::Pointer< Patch< DIM > > SAMRAI::hier::PatchLevel< DIM >::getPatch | ( | const int | p | ) | const [inline] |
Return a pointer to the specified patch on the level. The patches are numbered starting at zero.
tbox::Pointer< PatchDescriptor< DIM > > SAMRAI::hier::PatchLevel< DIM >::getPatchDescriptor | ( | ) | const [inline] |
Return pointer to the patch descriptor for the level.
tbox::Pointer< PatchFactory< DIM > > SAMRAI::hier::PatchLevel< DIM >::getPatchFactory | ( | ) | const [inline] |
Return the factory object used to created patches in the level.
tbox::Pointer< GridGeometry< DIM > > SAMRAI::hier::PatchLevel< DIM >::getGridGeometry | ( | ) | const [inline] |
Return the grid geometry description.
void SAMRAI::hier::PatchLevel< DIM >::setRefinedPatchLevel | ( | const tbox::Pointer< hier::PatchLevel< DIM > > | coarse_level, | |
const hier::IntVector< DIM > & | refine_ratio, | |||
const tbox::Pointer< hier::GridGeometry< DIM > > | fine_grid_geometry = (0) , |
|||
bool | defer_boundary_box_creation = false | |||
) |
void SAMRAI::hier::PatchLevel< DIM >::setCoarsenedPatchLevel | ( | const tbox::Pointer< hier::PatchLevel< DIM > > | fine_level, | |
const hier::IntVector< DIM > & | coarsen_ratio, | |||
const tbox::Pointer< hier::GridGeometry< DIM > > | coarse_grid_geom = (0) , |
|||
bool | defer_boundary_box_creation = false | |||
) |
Set data members of this patch level by coarsening information on given fine level by the given ratio between the two levels. The coarse level will cover the same physical space as the fine level and will have the same number of patches with the same mapping of those patches to processors. However, the index space of the level will be coarsened by the specified ratio.
If the coarse grid geometry is null (default case), then it is assumed that this level is to use the same grid geometry as the given fine level and the ratio to level zero is set relative to the given fine level. Otherwise, we use the given grid geometry (assumed to be a proper coarsening of the grid geometry used on the given fine level) and copy ratio to level zero from given fine level. In other words, the function can be used to produce two different results. First, when passed a null grid geometry pointer, the coarsened patch level can be used for data exchange operations with the AMR hierarchy in which the fine level resides -- both levels are defined with respect to the index space of the grid geometry object which they share. Thus, the coarsened patch level can be used in data exchanges with the AMR hierarchy of the fine level automatically. Second, when passed a non-null coarse grid geometry pointer, the level is defined relative to that geometry and the coarsened patch level cannot be used in data exchanges with the AMR hierarchy of the fine level automatically in general. This mode is used to construct a coarsened copy of an entire patch hierarchy, typically.
void SAMRAI::hier::PatchLevel< DIM >::setBoundaryBoxes | ( | ) |
Create and store the boundary boxes for this level, if they do not already exist. If they have already been construction, this function does nothing. If the level is constructed with boundary box creation deferred, this method must be called before any attempt at filling data at physical boundaries. This function is called from xfer::RefineSchedule<DIM> prior to any physical boundary operations.
const BoxArray< DIM > & SAMRAI::hier::PatchLevel< DIM >::getPhysicalDomain | ( | ) | const [inline] |
Return a const reference to the box array that defines the extent of the index space on the level.
const BoxArray< DIM > & SAMRAI::hier::PatchLevel< DIM >::getBoxes | ( | ) | const [inline] |
Return a const reference to the box array that defines the patches on the level.
const tbox::Array< tbox::List< IntVector< DIM > > > & SAMRAI::hier::PatchLevel< DIM >::getShiftsForLevel | ( | ) | const [inline] |
Return a const reference to the shift array for the patches on the level; the shift array contains a list of shift vectors for each patch when the domain has some periodic direction.
const ProcessorMapping & SAMRAI::hier::PatchLevel< DIM >::getProcessorMapping | ( | ) | const [inline] |
Return a const reference to the mapping of patches to processors.
const IntVector< DIM > & SAMRAI::hier::PatchLevel< DIM >::getRatio | ( | ) | const [inline, virtual] |
Return a const reference to the vector ratio between the index space of this patch level and that of a reference level in AMR hierarchy (typically, level zero). Specifically, this is the ratio passed to the constructor.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
const IntVector< DIM > & SAMRAI::hier::PatchLevel< DIM >::getRatioToCoarserLevel | ( | ) | const [inline] |
Return the vector ratio between this level and the next coarser level in the patch hierarchy. This vector is set with the setRatioToCoarserLevel() function. If the level is not in a hierarchy, a default ratio of zero is returned.
void SAMRAI::hier::PatchLevel< DIM >::setRatioToCoarserLevel | ( | const IntVector< DIM > & | ratio | ) | [inline] |
Set the vector ratio between this level and the next coarser level in the patch hierarchy. This is required only when level resides in a hierarchy.
int SAMRAI::hier::PatchLevel< DIM >::getMappingForPatch | ( | const int | p | ) | const [inline] |
Return the processor that owns the specified patch. The patches are numbered starting at zero.
const Box< DIM > & SAMRAI::hier::PatchLevel< DIM >::getBoxForPatch | ( | const int | p | ) | const [inline] |
Return the box for the specified patch. The patches are numbered starting at zero.
const tbox::List< IntVector< DIM > > & SAMRAI::hier::PatchLevel< DIM >::getShiftsForPatch | ( | const int | p | ) | const [inline] |
Return the list of valid periodic shifts for the specified patch. The patches are numbered starting at zero.
bool SAMRAI::hier::PatchLevel< DIM >::patchTouchesRegularBoundary | ( | const int | p | ) | const [inline] |
Return true if patch with given number is adjacent to a non-periodic physical domain boundary. Otherwise, return false.
bool SAMRAI::hier::PatchLevel< DIM >::patchTouchesPeriodicBoundary | ( | const int | p | ) | const [inline] |
Return true if patch with given number is adjacent to a periodic physical domain boundary. Otherwise, return false.
void SAMRAI::hier::PatchLevel< DIM >::allocatePatchData | ( | const int | id, | |
const double | timestamp = 0.0 , |
|||
tbox::Pointer< tbox::Arena > | pool = (0) | |||
) | [virtual] |
Allocate the specified component on all patches. If no memory arena is specified, then the standard memory arena will be used.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
void SAMRAI::hier::PatchLevel< DIM >::allocatePatchData | ( | const ComponentSelector & | components, | |
const double | timestamp = 0.0 , |
|||
tbox::Pointer< tbox::Arena > | pool = (0) | |||
) | [virtual] |
Allocate the specified components on all patches. If no memory arena is specified, then the standard memory arena will be used.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
bool SAMRAI::hier::PatchLevel< DIM >::checkAllocated | ( | const int | id | ) | const |
Check whether the specified patch data index has been allocated. This function will return true if (1) there are no patches in this patch level or (2) all of the patches have allocated the patch data component.
void SAMRAI::hier::PatchLevel< DIM >::deallocatePatchData | ( | const int | id | ) | [virtual] |
Deallocate the specified component on all patches. This component will need to be reallocated before its next use.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
void SAMRAI::hier::PatchLevel< DIM >::deallocatePatchData | ( | const ComponentSelector & | components | ) | [virtual] |
Deallocate the specified components on all patches. These components will need to be reallocated before their next use.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
void SAMRAI::hier::PatchLevel< DIM >::setTime | ( | const double | timestamp, | |
const int | id | |||
) | [virtual] |
Set the simulation time for the specified patch component.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
void SAMRAI::hier::PatchLevel< DIM >::setTime | ( | const double | timestamp, | |
const ComponentSelector & | components | |||
) | [virtual] |
Set the simulation time for the specified patch components.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
void SAMRAI::hier::PatchLevel< DIM >::setTime | ( | const double | timestamp | ) | [virtual] |
Set the simulation time for all allocated patch components.
Implements SAMRAI::hier::BasePatchLevel< DIM >.
void SAMRAI::hier::PatchLevel< DIM >::getFromDatabase | ( | tbox::Pointer< tbox::Database > | database, | |
ComponentSelector | component_selector | |||
) |
Uses the PatchLevel database to set the state of the PatchLevel and to create all patches on the local processor.
Assertions: check that database is a non-null Pointer, that the data being retrieved from the database are of the type expected, that the number of patches is positive, that the number of patches and size of processor mapping array are the same, and that the number of patches and the number of boxes on the level are equal.
void SAMRAI::hier::PatchLevel< DIM >::putToDatabase | ( | tbox::Pointer< tbox::Database > | database, | |
const ComponentSelector & | patchdata_write_table | |||
) |
Writes the data from the PatchLevel to the database. Also tells all local patches to write out their state to the database. The patchdata_write_table specifies which patchdata are to be written to the database.
Assertions: check that database is a non-null Pointer.
int SAMRAI::hier::PatchLevel< DIM >::recursivePrint | ( | std::ostream & | os, | |
const std::string & | border = std::string() , |
|||
unsigned short | depth = 0 | |||
) |
Print a patch level to varying details.
If depth>0, print function will be called for each patch in the level.
tbox::Pointer< BoxGraph< DIM > > SAMRAI::hier::PatchLevel< DIM >::getBoxGraph | ( | ) |
Returns pointer to a BoxGraph graph object that was constructed using only boxes on this level.
tbox::Pointer< BoxTop< DIM > > SAMRAI::hier::PatchLevel< DIM >::getBoxTop | ( | ) |
Returns pointer to a BoxTop object that was constructed using boxes on this level.
tbox::Pointer< BoxTree< DIM > > SAMRAI::hier::PatchLevel< DIM >::getBoxTree | ( | ) |
Returns pointer to a BoxTree object that was constructed using boxes on this level.
tbox::Pointer< BinaryTree< DIM > > SAMRAI::hier::PatchLevel< DIM >::getBinaryTree | ( | ) |
Returns pointer to BinaryTree