SAMRAI::hier::Patch< DIM > Class Template Reference

#include <source/hierarchy/patches/Patch.h>

List of all members.

Public Member Functions

 Patch (const Box< DIM > &box, tbox::Pointer< PatchDescriptor< DIM > > descriptor)
virtual ~Patch ()
const Box< DIM > & getBox () const
int getPatchNumber () const
void setPatchNumber (const int p)
tbox::Pointer< PatchDescriptor<
DIM > > 
getPatchDescriptor () const
tbox::Pointer< PatchData<
DIM > > 
getPatchData (const int id) const
tbox::Pointer< PatchData<
DIM > > 
getPatchData (const tbox::Pointer< Variable< DIM > > variable, const tbox::Pointer< VariableContext > context) const
void setPatchData (const int id, tbox::Pointer< PatchData< DIM > > data)
bool checkAllocated (const int id) const
size_t getSizeOfPatchData (const int id) const
size_t getSizeOfPatchData (const ComponentSelector &components) const
void allocatePatchData (const int id, const double time=0.0, tbox::Pointer< tbox::Arena > pool=(0))
void allocatePatchData (const ComponentSelector &components, const double time=0.0, tbox::Pointer< tbox::Arena > pool=(0))
void deallocatePatchData (const int id)
void deallocatePatchData (const ComponentSelector &components)
void setPatchGeometry (tbox::Pointer< PatchGeometry< DIM > > geometry)
tbox::Pointer< PatchGeometry<
DIM > > 
getPatchGeometry () const
void setTime (const double timestamp, const int id)
void setTime (const double timestamp, const ComponentSelector &components)
void setTime (const double timestamp)
int getPatchLevelNumber () const
void setPatchLevelNumber (const int level_number)
bool inHierarchy () const
void setPatchInHierarchy (bool in_hierarchy)
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) const
 Print a patch (for debugging).

Friends

template<int D>
std::ostream & operator<< (std::ostream &s, const Patch< D > &patch)


Detailed Description

template<int DIM>
class SAMRAI::hier::Patch< DIM >

Class Patch<DIM> is a container for patch data objects defined over some box region. Each of the patch data objects that exist on the patch are subclasses of the patch data pure virtual base class. The construction of the patch data objects on a patch are managed via the factory classes maintained by the patch descriptor.

By default, the patch constructor does not allocate space for the various patch data components that live on the patch. Individual components or sets of components can be instantiated or destroyed via patch member functions.

See also:
hier::Box

hier::PatchDescriptor

hier::PatchData

hier::PatchDataFactory

hier::PatchGeometry


Constructor & Destructor Documentation

template<int DIM>
SAMRAI::hier::Patch< DIM >::Patch ( const Box< DIM > &  box,
tbox::Pointer< PatchDescriptor< DIM > >  descriptor 
)

Allocate a patch container over the box, but do not instantiate any patch data components.

template<int DIM>
SAMRAI::hier::Patch< DIM >::~Patch (  )  [virtual]

Virtual destructor for patch objects.


Member Function Documentation

template<int DIM>
const Box< DIM > & SAMRAI::hier::Patch< DIM >::getBox (  )  const [inline]

Return the box over which this patch is defined. The components on a match are free to interpret this box as appropriate to the geometry of the component (e.g., face, cell, or node centered).

template<int DIM>
int SAMRAI::hier::Patch< DIM >::getPatchNumber (  )  const [inline]

Return the number of this patch. In general, this number represents the number of the patch in some patch level.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setPatchNumber ( const int  p  )  [inline]

Set the number associated with this patch in the patch level.

template<int DIM>
tbox::Pointer< PatchDescriptor< DIM > > SAMRAI::hier::Patch< DIM >::getPatchDescriptor (  )  const [inline]

Return the patch descriptor for this patch. The patch descriptor describes the patch data types that may exist on the patch.

template<int DIM>
tbox::Pointer< PatchData< DIM > > SAMRAI::hier::Patch< DIM >::getPatchData ( const int  id  )  const [inline]

Return a pointer to the patch data object associated with the specified identifier. Typically, this function should only be called to access patch data objects that have already been explicitly allocated through a call to one of the patch allocation routines. A NULL pointer will be returned if the patch data object is not allocated.

template<int DIM>
tbox::Pointer< PatchData< DIM > > SAMRAI::hier::Patch< DIM >::getPatchData ( const tbox::Pointer< Variable< DIM > >  variable,
const tbox::Pointer< VariableContext context 
) const [inline]

Return a pointer to the patch data object associated with the specified variable and context. Typically, this function should only be called to access patch data objects that have already been explicitly allocated through a call to one of the patch allocation routines. A NULL pointer will be returned if the patch data object is not allocated.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setPatchData ( const int  id,
tbox::Pointer< PatchData< DIM > >  data 
) [inline]

