#include <source/patchdata/index/IndexData.h>
Inheritance diagram for SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >:
Public Types | |
typedef IndexIterator< DIM, TYPE, BOX_GEOMETRY > | Iterator |
typedef ConstIndexIterator< DIM, TYPE, BOX_GEOMETRY > | ConstIterator |
Public Member Functions | |
IndexData (const hier::Box< DIM > &box, const hier::IntVector< DIM > &ghosts) | |
virtual | ~IndexData () |
virtual void | copy (const hier::PatchData< DIM > &src) |
virtual void | copy2 (hier::PatchData< DIM > &dst) const |
virtual void | copy (const hier::PatchData< DIM > &src, const hier::BoxOverlap< DIM > &overlap) |
virtual void | copy2 (hier::PatchData< DIM > &dst, const hier::BoxOverlap< DIM > &overlap) const |
virtual bool | canEstimateStreamSizeFromBox () const |
virtual int | getDataStreamSize (const hier::BoxOverlap< DIM > &overlap) const |
virtual void | packStream (tbox::AbstractStream &stream, const hier::BoxOverlap< DIM > &overlap) const |
virtual void | unpackStream (tbox::AbstractStream &stream, const hier::BoxOverlap< DIM > &overlap) |
void | appendItem (const hier::Index< DIM > &index, const TYPE &item) |
void | appendItemPointer (const hier::Index< DIM > &index, TYPE *item) |
void | addItem (const hier::Index< DIM > &index, const TYPE &item) |
void | addItemPointer (const hier::Index< DIM > &index, TYPE *item) |
void | replaceAddItem (const hier::Index< DIM > &index, const TYPE &item) |
void | replaceAddItemPointer (const hier::Index< DIM > &index, TYPE *item) |
void | replaceAppendItem (const hier::Index< DIM > &index, const TYPE &item) |
void | replaceAppendItemPointer (const hier::Index< DIM > &index, TYPE *item) |
void | removeItem (const hier::Index< DIM > &index) |
int | getNumberOfItems () const |
void | removeInsideBox (const hier::Box< DIM > &box) |
void | removeOutsideBox (const hier::Box< DIM > &box) |
void | removeGhostItems () |
void | removeAllItems () |
bool | isElement (const hier::Index< DIM > &index) const |
TYPE * | getItem (const hier::Index< DIM > &index) const |
virtual void | getSpecializedFromDatabase (tbox::Pointer< tbox::Database > database) |
virtual void | putSpecializedToDatabase (tbox::Pointer< tbox::Database > database) |
Friends | |
class | IndexIterator< DIM, TYPE, BOX_GEOMETRY > |
class | ConstIndexIterator< DIM, TYPE, BOX_GEOMETRY > |
For example, this class is used to represent embedded * boundary features as a regular patch data type using the BoundaryCell class as the template type. The iteration ordering property is used to visit the boundary cells in a well defined way.
Additional insertion methods are provided for optimization in specific use cases. An extra constructor call can be avoided if the "Pointer" versions of Add/AppendItem are used. These methods assume that the items are being "given" to IndexData thus IndexData will delete them when needed. The items must be dynamically allocated for this to work correctly, E.G.
index_data.addItemPointer(someIndex, new ItemToInsert());
The "replace" versions of the insert routines may be used when one wishes to preserve the existing iteration ordering. If an item already exists the replace insert will delete the old item and put the item provided in it's place (inserting it into that location in the linked list).
If one does not care about the iteration order and is frequently updating the items stored, the "replace" versions are significantly faster.
The template parameter TYPE * defines the storage at each index location. IndexDaga is derived from * hier::PatchData.
The data type TYPE must define the following five methods which are require by this class:
The BOX_GEOMETRY template parameter defines the geometry. BOX_GEOMETRY must have a nested class name Overlap that implements he following methods:
More information about the templated TYPE is provided in the IndexData README file.
IndexData<DIM> objects are created by the IndexDataFactory<DIM> factory object just as all other patch data types.
typedef IndexIterator<DIM,TYPE,BOX_GEOMETRY> SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::Iterator |
Define the iterator.
typedef ConstIndexIterator<DIM,TYPE,BOX_GEOMETRY> SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::ConstIterator |
SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::IndexData | ( | const hier::Box< DIM > & | box, | |
const hier::IntVector< DIM > & | ghosts | |||
) |
The constructor for an IndexData object. The box describes the interior of the index space and the ghosts vector describes the ghost nodes in each coordinate direction.
SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::~IndexData | ( | ) | [virtual] |
The virtual destructor for an IndexData object.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::copy | ( | const hier::PatchData< DIM > & | src | ) | [virtual] |
A fast copy between the source and destination. All data is copied from the source into the destination where there is overlap in the index space.
Implements SAMRAI::hier::PatchData< DIM >.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::copy2 | ( | hier::PatchData< DIM > & | dst | ) | const [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).
Implements SAMRAI::hier::PatchData< DIM >.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::copy | ( | const hier::PatchData< DIM > & | src, | |
const hier::BoxOverlap< DIM > & | overlap | |||
) | [virtual] |
Copy data from the source into the destination using the designated overlap descriptor. The overlap description should have been computed previously from computeIntersection().
Implements SAMRAI::hier::PatchData< DIM >.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::copy2 | ( | hier::PatchData< DIM > & | dst, | |
const hier::BoxOverlap< DIM > & | overlap | |||
) | const [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).
Implements SAMRAI::hier::PatchData< DIM >.
bool SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::canEstimateStreamSizeFromBox | ( | ) | const [virtual] |
Determines whether the hier::PatchData subclass can estinate the necessary stream size using only index space information.
Implements SAMRAI::hier::PatchData< DIM >.
int SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::getDataStreamSize | ( | const hier::BoxOverlap< DIM > & | overlap | ) | const [virtual] |
Calculate the number of bytes needed to stream the data lying in the specified box domain.
Implements SAMRAI::hier::PatchData< DIM >.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::packStream | ( | tbox::AbstractStream & | stream, | |
const hier::BoxOverlap< DIM > & | overlap | |||
) | const [virtual] |
Pack data lying on the specified index set into the output stream.
Implements SAMRAI::hier::PatchData< DIM >.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::unpackStream | ( | tbox::AbstractStream & | stream, | |
const hier::BoxOverlap< DIM > & | overlap | |||
) | [virtual] |
Unpack data from the message stream into the specified index set.
Implements SAMRAI::hier::PatchData< DIM >.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::appendItem | ( | const hier::Index< DIM > & | index, | |
const TYPE & | item | |||
) |
Add a new item to the tail of the irregular index set.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::appendItemPointer | ( | const hier::Index< DIM > & | index, | |
TYPE * | item | |||
) |
Add a pointer to a new item to the tail of the irregular index set. IndexData will delete the item when it is no longer needed by IndexData. Due to this behavior item must be dynamically created (e.g. new) so that it may be deleted.
NOTE: This is an optimization to avoid an extra constructor call. It should be used with caution, the caller MUST NOT delete the referenced item. Think of this as giving up control of the item to IndexData.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::addItem | ( | const hier::Index< DIM > & | index, | |
const TYPE & | item | |||
) |
Add a new item to the head of the irregular index set
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::addItemPointer | ( | const hier::Index< DIM > & | index, | |
TYPE * | item | |||
) |
Add a pointer to a new item to the head of the irregular index set. IndexData will delete the item when it is no longer needed by IndexData. Due to this behavior item must be dynamically created (e.g. new) so that it may be deleted.
NOTE: This is an optimization to avoid an extra constructor call. It should be used with caution, the caller MUST NOT delete the referenced item. Think of this as giving up control of the item to IndexData.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::replaceAddItem | ( | const hier::Index< DIM > & | index, | |
const TYPE & | item | |||
) |
Remove (deallocate) the item in the irregular index set located at the specified hier::Index and replace it with a new item.
This preserves the iteration order of the orginal insertions.
If an item does not already exist at index this is equivelent to addItem.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::replaceAddItemPointer | ( | const hier::Index< DIM > & | index, | |
TYPE * | item | |||
) |
Remove (deallocate) the item in the irregular index set located at the specified hier::Index and replace it with a new item.
This preserves the iteration order of the original insertions.
If an item does not already exist at index this is equivelent to addItemPointer.
See addItemPointer for additional comments on pointer semantics.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::replaceAppendItem | ( | const hier::Index< DIM > & | index, | |
const TYPE & | item | |||
) |
Remove (deallocate) the item in the irregular index set located at the specified hier::Index and replace it with a new item.
This preserves the iteration order of the orginal insertions.
If an item does not already exist at index this is equivelent to appendItem.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::replaceAppendItemPointer | ( | const hier::Index< DIM > & | index, | |
TYPE * | item | |||
) |
Remove (deallocate) the item in the irregular index set located at the specified hier::Index and replace it with a new item.
This preserves the iteration order of the original insertions.
If an item does not already exist at index this is equivelent to appendItemPointer.
See addItemPointer for additional comments on pointer semantics.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::removeItem | ( | const hier::Index< DIM > & | index | ) |
Remove (deallocate) the item in the irregular index set located at the specified hier::Index.
int SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::getNumberOfItems | ( | ) | const |
Return the number of data items (i.e. the number of indices) in the index data list.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::removeInsideBox | ( | const hier::Box< DIM > & | box | ) |
Remove (deallocate) any items in the irregular index set located in the index space of the hier::Box.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::removeOutsideBox | ( | const hier::Box< DIM > & | box | ) |
Remove (deallocate) any items in the irregular index set located outside of the index space of the hier::Box.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::removeGhostItems | ( | ) |
Remove (deallocate) the items in the irregular index set located in the ghost region of the patch.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::removeAllItems | ( | ) |
Remove (deallocate) all items in the irregular index set.
bool SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::isElement | ( | const hier::Index< DIM > & | index | ) | const |
Returns true if there is an element of the irregular index set at the specified hier::Index.
TYPE * SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::getItem | ( | const hier::Index< DIM > & | index | ) | const |
Given an index, return a pointer to the item located at that index. If there is no item at the index, null is returned.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::getSpecializedFromDatabase | ( | tbox::Pointer< tbox::Database > | database | ) | [virtual] |
Check to make sure that the class version number is the same as the restart file version number.
Assertions: database must be a non-null pointer.
Implements SAMRAI::hier::PatchData< DIM >.
void SAMRAI::pdat::IndexData< DIM, TYPE, BOX_GEOMETRY >::putSpecializedToDatabase | ( | tbox::Pointer< tbox::Database > | database | ) | [virtual] |
Write out the class version number to the database.
Assertions: database must be a non-null pointer.
Implements SAMRAI::hier::PatchData< DIM >.
friend class IndexIterator< DIM, TYPE, BOX_GEOMETRY > [friend] |
friend class ConstIndexIterator< DIM, TYPE, BOX_GEOMETRY > [friend] |