Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SAMRAI::pdat::ArrayData< DIM, TYPE > Class Template Reference

#include <source/patchdata/array/ArrayData.h>

Inheritance diagram for SAMRAI::pdat::ArrayData< DIM, TYPE >:

Inheritance graph
[legend]
List of all members.

Public Types

typedef ArrayDataIterator<
DIM > 
Iterator

Public Member Functions

 ArrayData ()
 ArrayData (const hier::Box< DIM > &box, const int depth, tbox::Pointer< tbox::Arena > pool=tbox::Pointer< tbox::Arena >((0)))
 ~ArrayData ()
const hier::Box< DIM > & getBox () const
void initializeArray (const hier::Box< DIM > &box, const int depth, const tbox::Pointer< tbox::Arena > &pool)
bool isInitialized () const
 Returns whether array has been properly initialized proper depth and box.
void undefineData ()
bool isStandardType ()
void copy (const ArrayData< DIM, TYPE > &src, const hier::Box< DIM > &box)
void copy (const ArrayData< DIM, TYPE > &src, const hier::Box< DIM > &box, const hier::IntVector< DIM > &offset)
void copy (const ArrayData< DIM, TYPE > &src, const hier::BoxList< DIM > &boxes, const hier::IntVector< DIM > &offset)
void copyDepth (int dst_depth, const ArrayData< DIM, TYPE > &src, int src_depth, const hier::Box< DIM > &box)
 Copy one depth of a source array to a destination depth of another.
int getDataStreamSize (const hier::BoxList< DIM > &dest_boxes, const hier::IntVector< DIM > &source_offset) const
void packStream (tbox::AbstractStream &stream, const hier::Box< DIM > &dest_box, const hier::IntVector< DIM > &source_offset) const
void packStream (tbox::AbstractStream &stream, const hier::BoxList< DIM > &dest_boxes, const hier::IntVector< DIM > &source_offset) const
void unpackStream (tbox::AbstractStream &stream, const hier::Box< DIM > &dest_box, const hier::IntVector< DIM > &source_offset)
void unpackStream (tbox::AbstractStream &stream, const hier::BoxList< DIM > &boxes, const hier::IntVector< DIM > &source_offset)
int getDepth () const
int getOffset () const
TYPE * getPointer (const int d=0)
const TYPE * getPointer (const int d=0) const
TYPE & operator() (const hier::Index< DIM > &i, const int d)
const TYPE & operator() (const hier::Index< DIM > &i, const int d) const
void fillAll (const TYPE &t)
void fillAll (const TYPE &t, const hier::Box< DIM > &box)
void fill (const TYPE &t, const int d=0)
void fill (const TYPE &t, const hier::Box< DIM > &box, const int d=0)
void getFromDatabase (tbox::Pointer< tbox::Database > database)
void putToDatabase (tbox::Pointer< tbox::Database > database, bool data_only=false)
void getSpecializedFromDatabase (tbox::Pointer< tbox::Database > database)
void putSpecializedToDatabase (tbox::Pointer< tbox::Database > database)

Static Public Member Functions

static size_t getSizeOfData (const hier::Box< DIM > &box, const int depth)
static bool canEstimateStreamSizeFromBox ()

Detailed Description

template<int DIM, class TYPE>
class SAMRAI::pdat::ArrayData< DIM, TYPE >

Class ArrayData<DIM> is a basic templated array structure defined over the index space of a box (with a specified depth) that provides the support for the various flavors of patch data subclasses.

The data storage is in (i,...,k,d) order, where i,...,k indicates spatial indices and the d indicates the component at that location. Memory allocation is in column-major ordering (e.g., Fortran style) so that the leftmost index runs fastest in memory.

The data type TYPE must define a default constructor (that takes no arguments) and also the assignment operator. Note that a number of functions only work for standard built-in types (bool, char, double, float, and int). To use this class with other user-defined types, many of these functions will need to be specialized, especially those that deal with message packing and unpacking.


Member Typedef Documentation

template<int DIM, class TYPE>
typedef ArrayDataIterator<DIM> SAMRAI::pdat::ArrayData< DIM, TYPE >::Iterator
 

The array data iterator iterates over the elements of a box associated with an ArrayData object. This typedef is convenient link to the ArrayDataIterator<DIM> class.


Constructor & Destructor Documentation