Set the patch data pointer associated with the specified identifier. Note that this member function must be used with caution. It can only be called for patch data indices that were previously allocated through one of the patch routines. This member function does not check to see whether the patch data types are already allocated, consistent, or whether they have the same factory. So, for example, a face centered data type could be assigned to a location reserved for a cell centered data type (with potentially different box and ghost cell width).

template<int DIM>
bool SAMRAI::hier::Patch< DIM >::checkAllocated ( const int  id  )  const [inline]

Check whether the specified component has been allocated.

template<int DIM>
size_t SAMRAI::hier::Patch< DIM >::getSizeOfPatchData ( const int  id  )  const

Return the amount of memory needed to allocate the specified component.

template<int DIM>
size_t SAMRAI::hier::Patch< DIM >::getSizeOfPatchData ( const ComponentSelector components  )  const

Return the amount of memory needed to allocate the specified components.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::allocatePatchData ( const int  id,
const double  time = 0.0,
tbox::Pointer< tbox::Arena pool = (0) 
)

Allocate the specified component on the patch. If no memory arena is specified, then the standard memory arena will be used. Also, an assertion will result if the component is already allocated. This provides a key bit of debugging information that may be useful to application developers.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::allocatePatchData ( const ComponentSelector components,
const double  time = 0.0,
tbox::Pointer< tbox::Arena pool = (0) 
)

Allocate the specified components on the patch. If no memory arena is specified, then the standard memory arena will be used. Also, an assertion will result if any requested component is already allocated. This provides a key bit of debugging information that may be useful to application developers.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::deallocatePatchData ( const int  id  ) 

Deallocate the specified component. This component will need to be reallocated before its next use.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::deallocatePatchData ( const ComponentSelector components  ) 

Deallocate the specified components. These components will need to be reallocated before their next use.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setPatchGeometry ( tbox::Pointer< PatchGeometry< DIM > >  geometry  )  [inline]

Set the geometry specification for the patch domain. This includes patch boundary information and grid data.

template<int DIM>
tbox::Pointer< PatchGeometry< DIM > > SAMRAI::hier::Patch< DIM >::getPatchGeometry (  )  const [inline]

Return pointer to patch geometry object.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setTime ( const double  timestamp,
const int  id 
) [inline]

Set the simulation time for the specified patch component.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setTime ( const double  timestamp,
const ComponentSelector components 
)

Set the simulation time for the specified patch components.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setTime ( const double  timestamp  ) 

Set the simulation time for all allocated patch components.

template<int DIM>
int SAMRAI::hier::Patch< DIM >::getPatchLevelNumber (  )  const [inline]

Get the level number of the patch level where this patch resides. Note that this value can be a valid level number (i.e., >=0) even when the level is not in a hierarchy. In this case the level number will be the number of the hierarchy level matching the index space of the patch level holding this patch. If the patch level does not align with the index space of a level in the hierarchy, then this value is -1. See member function inHierarchy() below.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setPatchLevelNumber ( const int  level_number  )  [inline]

Set the patch level number to the number of a level in the hierarchy when the index space of the level owning this patch aligns with the index space of some valid hierarchy level. The default level number is -1.

template<int DIM>
bool SAMRAI::hier::Patch< DIM >::inHierarchy (  )  const [inline]

Return true when the level holding this patch resides in a hierarchy and false otherwise.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::setPatchInHierarchy ( bool  in_hierarchy  )  [inline]

Set to true if the level holding this patch resides in a hierarchy; false otherwise. The default setting is false.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::getFromDatabase ( tbox::Pointer< tbox::Database database,
ComponentSelector  component_selector 
)

Checks that class version and restart file version are equal. If so, read in the state of the patch and create all patch data objects indicated in the component selector from the database

Assertions: check that database is a non-null Pointer, that data retrieved from the database are of the type expected, and that the patch_number read in from the database matches the patch number assigned to this Patch.

Important Note: a warning will be printed to the log file if some patch data components that were requested through the component_selector are not found in the database.

template<int DIM>
void SAMRAI::hier::Patch< DIM >::putToDatabase ( tbox::Pointer< tbox::Database database,
const ComponentSelector patchdata_write_table 
)

Write out the class version number and the state of the patch object. Finally, patch data objects specified in the component selector are written to the specified database.

Assertions: check that database is a non-null Pointer.

template<int DIM>
int SAMRAI::hier::Patch< DIM >::recursivePrint ( std::ostream &  os,
const std::string &  border = std::string(),
unsigned short  depth = 0 
) const

Print a patch (for debugging).

Depth is kept for consistency with other recursivePrint methods, but is not used because this is the lowest level of recursion currently supported.


Friends And Related Function Documentation

template<int DIM>
template<int D>
std::ostream& operator<< ( std::ostream &  s,
const Patch< D > &  patch 
) [friend]

Output patch information (box and number of components).


The documentation for this class was generated from the following files:
Generated on Thu Jun 18 11:28:29 2009 for SAMRAI by  doxygen 1.5.1