GridUnit Class Reference

Class GridUnit implements a block with uniform workload of the computational Grid. More...

#include <GridUnit.h>

List of all members.

Public Member Functions

 GridUnit (void)
 Constructors, Destructor.
 GridUnit (const int nrank, const int clev, const int *bcoords, const int ext, const int mlev, const int lstep, const int reflev)
 Constructor with baseindex specified as coordinates/ph-index.
 GridUnit (const int nrank, const int clev, const int bindex, const int ext, const int mlev, const int lstep, const int reflev)
 GridUnit (GridUnit const &other)
 ~GridUnit (void)
GridUnit const & operator= (GridUnit const &other)
int guOwner (void) const
 Simple Query funtions.
int guIndex (void) const
int guRank (void) const
int guBaseLev (void) const
int guFineLev (void) const
int guCrsLev (void) const
int guNumLev (void) const
int guMaxLev (void) const
int guMinLev (void) const
int guLevStep (void) const
int guLevels (void) const
int guExtent (const int lev) const
int guExtentAbs (const int lev) const
void guSetWorkload (const int w)
unsigned long guNum (const int overlap) const
unsigned long guWork (const int overlap) const
unsigned long guNum (const int lev, const int overlap) const
unsigned long guWork (const int lev, const int overlap) const
unsigned long guNum (const short *overlap) const
unsigned long guWork (const short *overlap) const
unsigned long guNum (const int lev, const short *overlap) const
unsigned long guWork (const int lev, const short *overlap) const
int guContains (const int lev) const
int guContains (const int minlev, const int maxlev) const
int guLevIndex (const int lev) const
void guSetOwner (const int p)
const dMapIndexguBaseIndex (void) const
dMapIndex guTopIndex (const int lev) const
dMapIndex guMaxIndex (const int lev) const
const BBoxguBBox () const
BBox guBBox (const int lev, const int olap=0, const int extgh=0) const
BBox guBBoxAbs (const int lev, const int olap=0, const int extgh=0) const
BBox guBBox (const int lev, const short *olap, const int extgh=0) const
BBox guBBoxAbs (const int lev, const short *olap, const int extgh=0) const
BBox guBBox (const int minl, const int maxl, const short *olap, const int extgh=0) const
int guInside (const BBox &bbox, const int lev) const
int operator== (GridUnit const &other) const
 GridUnit domain calculus.
int operator>= (GridUnit const &other) const
int operator<= (GridUnit const &other) const
void guRefine (const int levs=1)
 Refines the GridUnit by "levs" levels.
void guRefine (GridUnit &gu, const int levs=1)
void guCoarsen (const int levs=1)
 corsens the GridUnit by "levs" levels.
void guCoarsen (GridUnit &gu, const int levs=1)
void guDecompose (GridUnit **&gu, int &cnt, const int levs=1) const
 Decomposes the GridUnit into an array of (Base)^rank*lev GridUnits with extent = extent-lev; i.e.
void guDecomposeReplicate (GridUnit **&gu, int &cnt, const int minext, const int levs=1) const
 If the new extent at any level is less than the "minext", that level is replicated across the grid units with the first GridUnit as the owner.
void guGetLevels (GridUnit **&gu) const
 Returns the GridUnits's at different levels of the composite GridUnit as an array.
void guGetLevels (GridUnit &gu, const int lev) const
void guSetDecompose (GridUnit &gu, const int lev, const int cnt)
 Static function to update a copy of this GridUnit.
void guSetLevels (GridUnit &gu, const int lev)
void guSetRefineLevel (GridUnit &gu, const int levs=1)
void guSetCoarsen (GridUnit &gu, const int levs=1)
void guSetRefine (GridUnit &gu, const int levs=1)

Protected Attributes

short int owner
 My Owner.
short int index
 My Index.
short int rank
 Grid dimension.
short int baselev
 Max level within which this grid unit is completely contained.
short int crslev
 Level of the coarsest grid.
short int finelev
 Level of the finest grid.
short int maxlev
 Max possible level of refinement.
short int minlev
 Min possible level of refinement.
short int levstep
 Refinement Factor - power of two - default is 1.
short int extent
 Extent of the finest level i.e.
int work
 The workload.
dMapIndex baseindex
 Index corresponding to the smallest sfcIndex in the GridUnit.
BBox fbb
 BBox at finest level.

Friends

class GridUnitList
std::ostream & operator<< (std::ostream &, const GridUnit &)
std::ofstream & operator<< (std::ofstream &, const GridUnit &)
std::ifstream & operator>> (std::ifstream &, GridUnit &)
std::stringstream & operator<< (std::stringstream &, const GridUnit &)
std::stringstream & operator>> (std::stringstream &, GridUnit &)

Detailed Description

Class GridUnit implements a block with uniform workload of the computational Grid.