template<int DIM, class TYPE>
SAMRAI::pdat::ArrayData< DIM, TYPE >::ArrayData  ) 
 

The no-arguments constructor creates an empty array data object. The initializeArray() member function must be called before the array can be used.

template<int DIM, class TYPE>
SAMRAI::pdat::ArrayData< DIM, TYPE >::ArrayData const hier::Box< DIM > &  box,
const int  depth,
tbox::Pointer< tbox::Arena pool = tbox::Pointertbox::Arena >((0))
 

The constructor for an array data object. The box describes the spatial extents of the index space and the depth gives the number of data components for each spatial location in the array. tbox::Array memory is allocated from the specified memory pool.

template<int DIM, class TYPE>
SAMRAI::pdat::ArrayData< DIM, TYPE >::~ArrayData  ) 
 

The destructor for an array data object releases all memory allocated for the array elements.


Member Function Documentation

template<int DIM, class TYPE>
const hier::Box< DIM > & SAMRAI::pdat::ArrayData< DIM, TYPE >::getBox  )  const [inline]
 

Return the box over which the array is defined.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::initializeArray const hier::Box< DIM > &  box,
const int  depth,
const tbox::Pointer< tbox::Arena > &  pool
 

Initialize the array data for the specified box and depth. This routine is normally called to initialize an array that was created by the no-arguments constructor.

template<int DIM, class TYPE>
bool SAMRAI::pdat::ArrayData< DIM, TYPE >::isInitialized  )  const [inline]
 

Returns whether array has been properly initialized proper depth and box.

Only initialized arrays can be used. Uninitialized arrays should not be used until initializeArray() is called.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::undefineData  ) 
 

Set the array data to some ``undefined'' state. For floats and doubles, this means setting data to signaling NaNs that cause a floating point exception when used in a numerical expression.

template<int DIM, class TYPE>
size_t SAMRAI::pdat::ArrayData< DIM, TYPE >::getSizeOfData const hier::Box< DIM > &  box,
const int  depth
[inline, static]
 

Return the amount of memory space needed to allocate a box of the specified size and depth. This function will need to be redefined for data types other than the standard bool, char, double, float, and int types.

template<int DIM, class TYPE>
bool SAMRAI::pdat::ArrayData< DIM, TYPE >::isStandardType  )  [inline]
 

Return true if the TYPE is a standard fundamental data type

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::copy const ArrayData< DIM, TYPE > &  src,
const hier::Box< DIM > &  box
 

Copy data from the source array data on the specified index domain. This routine will intersect the specified box against the source and destination boxes to find the region of intersection.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::copy const ArrayData< DIM, TYPE > &  src,
const hier::Box< DIM > &  box,
const hier::IntVector< DIM > &  offset
 

Copy data shifted in the index space from the source into the destination. The boxes are in the destination index space, and the source data is taken from the boxes shifted into the source index space. This routine will intersect the specified box against the source and destination boxes to find the region of intersection.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::copy const ArrayData< DIM, TYPE > &  src,
const hier::BoxList< DIM > &  boxes,
const hier::IntVector< DIM > &  offset
 

Copy data shifted in the index space from the source into the destination. The boxes are in the destination index space, and the source data is taken from the boxes shifted into the source index space.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::copyDepth int  dst_depth,
const ArrayData< DIM, TYPE > &  src,
int  src_depth,
const hier::Box< DIM > &  box
 

Copy one depth of a source array to a destination depth of another.

This routine will intersect the specified box against the source and destination boxes to find the region of intersection.

template<int DIM, class TYPE>
bool SAMRAI::pdat::ArrayData< DIM, TYPE >::canEstimateStreamSizeFromBox  )  [inline, static]
 

Return whether the amount of buffer space in the message stream can be estimated using the box alone (i.e., without specific type information). For built-in types (bool, char, double, float, int, and dcomplex), this routine returns true. For other user-defined data types that may require special handling, the user MUST define a different implementation.

template<int DIM, class TYPE>
int SAMRAI::pdat::ArrayData< DIM, TYPE >::getDataStreamSize const hier::BoxList< DIM > &  dest_boxes,
const hier::IntVector< DIM > &  source_offset
const [inline]
 

Calculate the number of bytes needed to stream the data lying in the specified box domains. This routine is only defined for the built-in types of bool, char, double, float, and int. For all other types, the user must define a specialized implementation.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::packStream tbox::AbstractStream stream,
const hier::Box< DIM > &  dest_box,
const hier::IntVector< DIM > &  source_offset
const
 

