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

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

Inheritance diagram for SAMRAI::hier::GridGeometry< DIM >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 GridGeometry (const std::string &object_name)
virtual ~GridGeometry ()
void computeShiftsForLevel (tbox::Array< tbox::List< IntVector< DIM > > > &shifts, const PatchLevel< DIM > &level, const BoxArray< DIM > &physical_domain) const
void computePhysicalDomain (BoxArray< DIM > &domain, const IntVector< DIM > &ratio_to_level_zero) const
void setPhysicalDomain (const BoxArray< DIM > &domain)
const BoxArray< DIM > & getPhysicalDomain () const
bool getDomainIsSingleBox () const
virtual void printClassData (std::ostream &stream) const
void initializePeriodicShift (const IntVector< DIM > &directions)
IntVector< DIM > getPeriodicShift (const IntVector< DIM > &ratio_to_level_zero=IntVector< DIM >(1)) const
IntVector< DIM > computeMaxGhostWidth (tbox::Pointer< PatchDescriptor< DIM > > descriptor)
 Compute the maximum ghost width of all of the components associated with the patch descriptor.
virtual tbox::Pointer< hier::GridGeometry<
DIM > > 
makeRefinedGridGeometry (const std::string &fine_geom_name, const hier::IntVector< DIM > &refine_ratio, bool register_for_restart) const =0
virtual tbox::Pointer< hier::GridGeometry<
DIM > > 
makeCoarsenedGridGeometry (const std::string &coarse_geom_name, const hier::IntVector< DIM > &coarsen_ratio, bool register_for_restart) const =0
virtual void setGeometryDataOnPatch (hier::Patch< DIM > &patch, const hier::IntVector< DIM > &ratio_to_level_zero, const tbox::Array< tbox::Array< bool > > &touches_regular_bdry, const tbox::Array< tbox::Array< bool > > &touches_periodic_bdry) const =0
void computeBoundaryBoxesOnLevel (tbox::Array< BoundaryBox< DIM > > boundaries[], const PatchLevel< DIM > &level, const IntVector< DIM > &periodic_shift, const IntVector< DIM > &ghost_width, const BoxArray< DIM > &domain, bool do_all_patches=false) const
 Compute boundary boxes for each patch in patch level and assign them to the array of boundary box arrays, assumed to be of length DIM * (num patches).
void getBoundaryBoxes (tbox::Array< BoundaryBox< DIM > > boundaries[DIM], const Box< DIM > &box, const BoxArray< DIM > &domain_boxes, const IntVector< DIM > &ghosts, const IntVector< DIM > &periodic_shift) const
 Compute boundary boxes for patch.
Functions for computing boundary boxes
void findPatchesTouchingBoundaries (tbox::Array< tbox::Array< tbox::Array< bool > > > &touches_regular_bdry, tbox::Array< tbox::Array< tbox::Array< bool > > > &touches_periodic_bdry, const PatchLevel< DIM > &level, const IntVector< DIM > &periodic_shift, const BoxArray< DIM > &domain) const
 Determine for every patch on a level if it touches a regular physical boundary or a periodic boundary.
virtual void setGeometryOnPatches (hier::PatchLevel< DIM > &level, const hier::IntVector< DIM > &ratio_to_level_zero, tbox::Array< tbox::Array< tbox::Array< bool > > > &touches_regular_bdry, tbox::Array< tbox::Array< tbox::Array< bool > > > &touches_periodic_bdry, bool defer_boundary_box_creation)
 Pass the arrays holding the boundary information to be stored in the concrete geometry classes, and construct boundary boxes if required.
void setBoundaryBoxes (hier::PatchLevel< DIM > &level)
 Construct the boundary boxes for each patch and set them on the patch geometries.

Detailed Description

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

Class GridGeometry<DIM> serves as the base class for SAMRAI geometry classes that manage particular grid types (e.g., Cartesian, cylindrical, etc.). The grid geometry class is responsible for maintaining information about the index space describing the physical domain and computing this information for patches in an AMR hierarchy. Operations performed by this class include determining which patches are adjacent to the physical domain boundary and computing boundary boxes for patches which decribe how the patch touches the domain boundary (useful for filling ghost cell data for physical boundary conditions). Member functions that manage the description of the spatial coordinated on the mesh are pure virtual here and must be implemented in an appropriate subclass.

Note that the derivation from tbox::DescribedClass is virtual. The reason for this is to avoid dynamic casting problems for smart pointers. Typically, SAMRAI geometry objects inherit from tbox::Serializable as well as this base geometry class. Thus, there is usually more than one class hierarchy for geometry objects. Pointers to base objects may need to be dynamically cast to derived objects in either hierarchy.

See also:
hier::BoundaryBox


Constructor & Destructor Documentation

template<int DIM>
SAMRAI::hier::GridGeometry< DIM >::GridGeometry ( const std::string &  object_name  ) 

Constructor for GridGeometry.

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

