Class GridUnit implements a block with uniform workload of the computational Grid. More...
#include <GridUnit.h>
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 dMapIndex & | guBaseIndex (void) const |
dMapIndex | guTopIndex (const int lev) const |
dMapIndex | guMaxIndex (const int lev) const |
const BBox & | guBBox () 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 &) |
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.
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 | |||
) |
GridUnit::GridUnit | ( | GridUnit const & | other | ) | [inline] |
GridUnit::~GridUnit | ( | void | ) | [inline] |
const dMapIndex& GridUnit::guBaseIndex | ( | void | ) | const [inline] |
References baseindex.
Referenced by GridUnitList::decompose(), GridUnitList::operator+(), GridUnitList::operator-(), and operator<<().
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 |
References BBox::_empty_bbox, baseindex, coarsen(), crslev, BBox::empty(), fbb, finelev, grow(), and growupperbydim().
BBox GridUnit::guBBox | ( | const int | lev, | |
const short * | olap, | |||
const int | extgh = 0 | |||
) | const |
References BBox::_empty_bbox, baseindex, coarsen(), crslev, BBox::empty(), fbb, finelev, grow(), growupperbydim(), and refine().
BBox GridUnit::guBBox | ( | const int | lev, | |
const int | olap = 0 , |
|||
const int | extgh = 0 | |||
) | const |
References BBox::_empty_bbox, baseindex, coarsen(), crslev, BBox::empty(), fbb, finelev, grow(), growupper(), and refine().
const BBox& GridUnit::guBBox | ( | ) | const [inline] |
BBox GridUnit::guBBoxAbs | ( | const int | lev, | |
const short * | olap, | |||
const int | extgh = 0 | |||
) | const |
References BBox::_empty_bbox, baseindex, coarsen(), BBox::empty(), fbb, finelev, grow(), growupperbydim(), and refine().
BBox GridUnit::guBBoxAbs | ( | const int | lev, | |
const int | olap = 0 , |
|||
const int | extgh = 0 | |||
) | const |
References BBox::_empty_bbox, baseindex, coarsen(), BBox::empty(), fbb, finelev, grow(), growupper(), and refine().
Referenced by GridUnitList::bboxlist().
void GridUnit::guCoarsen | ( | GridUnit & | gu, | |
const int | levs = 1 | |||
) |
void GridUnit::guCoarsen | ( | const int | levs = 1 |
) |
int GridUnit::guContains | ( | const int | minlev, | |
const int | maxlev | |||
) | const [inline] |
References crslev.
int GridUnit::guContains | ( | const int | lev | ) | const [inline] |
References crslev.
Referenced by GridUnitList::bboxlist(), GridUnitList::levellist(), and GridUnitList::lowest().
int GridUnit::guCrsLev | ( | void | ) | const [inline] |
References crslev.
Referenced by GridHierarchy::DAGH_CreateGridUnitList(), and GridUnitList::levellist().
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] |
References crslev, extent, and finelev.
Referenced by GridHierarchy::DAGH_CreateGridUnitList(), GridUnitList::GridUnitList(), operator<<(), GridUnitList::refinelist(), and GridUnitList::refinethislist().
int GridUnit::guExtentAbs | ( | const int | lev | ) | const [inline] |
References extent, and finelev.
Referenced by GridUnitList::refinelist(), GridUnitList::refinethislist(), and GridUnitList::smallest().
int GridUnit::guFineLev | ( | void | ) | const [inline] |
References finelev.
Referenced by GridUnitList::bboxlistfinest(), GridUnitList::levellist(), GridUnitList::operator*=(), and GridUnitList::refinethislist().
void GridUnit::guGetLevels | ( | GridUnit & | gu, | |
const int | lev | |||
) | const |
void GridUnit::guGetLevels | ( | GridUnit **& | gu | ) | const |
int GridUnit::guIndex | ( | void | ) | const [inline] |
References index.
int GridUnit::guInside | ( | const BBox & | bbox, | |
const int | lev | |||
) | const |
References baseindex, crslev, extent, finelev, and BBox::inside().
int GridUnit::guLevels | ( | void | ) | const [inline] |
References levstep, maxlev, and minlev.
Referenced by GridUnitList::GridUnitList(), and GridUnitList::levels().
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 |
) |
void GridUnit::guSetCoarsen | ( | GridUnit & | gu, | |
const int | levs = 1 | |||
) | [inline] |
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] |
References baselev, crslev, extent, and finelev.
Referenced by GridUnitList::levelarray(), and GridUnitList::levellist().
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] |
void GridUnit::guSetWorkload | ( | const int | w | ) | [inline] |
References work.
Referenced by GridHierarchy::DAGH_CreateGridUnitList(), guDecompose(), guDecomposeReplicate(), guGetLevels(), and guSetDecompose().
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.
int GridUnit::operator== | ( | GridUnit const & | other | ) | const |
int GridUnit::operator>= | ( | GridUnit const & | other | ) | const |
References baseindex, crslev, guMaxIndex(), and rank.
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] |
dMapIndex GridUnit::baseindex [protected] |
Index corresponding to the smallest sfcIndex in the GridUnit.
Referenced by GridUnit(), guBaseIndex(), guBBox(), guBBoxAbs(), guCoarsen(), guDecompose(), guDecomposeReplicate(), guGetLevels(), guInside(), guMaxIndex(), guRefine(), guSetDecompose(), guTopIndex(), GridUnitList::lowest(), operator<=(), operator=(), operator==(), and operator>=().
short int GridUnit::baselev [protected] |
Max level within which this grid unit is completely contained.
Referenced by GridUnitList::GridUnitList(), guBaseLev(), guCoarsen(), guDecompose(), guDecomposeReplicate(), guGetLevels(), guRefine(), guSetCoarsen(), guSetDecompose(), guSetLevels(), guSetRefine(), guSetRefineLevel(), GridUnitList::highestbaselevel(), GridUnitList::operator*(), GridUnitList::operator*=(), GridUnitList::operator+(), GridUnitList::operator-(), GridUnitList::operator-=(), operator<<(), and operator=().
short int GridUnit::crslev [protected] |
Level of the coarsest grid.
Referenced by GridUnit(), GridUnitList::GridUnitList(), guBBox(), guCoarsen(), guContains(), guCrsLev(), guDecompose(), guDecomposeReplicate(), guExtent(), guGetLevels(), guInside(), guNumLev(), guRefine(), guSetLevels(), guSetRefineLevel(), GridUnitList::levelarray(), operator<<(), operator<=(), operator=(), and operator>=().
short int GridUnit::extent [protected] |
Extent of the finest level i.e.
level crslev+numlev-1
Referenced by GridUnitList::decompose(), guCoarsen(), guDecompose(), guDecomposeReplicate(), guExtent(), guExtentAbs(), guGetLevels(), guInside(), guMaxIndex(), guRefine(), guSetCoarsen(), guSetDecompose(), guSetLevels(), guSetRefine(), guSetRefineLevel(), guTopIndex(), operator<<(), operator=(), and operator==().
BBox GridUnit::fbb [protected] |
BBox at finest level.
Referenced by guBBox(), guBBoxAbs(), and operator=().
short int GridUnit::finelev [protected] |
Level of the finest grid.
Referenced by GridUnitList::finest(), guBBox(), guBBoxAbs(), guCoarsen(), guDecompose(), guDecomposeReplicate(), guExtent(), guExtentAbs(), guFineLev(), guGetLevels(), guInside(), guMaxIndex(), guNumLev(), guRefine(), guSetCoarsen(), guSetLevels(), guSetRefine(), guSetRefineLevel(), guTopIndex(), operator<<(), operator=(), and operator==().
short int GridUnit::index [protected] |
My Index.
Referenced by guCoarsen(), guGetLevels(), guIndex(), guRefine(), GridUnitList::lowest(), GridUnitList::maxindex(), operator<<(), and operator=().
short int GridUnit::levstep [protected] |
Refinement Factor - power of two - default is 1.
Referenced by GridUnitList::decompose(), guCoarsen(), guDecompose(), guDecomposeReplicate(), guGetLevels(), guLevels(), guLevIndex(), guLevStep(), guNumLev(), guRefine(), guSetCoarsen(), guSetRefine(), guSetRefineLevel(), GridUnitList::levelarray(), operator<<(), and operator=().
short int GridUnit::maxlev [protected] |
Max possible level of refinement.
Referenced by guCoarsen(), guGetLevels(), guLevels(), guMaxLev(), guRefine(), operator<<(), and operator=().
short int GridUnit::minlev [protected] |
Min possible level of refinement.
Referenced by guCoarsen(), guGetLevels(), guLevels(), guLevIndex(), guMinLev(), guRefine(), operator=(), GridUnitList::refinelist(), and GridUnitList::refinethislist().
short int GridUnit::owner [protected] |
My Owner.
Referenced by guCoarsen(), guGetLevels(), guOwner(), guRefine(), guSetOwner(), GridUnitList::lowest(), operator<<(), operator=(), and GridUnitList::setowner().
short int GridUnit::rank [protected] |
Grid dimension.
Referenced by guCoarsen(), guGetLevels(), guRank(), guRefine(), operator<<(), operator<=(), operator=(), 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=().