Pack data lying on the specified index set into the output stream. The shifted box must lie completely within the index space of the array. If compiled with assertions enabled, the packing routine will abort if the box is not contained within the index space of the array.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::packStream tbox::AbstractStream stream,
const hier::BoxList< DIM > &  dest_boxes,
const hier::IntVector< DIM > &  source_offset
const
 

Pack data lying on the specified index set into the output stream. The shifted boxes in the box list must lie completely within the index space of the array. If compiled with assertions enabled, the packing routine will abort if the boxes are not contained within the index space of the array.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::unpackStream tbox::AbstractStream stream,
const hier::Box< DIM > &  dest_box,
const hier::IntVector< DIM > &  source_offset
 

Unpack data from the message stream into the index set lying under the specified index set. The box must lie completely within the index space of the array. If compiled with assertions enabled, the unpacking routine will abort if the box is not contained within the index space of the array.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::unpackStream tbox::AbstractStream stream,
const hier::BoxList< DIM > &  boxes,
const hier::IntVector< DIM > &  source_offset
 

Unpack data from the message stream into the index set lying under the specified index set. The boxes in the box list must lie completely within the index space of the array. If compiled with assertions enabled, the unpacking routine will abort if the boxes are not contained within the index space of the array.

template<int DIM, class TYPE>
int SAMRAI::pdat::ArrayData< DIM, TYPE >::getDepth  )  const [inline]
 

Return the depth (e.g., the number of components in each spatial location) of the array.

template<int DIM, class TYPE>
int SAMRAI::pdat::ArrayData< DIM, TYPE >::getOffset  )  const [inline]
 

Return the offset (e.g., the number of data values for each depth component) of the array.

template<int DIM, class TYPE>
TYPE * SAMRAI::pdat::ArrayData< DIM, TYPE >::getPointer const int  d = 0  )  [inline]
 

Get a pointer to the beginning of a particular component of the patch data array.

template<int DIM, class TYPE>
const TYPE * SAMRAI::pdat::ArrayData< DIM, TYPE >::getPointer const int  d = 0  )  const [inline]
 

Get a const pointer to the beginning of a particular component of the patch data array.

template<int DIM, class TYPE>
TYPE & SAMRAI::pdat::ArrayData< DIM, TYPE >::operator() const hier::Index< DIM > &  i,
const int  d
[inline]
 

hier::Index into the array using an index and the component.

template<int DIM, class TYPE>
const TYPE & SAMRAI::pdat::ArrayData< DIM, TYPE >::operator() const hier::Index< DIM > &  i,
const int  d
const [inline]
 

hier::Index into the array (via a const reference) using an index and the component.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::fillAll const TYPE &  t  ) 
 

Fill all components with value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::fillAll const TYPE &  t,
const hier::Box< DIM > &  box
 

Fill all components within the box with value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::fill const TYPE &  t,
const int  d = 0
 

Fill all values of component d with the value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::fill const TYPE &  t,
const hier::Box< DIM > &  box,
const int  d = 0
 

Fill all values of component d within the box with the value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::getFromDatabase tbox::Pointer< tbox::Database database  ) 
 

Check to make sure that the class version and restart file version are equal. If so, read in data from database. This routine calls getSpecializedFromDatabase() to read in the proper data type.

Assertions: database must be a non-null pointer.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::putToDatabase tbox::Pointer< tbox::Database database,
bool  data_only = false
 

Writes out data for class representation to database. This routine calls putSpecializedToDatabase() to read in the proper data type. The default behavior (boolean argument is false) is to put all data members in database. Otherwise, only the array contents are written out.

Assertions: database must be a non-null pointer.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::getSpecializedFromDatabase tbox::Pointer< tbox::Database database  ) 
 

Use specialized template method to get the correct behavior when reading in the array of data.

template<int DIM, class TYPE>
void SAMRAI::pdat::ArrayData< DIM, TYPE >::putSpecializedToDatabase tbox::Pointer< tbox::Database database  ) 
 

Use specialized template method to get the correct behavior when writing out the array of data.


The documentation for this class was generated from the following files:
Generated on Fri Dec 2 11:29:28 2005 for SAMRAI by  doxygen 1.4.2