#include <source/hierarchy/variables/PatchData.h>
Inheritance diagram for SAMRAI::hier::PatchData< DIM >:
Public Member Functions | |
PatchData (const Box< DIM > &domain, const IntVector< DIM > &ghosts) | |
virtual | ~PatchData () |
const Box< DIM > & | getBox () const |
const Box< DIM > & | getGhostBox () const |
const IntVector< DIM > & | getGhostCellWidth () const |
void | setTime (const double timestamp) |
double | getTime () const |
virtual void | copy (const PatchData< DIM > &src)=0 |
virtual void | copy2 (PatchData< DIM > &dst) const =0 |
virtual void | copy (const PatchData< DIM > &src, const BoxOverlap< DIM > &overlap)=0 |
virtual void | copy2 (PatchData< DIM > &dst, const BoxOverlap< DIM > &overlap) const =0 |
virtual bool | canEstimateStreamSizeFromBox () const=0 |
virtual int | getDataStreamSize (const BoxOverlap< DIM > &overlap) const =0 |
virtual void | packStream (tbox::AbstractStream &stream, const BoxOverlap< DIM > &overlap) const=0 |
virtual void | unpackStream (tbox::AbstractStream &stream, const BoxOverlap< DIM > &overlap)=0 |
virtual void | getFromDatabase (tbox::Pointer< tbox::Database > database) |
virtual void | putToDatabase (tbox::Pointer< tbox::Database > database) |
virtual void | getSpecializedFromDatabase (tbox::Pointer< tbox::Database > database)=0 |
virtual void | putSpecializedToDatabase (tbox::Pointer< tbox::Database > database)=0 |
Protected Member Functions | |
void | setGhostBox (const Box< DIM > &ghost_box) |
Patch data objects are created by patch data factories and associated subclasses. This separation into abstract factory and concrete implementation subclasses facilitates the creation of new patch data subtypes. See the Design Patterns book for more details about the Abstract Factory pattern.
The copy and pack/unpack functions in the patch data object take box overlap descriptions that describe the index space over which data is to be copied or packed/unpacked. Box overlaps are computed by the box geometry classes, which are accessed through the patch data factories. Box geometry classes are created by the patch data factories instead of the patch data objects because patch data objects are distributed across memory with patches and therefore may not exist on a particular processor. Patch data factories are guaranteed to exist on all processors independent of the patch-to-processor mapping.
SAMRAI::hier::PatchData< DIM >::PatchData | ( | const Box< DIM > & | domain, | |
const IntVector< DIM > & | ghosts | |||
) |
The constructor for a patch data object. Patch data objects will manage the interior box over which they are defined and the associated ghost cell width.
SAMRAI::hier::PatchData< DIM >::~PatchData | ( | ) | [virtual] |
The virtual destructor for a patch data object.
const Box< DIM > & SAMRAI::hier::PatchData< DIM >::getBox | ( | ) | const [inline] |
Return the box over which this patch data object is defined. All objects in the same patch are defined over the same box, although the patch data objects may interpret how to allocate storage for that box in different ways.
const Box< DIM > & SAMRAI::hier::PatchData< DIM >::getGhostBox | ( | ) | const [inline] |
Return the ghost cell box. The ghost cell box is defined to be the interior box grown by the ghost cell width.
const IntVector< DIM > & SAMRAI::hier::PatchData< DIM >::getGhostCellWidth | ( | ) | const [inline] |
Get the ghost cell width associated with this patch data object.
void SAMRAI::hier::PatchData< DIM >::setTime | ( | const double | timestamp | ) | [inline] |
Set the simulation time stamp for the patch data type. The simulation time is initialized to zero when the patch data type is created.
double SAMRAI::hier::PatchData< DIM >::getTime | ( | ) | const [inline] |
Get the simulation time stamp for the patch data type.
virtual void SAMRAI::hier::PatchData< DIM >::copy | ( | const PatchData< DIM > & | src | ) | [pure virtual] |
A fast copy between the source and destination. Data is copied from the source into the destination where there is overlap in the underlying index space. The copy is performed on the interior plus the ghost cell width (for both the source and destination). If this copy does not understand how to copy data from the argument, then copy2() is called on the source object.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual void SAMRAI::hier::PatchData< DIM >::copy2 | ( | PatchData< DIM > & | dst | ) | const [pure virtual] |
A fast copy between the source and destination. Data is copied from the source into the destination where there is overlap in the underlying index space. The copy is performed on the interior plus the ghost cell width (for both the source and destination). If this copy does not understand how to copy data from the destination, then it may throw an exception (aka dump core in a failed assertion).
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual void SAMRAI::hier::PatchData< DIM >::copy | ( | const PatchData< DIM > & | src, | |
const BoxOverlap< DIM > & | overlap | |||
) | [pure virtual] |
Copy data from the source into the destination using the designated overlap descriptor. The overlap description will have been computed using the appropriate box geometry objects. If this member function cannot complete the copy from source (e.g., if it doesn't understand the type of source), then copy2() is called on the source object.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual void SAMRAI::hier::PatchData< DIM >::copy2 | ( | PatchData< DIM > & | dst, | |
const BoxOverlap< DIM > & | overlap | |||
) | const [pure virtual] |
Copy data from the source into the destination using the designated overlap descriptor. The overlap description will have been computed using the appropriate box geometry objects If this member function cannot complete the copy from the destination, then it may throw an exception (aka dump core in a failed assertion).
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual bool SAMRAI::hier::PatchData< DIM >::canEstimateStreamSizeFromBox | ( | ) | const [pure virtual] |
Determines whether the patch data subclass can estimate the necessary stream size using only index space information. The return value will most likely be true for data types that are fixed size (such as doubles) but will be false for complex data types that allocate their own storage (such as lists of particles). This routine is used to estimate whether a processor can estimate space for incoming messages or whether it needs to receive a message size from the sending processor.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual int SAMRAI::hier::PatchData< DIM >::getDataStreamSize | ( | const BoxOverlap< DIM > & | overlap | ) | const [pure virtual] |
Calculate the number of bytes needed to stream the data lying in the specified box domain. This estimate must be an upper bound on the size of the data in the actual message stream. The upper bound should be close, however, since buffer space will be allocated according to these values, and excess buffer space will waste memory resources.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual void SAMRAI::hier::PatchData< DIM >::packStream | ( | tbox::AbstractStream & | stream, | |
const BoxOverlap< DIM > & | overlap | |||
) | const [pure virtual] |
Pack data lying on the specified index set into the output stream. See the abstract stream virtual base class for more information about the packing operators defined for streams.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual void SAMRAI::hier::PatchData< DIM >::unpackStream | ( | tbox::AbstractStream & | stream, | |
const BoxOverlap< DIM > & | overlap | |||
) | [pure virtual] |
Unpack data from the message stream into the specified index set. See the abstract stream virtual base class for more information about the packing operators defined for streams.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
void SAMRAI::hier::PatchData< DIM >::getFromDatabase | ( | tbox::Pointer< tbox::Database > | database | ) | [virtual] |
Checks that class version and restart file version are equal. If so, reads in the data members common to all patch data types from database. This method then calls the getSpecializedFromDatabase() method to retrieve the data special to the concrete patch data type.
void SAMRAI::hier::PatchData< DIM >::putToDatabase | ( | tbox::Pointer< tbox::Database > | database | ) | [virtual] |
Writes out the class version number to the database. Then, writes the data members common to all patch data types from database. After the common data is written to the database, the putSpecializedToDatabase() method is invoked.
virtual void SAMRAI::hier::PatchData< DIM >::getSpecializedFromDatabase | ( | tbox::Pointer< tbox::Database > | database | ) | [pure virtual] |
This pure abstract method is used by concrete patch data subclasses to retrieve from the database data special to the concrete class.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
virtual void SAMRAI::hier::PatchData< DIM >::putSpecializedToDatabase | ( | tbox::Pointer< tbox::Database > | database | ) | [pure virtual] |
This pure abstract method is used by concrete patch data subclasses to put to the database data special to the concrete class.
Implemented in SAMRAI::pdat::CellData< DIM, TYPE >, SAMRAI::pdat::EdgeData< DIM, TYPE >, SAMRAI::pdat::FaceData< DIM, TYPE >, SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >, SAMRAI::pdat::NodeData< DIM, TYPE >, SAMRAI::pdat::OuteredgeData< DIM, TYPE >, SAMRAI::pdat::OuterfaceData< DIM, TYPE >, SAMRAI::pdat::OuternodeData< DIM, TYPE >, SAMRAI::pdat::OutersideData< DIM, TYPE >, and SAMRAI::pdat::SideData< DIM, TYPE >.
void SAMRAI::hier::PatchData< DIM >::setGhostBox | ( | const Box< DIM > & | ghost_box | ) | [inline, protected] |
This protected method is used by concrete patch data subclasses to set the ghost box over which the patch data will be allocated. Note that this allows the ghost box to be inconsistant with its standard interpretation as the patch domain box grown by the ghost cell width (as set in the constructor).
This function is included to treat some special cases for concrete patch data types and should be used with caution.