Destructor for GridGeometry.


Member Function Documentation

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::findPatchesTouchingBoundaries ( tbox::Array< tbox::Array< tbox::Array< bool > > > &  touches_regular_bdry,
tbox::Array< tbox::Array< tbox::Array< bool > > > &  touches_periodic_bdry,
const PatchLevel< DIM > &  level,
const IntVector< DIM > &  periodic_shift,
const BoxArray< DIM > &  domain 
) const

Determine for every patch on a level if it touches a regular physical boundary or a periodic boundary.

This routine loops through all of the patches on the given level and determines which kinds of boundaries each patch touches. The 3-dimensional boolean arrays are set to store for each path whether it touches a regular boundary, a periodic boundary, both, or neither.

The array arguments should be uninitialized when they are passed into this function.

Parameters:
touches_regular_bdry Array to store which patches touch non-periodic boundaries.
touches_periodic_bdry Array to store which patches touch periodic boundaries.
level containing the patches to be checked
periodic_shift periodic shift for the level (see getPeriodicShift)
domain Physical domain (at the same level of refinement as level)

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::setGeometryOnPatches ( hier::PatchLevel< DIM > &  level,
const hier::IntVector< DIM > &  ratio_to_level_zero,
tbox::Array< tbox::Array< tbox::Array< bool > > > &  touches_regular_bdry,
tbox::Array< tbox::Array< tbox::Array< bool > > > &  touches_periodic_bdry,
bool  defer_boundary_box_creation 
) [virtual]

Pass the arrays holding the boundary information to be stored in the concrete geometry classes, and construct boundary boxes if required.

This routine will pass the arrays containing the information about which patches touch which boundaries to the concrete grid geometry class. Also, if defer_boundary_box_creation is false, this routine will call a routine to construct all of the boundary boxes for the patches on level and will set them in the patch geometry for each patch.

Parameters:
level containing the patches to be checked.
ratio_to_level_zero ratio to the coarsest level.
touches_regular_bdry Array storing which patches touch non-periodic boundaries.
touches_periodic_bdry Array storing which patches touch periodic boundaries.
defer_boundary_box_creation Boundary boxes will be created here if false, not if true.

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::setBoundaryBoxes ( hier::PatchLevel< DIM > &  level  ) 

Construct the boundary boxes for each patch and set them on the patch geometries.

This routine constructs the boundary boxes for every patch in the level. Once constructed, the boundary boxes are set on each patch's PatchGeometry object.

Parameters:
level The level for which boundary boxes are constructed.

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::computeShiftsForLevel ( tbox::Array< tbox::List< IntVector< DIM > > > &  shifts,
const PatchLevel< DIM > &  level,
const BoxArray< DIM > &  physical_domain 
) const

Compute the valid periodic shifts for each patch on a level. The shifts array will store a list of IntVectors for each patch. Each list will contain the valid possible periodic shifts for each particular patch. If there are no periodic boundary conditions or a patch does not touch a periodic boundary, the list for a patch will be empty.

The patch geometry object for each patch on the level must be properly initialized before calling this routine. This is typically done in the patch level constructor.

When assertion checking is active, the array of shifts in the argument list must have the same length as the number of patches on the level.

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::computePhysicalDomain ( BoxArray< DIM > &  domain,
const IntVector< DIM > &  ratio_to_level_zero 
) const

Compute physical domain box array describing the index space of the physical domain managed by this geometry object. If any entry of ratio vector is negative, the index space is coarsened with respect to the physical domain description. Otherwise, the index space is refined.

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::setPhysicalDomain ( const BoxArray< DIM > &  domain  ) 

Set physical domain to input box array and determine whether domain is a single box.

template<int DIM>
const BoxArray< DIM > & SAMRAI::hier::GridGeometry< DIM >::getPhysicalDomain (  )  const [inline]

Return const reference to physical domain description for level 0.

template<int DIM>
bool SAMRAI::hier::GridGeometry< DIM >::getDomainIsSingleBox (  )  const [inline]

Return boolean value indicating whether the physical domain can be represented as a single box.

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::printClassData ( std::ostream &  stream  )  const [virtual]

Print object data to the specified output stream.

Reimplemented in SAMRAI::xfer::Geometry< DIM >, SAMRAI::geom::CartesianGridGeometry< DIM >, SAMRAI::geom::BlockGridGeometry< DIM >, and SAMRAI::geom::SkeletonGridGeometry< DIM >.

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::initializePeriodicShift ( const IntVector< DIM > &  directions  ) 

Initialize the periodic shift on the coarsest level. The IntVector argument should be set to 1 for periodic directions and 0 for all other directions. The shift will be calculated to be the number of cells in the periodic direction and zero in all other directions.

template<int DIM>
IntVector< DIM > SAMRAI::hier::GridGeometry< DIM >::getPeriodicShift ( const IntVector< DIM > &  ratio_to_level_zero = IntVector< DIM >(1)  )  const