The unit is identified by is position (baseindex) and it's size (extent) at a particular level. A GridUnit can be refined or coarsened or can be decomposed into GridUnits of smaller extent. Note, that each levels corresponds to one power of the base and not to a refinement level. For a given base, and extent at a level, the size of the GridUnit at the level is (base)^(rank*extent). Thus the size of the GridUnit is limited to powers of the base. Note that, a uniform block of a single level of the Grid can also be represented (as a special case) by GridUnit. GridUnit class provides a member function to query the baseindices of neighboring GridUnits at different levels.

Author:
Manish Parashar, Ralf Deiterding (workload stored explicitely)

Constructor & Destructor Documentation

GridUnit::GridUnit ( void   )  [inline]

Constructors, Destructor.

Referenced by guDecompose(), guDecomposeReplicate(), and guGetLevels().

GridUnit::GridUnit ( const int  nrank,
const int  clev,
const int *  bcoords,
const int  ext,
const int  mlev,
const int  lstep,
const int  reflev 
)

Constructor with baseindex specified as coordinates/ph-index.

Uses the Map/Invert of baseindex to generate the associted sfc mapping. The extent of GridUnit is specified in terms of levels such that number of elements = base^(rank*extent). Note that the extent referers to the topmost level; num is the sum of the elements at all numlev levels; and baselev is the base level grid. An initial refinement of reflev leval can be specified - in which case numlev is set to reflev and num and extent are accordingly updated.

References baseindex.

GridUnit::GridUnit ( const int  nrank,
const int  clev,
const int  bindex,
const int  ext,
const int  mlev,
const int  lstep,
const int  reflev 
)

References baseindex, and crslev.

GridUnit::GridUnit ( GridUnit const &  other  )  [inline]
GridUnit::~GridUnit ( void   )  [inline]

Member Function Documentation

const dMapIndex& GridUnit::guBaseIndex ( void   )  const [inline]
int GridUnit::guBaseLev ( void   )  const [inline]

References baselev.

BBox GridUnit::guBBox ( const int  minl,
const int  maxl,
const short *  olap,
const int  extgh = 0 
) const
BBox GridUnit::guBBox ( const int  lev,
const short *  olap,
const int  extgh = 0 
) const
BBox GridUnit::guBBox ( const int  lev,
const int  olap = 0,
const int  extgh = 0 
) const
BBox GridUnit::guBBoxAbs ( const int  lev,
const short *  olap,
const int  extgh = 0 
) const
BBox GridUnit::guBBoxAbs ( const int  lev,
const int  olap = 0,
const int  extgh = 0 
) const
void GridUnit::guCoarsen ( GridUnit gu,
const int  levs = 1 
)
void GridUnit::guCoarsen ( const int  levs = 1  ) 

corsens the GridUnit by "levs" levels.

The grid extent level is decremented by "levs"; i.e. the GridUnit contains (Base)^rank*(extlev-levs) points.

References baselev, crslev, extent, finelev, and levstep.

Referenced by GridUnitList::refinethislist().

int GridUnit::guContains ( const int  minlev,
const int  maxlev 
) const [inline]

References crslev.

int GridUnit::guContains ( const int  lev  )  const [inline]
int GridUnit::guCrsLev ( void   )  const [inline]
void GridUnit::guDecompose ( GridUnit **&  gu,
int &  cnt,
const int  levs = 1 
) const

Decomposes the GridUnit into an array of (Base)^rank*lev GridUnits with extent = extent-lev; i.e.

(Base)^rank*(extlev-lev) points.

References baseindex, baselev, crslev, extent, finelev, GridUnit(), guSetWorkload(), levstep, and work.

void GridUnit::guDecomposeReplicate ( GridUnit **&  gu,
int &  cnt,
const int  minext,
const int  levs = 1 
) const

If the new extent at any level is less than the "minext", that level is replicated across the grid units with the first GridUnit as the owner.

References baseindex, baselev, crslev, extent, finelev, GridUnit(), guSetWorkload(), levstep, and work.

int GridUnit::guExtent ( const int  lev  )  const [inline]
int GridUnit::guExtentAbs ( const int  lev  )  const [inline]
int GridUnit::guFineLev ( void   )  const [inline]
void GridUnit::guGetLevels ( GridUnit gu,
const int  lev 
) const
void GridUnit::guGetLevels ( GridUnit **&  gu  )  const

Returns the GridUnits's at different levels of the composite GridUnit as an array.

The returned array is of dimension maxlev-crslev. The undefined levels are (GridUnit *) 0.

References crslev, extent, finelev, GridUnit(), guSetWorkload(), levstep, maxlev, minlev, and work.

int GridUnit::guIndex ( void   )  const [inline]

References index.

int GridUnit::guInside ( const BBox bbox,
const int  lev 
) const
int GridUnit::guLevels ( void   )  const [inline]
int GridUnit::guLevIndex ( const int  lev  )  const [inline]

References levstep, and minlev.

Referenced by GridUnitList::levelarray().

int GridUnit::guLevStep ( void   )  const [inline]

References levstep.

