#include <source/hierarchy/variables/Variable.h>
Inheritance diagram for SAMRAI::hier::Variable< DIM >:
Public Member Functions | |
Variable (const std::string &name, const tbox::Pointer< PatchDataFactory< DIM > > factory) | |
virtual | ~Variable () |
int | getInstanceIdentifier () const |
const std::string & | getName () const |
virtual bool | fineBoundaryRepresentsVariable () const=0 |
virtual bool | dataLivesOnPatchBorder () const=0 |
void | setPatchDataFactory (tbox::Pointer< PatchDataFactory< DIM > > factory) |
tbox::Pointer< PatchDataFactory< DIM > > | getPatchDataFactory () const |
Static Public Member Functions | |
static int | getCurrentMaximumInstanceNumber () |
Variable is a base class for all variables; subclasses for each data type (e.g., cell-centered variables or node-centered variables) will define member functions to create the appropriate storage management classes. Note that a variable object is distinct from the storage for the quantity to which the variable refers.
The user defines a set of variables and the role they play in the solution algorithm when describing an AMR application. Each variable type knows how to create instances of the associated data objects on patches in an AMR patch hierarchy via the getPatchDataFactory() member function. For example, we might have a concrete myVariable3<double> object that is derived from Variable3. The myVariable3<double> object returns a myVariableFactory3<double> object from its member function getPatchDataFactory(), and this factory is used to create the myVariable3<double> objects on the patches. Thus, a solution algorithm may be implemented to manage storage of variable quantities through the abstract interface without knowing the specific concrete variable types in use. This approach gives maximum flexibility when defining new user data types and variables and solution algorithms.
Each variable is assigned an ``instance number,'' a unique integer identifier numbered from 0 through MAX-1, where MAX is the value returned by static function getCurrentMaximumInstanceNumber(). These identifiers can be used to rapidly look up variable instances in a table. For example, the instance number can be used to map variables to algorithmic data within an algorithm as alluded to above..
Variable types for which data exists on the borders of patches (such as node, side, etc.), the data will thus live on the interface between coarse and fine patch levels. Thus, it must be specified whether coarse or fine data values take precedence on the interface between levels. This information is provided by the fineBoundaryRepresentsVariable() function. Each concrete variable subclass defines the behavior of this function.
SAMRAI::hier::Variable< DIM >::Variable | ( | const std::string & | name, | |
const tbox::Pointer< PatchDataFactory< DIM > > | factory | |||
) |
Create a variable object with the specified name and patch data factory. On creation, each variable is assigned a unique instance identifier.
SAMRAI::hier::Variable< DIM >::~Variable | ( | ) | [virtual] |
Virtual destructor for variable objects.
int SAMRAI::hier::Variable< DIM >::getCurrentMaximumInstanceNumber | ( | ) | [inline, static] |
Return the current maximum instance number over all variable objects. The instance identifier returned from each variable objhect is guaranteed to be between 0 and this number minus one. Note that this number changes as new variable instances are created.
int SAMRAI::hier::Variable< DIM >::getInstanceIdentifier | ( | ) | const [inline] |
Return the instance identifier for this particular variable object. The instance identifiers are unique integers numbered starting from zero.
const std::string & SAMRAI::hier::Variable< DIM >::getName | ( | ) | const [inline] |
Return the name assigned to this variable.
virtual bool SAMRAI::hier::Variable< DIM >::fineBoundaryRepresentsVariable | ( | ) | const [pure virtual] |
Return true if the fine data values represent the variable quantity on coarse-fine interfaces if variable data lives on patch borders; false otherwise. The boolean return value is supplied by the concrete variable subclass.
Implemented in SAMRAI::pdat::CellVariable< DIM, TYPE >, SAMRAI::pdat::EdgeVariable< DIM, TYPE >, SAMRAI::pdat::FaceVariable< DIM, TYPE >, SAMRAI::pdat::IndexVariable< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeVariable< DIM, TYPE >, SAMRAI::pdat::OuteredgeVariable< DIM, TYPE >, SAMRAI::pdat::OuterfaceVariable< DIM, TYPE >, SAMRAI::pdat::OuternodeVariable< DIM, TYPE >, SAMRAI::pdat::OutersideVariable< DIM, TYPE >, SAMRAI::pdat::SideVariable< DIM, TYPE >, SAMRAI::pdat::CellVariable< DIM, int >, SAMRAI::pdat::CellVariable< DIM, double >, SAMRAI::pdat::IndexVariable< DIM, SAMRAI::appu::CutCell< DIM >, SAMRAI::pdat::CellGeometry< DIM > >, SAMRAI::pdat::NodeVariable< DIM, int >, SAMRAI::pdat::OutersideVariable< DIM, double >, and SAMRAI::pdat::SideVariable< DIM, double >.
virtual bool SAMRAI::hier::Variable< DIM >::dataLivesOnPatchBorder | ( | ) | const [pure virtual] |
Return true if the variable data lives on patch borders; false otherwise. The boolean return value is supplied by the concrete variable subclass.
Implemented in SAMRAI::pdat::CellVariable< DIM, TYPE >, SAMRAI::pdat::EdgeVariable< DIM, TYPE >, SAMRAI::pdat::FaceVariable< DIM, TYPE >, SAMRAI::pdat::IndexVariable< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeVariable< DIM, TYPE >, SAMRAI::pdat::OuteredgeVariable< DIM, TYPE >, SAMRAI::pdat::OuterfaceVariable< DIM, TYPE >, SAMRAI::pdat::OuternodeVariable< DIM, TYPE >, SAMRAI::pdat::OutersideVariable< DIM, TYPE >, SAMRAI::pdat::SideVariable< DIM, TYPE >, SAMRAI::pdat::CellVariable< DIM, int >, SAMRAI::pdat::CellVariable< DIM, double >, SAMRAI::pdat::IndexVariable< DIM, SAMRAI::appu::CutCell< DIM >, SAMRAI::pdat::CellGeometry< DIM > >, SAMRAI::pdat::NodeVariable< DIM, int >, SAMRAI::pdat::OutersideVariable< DIM, double >, and SAMRAI::pdat::SideVariable< DIM, double >.
void SAMRAI::hier::Variable< DIM >::setPatchDataFactory | ( | tbox::Pointer< PatchDataFactory< DIM > > | factory | ) | [inline] |
Set the patch data factory object. Normally, the factory is set in the constructor, but this member function enables the factory to be changed later in the lifetime of the variable.
tbox::Pointer< PatchDataFactory< DIM > > SAMRAI::hier::Variable< DIM >::getPatchDataFactory | ( | ) | const [inline] |
Return a non-const pointer to a patch data factory that will be used to instantiate instances of this variable on the patches. The factory returned will have been set by the variable subclasses.