Return IntVector<DIM> containing the periodic shift in each direction for a domain represented by a refinement of the reference physical domain (i.e. level zero) by the given ratio vector. tbox::Array entries will be zero for non-periodic directions. By default (i.e., when no argument is passed, the function returns the periodic shift for level zero in the hierarchy.

template<int DIM>
hier::IntVector< DIM > SAMRAI::hier::GridGeometry< DIM >::computeMaxGhostWidth ( tbox::Pointer< PatchDescriptor< DIM > >  descriptor  ) 

Compute the maximum ghost width of all of the components associated with the patch descriptor.

Calculates the maximum ghost width for all the variables associated with the patch descriptor. This must only be called after all of the variables have been registered with the VariableDatabase. If a variable is added that changes the maximum ghost width, then an assertion failure will result.

template<int DIM>
virtual tbox::Pointer<hier::GridGeometry<DIM> > SAMRAI::hier::GridGeometry< DIM >::makeRefinedGridGeometry ( const std::string &  fine_geom_name,
const hier::IntVector< DIM > &  refine_ratio,
bool  register_for_restart 
) const [pure virtual]

Pure virtual function to create and return a pointer to a refined version of this grid geometry object.

Implemented in SAMRAI::geom::CartesianGridGeometry< DIM >, SAMRAI::geom::BlockGridGeometry< DIM >, and SAMRAI::geom::SkeletonGridGeometry< DIM >.

template<int DIM>
virtual tbox::Pointer<hier::GridGeometry<DIM> > SAMRAI::hier::GridGeometry< DIM >::makeCoarsenedGridGeometry ( const std::string &  coarse_geom_name,
const hier::IntVector< DIM > &  coarsen_ratio,
bool  register_for_restart 
) const [pure virtual]

Pure virtual function to create and return a pointer to a coarsened version of this grid geometry object.

Implemented in SAMRAI::geom::CartesianGridGeometry< DIM >, SAMRAI::geom::BlockGridGeometry< DIM >, and SAMRAI::geom::SkeletonGridGeometry< DIM >.

template<int DIM>
virtual void SAMRAI::hier::GridGeometry< DIM >::setGeometryDataOnPatch ( hier::Patch< DIM > &  patch,
const hier::IntVector< DIM > &  ratio_to_level_zero,
const tbox::Array< tbox::Array< bool > > &  touches_regular_bdry,
const tbox::Array< tbox::Array< bool > > &  touches_periodic_bdry 
) const [pure virtual]

Implemented in SAMRAI::geom::CartesianGridGeometry< DIM >, SAMRAI::geom::BlockGridGeometry< DIM >, and SAMRAI::geom::SkeletonGridGeometry< DIM >.

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::computeBoundaryBoxesOnLevel ( tbox::Array< BoundaryBox< DIM > >  boundaries[],
const PatchLevel< DIM > &  level,
const IntVector< DIM > &  periodic_shift,
const IntVector< DIM > &  ghost_width,
const BoxArray< DIM > &  domain,
bool  do_all_patches = false 
) const

Compute boundary boxes for each patch in patch level and assign them to the array of boundary box arrays, assumed to be of length DIM * (num patches).

The DIM arrays of boundary boxes for each patch will be stored in groups of DIM. For example, in 3d with n patches on the level, the array For example, in 3d with n patches on the level, the array of boundary box arrays will be ordered as follows:

    * (patch 0 face array, patch 0 edge array, patch 0 node array,
    *  patch 1 face array, patch 1 edge array, patch 1 node array, . . . ,
    *  patch n-1 face array, patch n-1 edge array, patch n-1 node array)
    * 

The optional argument do_all_patches defaults to false, in which case the boundary box computation is executed only on patches that touch a non-periodic boundary. When this routine is called during patch level construction to describe a physical boundary, it is known that only patches that touch a non-periodic boundary will have non-empty sets of boundary boxes, so for efficiency's sake the boundary box box computation is supressed for all other patches. When this routine is called to create boundary boxes that describe a coarse-fine boundary, the computation must occur for every patch, so do_all_patches mush be set to true.

Parameters:
boundaries output boundary description
level level on which to generate boundaries
periodic_shift periodic shift for the level (see getPeriodicShift)
ghost_width ghost width to compute geometry for
domain Physical domain (in index space of level) for computing boundary boxes.
do_all_patches Execute boundary box computation on all patches, even those known to not touch a boundary

template<int DIM>
void SAMRAI::hier::GridGeometry< DIM >::getBoundaryBoxes ( tbox::Array< BoundaryBox< DIM > >  boundaries[DIM],
const Box< DIM > &  box,
const BoxArray< DIM > &  domain_boxes,
const IntVector< DIM > &  ghosts,
const IntVector< DIM > &  periodic_shift 
) const

Compute boundary boxes for patch.

Decompose patch boundary region into pieces depending on spatial dim. Boxes are extended along the boundary to the edge of the ghost layer if necessary.


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