Referenced by GridUnitList::refinethislist().

dMapIndex GridUnit::guMaxIndex ( const int  lev  )  const

References baseindex, extent, and finelev.

Referenced by operator<<(), operator<=(), and operator>=().

int GridUnit::guMaxLev ( void   )  const [inline]

References maxlev.

int GridUnit::guMinLev ( void   )  const [inline]

References minlev.

unsigned long GridUnit::guNum ( const int  lev,
const short *  overlap 
) const [inline]

References work.

unsigned long GridUnit::guNum ( const short *  overlap  )  const [inline]

References work.

unsigned long GridUnit::guNum ( const int  lev,
const int  overlap 
) const [inline]

References work.

unsigned long GridUnit::guNum ( const int  overlap  )  const [inline]

References work.

Referenced by GridUnitList::numelems(), and operator<<().

int GridUnit::guNumLev ( void   )  const [inline]

References crslev, finelev, and levstep.

Referenced by operator<<().

int GridUnit::guOwner ( void   )  const [inline]

Simple Query funtions.

References owner.

int GridUnit::guRank ( void   )  const [inline]

References rank.

void GridUnit::guRefine ( GridUnit gu,
const int  levs = 1 
)
void GridUnit::guRefine ( const int  levs = 1  ) 

Refines the GridUnit by "levs" levels.

The grid extent level is incremented by "levs"; i.e. the GridUnit contains (Base)^rank*(extlev+levs) points.

References baselev, extent, finelev, levstep, and maxlev.

void GridUnit::guSetCoarsen ( GridUnit gu,
const int  levs = 1 
) [inline]

References baselev, extent, finelev, and levstep.

void GridUnit::guSetDecompose ( GridUnit gu,
const int  lev,
const int  cnt 
) [inline]

Static function to update a copy of this GridUnit.

References baseindex, baselev, extent, guSetWorkload(), and guWork().

Referenced by GridUnitList::decompose().

void GridUnit::guSetLevels ( GridUnit gu,
const int  lev 
) [inline]
void GridUnit::guSetOwner ( const int  p  )  [inline]

References owner.

void GridUnit::guSetRefine ( GridUnit gu,
const int  levs = 1 
) [inline]

References baselev, extent, finelev, and levstep.

Referenced by GridUnitList::refinelist().

void GridUnit::guSetRefineLevel ( GridUnit gu,
const int  levs = 1 
) [inline]

References baselev, crslev, extent, finelev, and levstep.

void GridUnit::guSetWorkload ( const int  w  )  [inline]
dMapIndex GridUnit::guTopIndex ( const int  lev  )  const

References baseindex, extent, and finelev.

Referenced by operator<<().

unsigned long GridUnit::guWork ( const int  lev,
const short *  overlap 
) const [inline]

References work.

unsigned long GridUnit::guWork ( const short *  overlap  )  const [inline]

References work.

unsigned long GridUnit::guWork ( const int  lev,
const int  overlap 
) const [inline]

References work.

unsigned long GridUnit::guWork ( const int  overlap  )  const [inline]

References work.

Referenced by guSetDecompose(), GridUnitList::load(), and operator<<().

int GridUnit::operator<= ( GridUnit const &  other  )  const

References baseindex, crslev, guMaxIndex(), and rank.

GridUnit const & GridUnit::operator= ( GridUnit const &  other  ) 
int GridUnit::operator== ( GridUnit const &  other  )  const

GridUnit domain calculus.

References baseindex, extent, finelev, and rank.

int GridUnit::operator>= ( GridUnit const &  other  )  const

References baseindex, crslev, guMaxIndex(), and rank.


Friends And Related Function Documentation

friend class GridUnitList [friend]
std::stringstream& operator<< ( std::stringstream &  ofs,
const GridUnit gu 
) [friend]
std::ofstream& operator<< ( std::ofstream &  ofs,
const GridUnit gu 
) [friend]
std::ostream& operator<< ( std::ostream &  os,
const GridUnit gu 
) [friend]
std::stringstream& operator>> ( std::stringstream &  ifs,
GridUnit gu 
) [friend]
std::ifstream& operator>> ( std::ifstream &  ifs,
GridUnit gu 
) [friend]

Member Data Documentation

BBox GridUnit::fbb [protected]

BBox at finest level.

Referenced by guBBox(), guBBoxAbs(), and operator=().

short int GridUnit::maxlev [protected]

Max possible level of refinement.

Referenced by guCoarsen(), guGetLevels(), guLevels(), guMaxLev(), guRefine(), operator<<(), and operator=().

int GridUnit::work [protected]

The workload.

Assumed to be uniform.

Referenced by guCoarsen(), guDecompose(), guDecomposeReplicate(), guGetLevels(), guNum(), guRefine(), guSetWorkload(), guWork(), and operator=().


The documentation for this class was generated from the following files:
Generated on Thu Jun 30 02:19:00 2016 for AMROC's Hierachical Data Structures by  doxygen 1.6.3