AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

GridUnit.C

Go to the documentation of this file.
00001 
00006 #include "GridUnit.h"
00007 
00008 #ifdef DEBUG_PRINT
00009 #include "CommServer.h"
00010 #endif
00011 
00012 /*
00013 *************************************************************************
00014 *                                                                       *
00015 * GridUnit::GridUnit (...... )                                          *       
00016 *                                                                       *
00017 * Constructor with baseindex specified as coordinates/ph-index.         *
00018 * Uses the Map/Invert of baseindex to generate the associted sfc        *
00019 * mapping.                                                              *
00020 * The extent of GridUnit is specified in terms of levels such that      *
00021 * number of elements = base^(rank*extent). Note that the extent referers        *
00022 * to the topmost level; num is the sum of the elements at all numlev    *
00023 * levels; and baselev is the base level grid.                           *
00024 * An initial refinement of reflev leval can be specified - in which     *
00025 * case numlev is set to reflev and num and extent are accordingly       *
00026 * updated.                                                              *
00027 *                                                                       *
00028 *************************************************************************
00029 */
00030 
00031 GridUnit::GridUnit(const int ndim, const int clev, 
00032                    const int* bcoords, const int ext, const int mlev, 
00033                    const int lstep, const int reflev)
00034         : owner(DAGHNoBody), index(DAGHNull), rank(ndim), 
00035           baselev(clev-ext),
00036           crslev(clev), finelev(clev+(lstep*reflev)),
00037           maxlev(mlev), minlev(clev), levstep(lstep), 
00038           extent(ext+(lstep*reflev)), work(0),
00039           baseindex(ndim,mlev)
00040   {
00041 #ifdef DEBUG_PRINT
00042    assert(clev >= ext);
00043 #endif
00044    baseindex.Map(bcoords);
00045 #ifdef DEBUG_PRINT
00046    assert(clev > ext || baseindex.sfcGetIndex() == 0);
00047 #endif
00048    guSetBBox();
00049   }
00050 
00051 GridUnit::GridUnit(const int ndim, const int clev, 
00052                    const int bindex, const int ext, const int mlev, 
00053                    const int lstep, const int reflev)
00054         : owner(DAGHNoBody), index(DAGHNull), rank(ndim),
00055           baselev(clev-ext),
00056           crslev(clev), finelev(clev+(lstep*reflev)),
00057           maxlev(mlev), minlev(clev), levstep(lstep),
00058           extent(ext+(lstep*reflev)), work(0),
00059           baseindex(ndim,mlev)
00060   {
00061 #ifdef DEBUG_PRINT
00062    assert(clev > ext || bindex == 0);
00063 #endif
00064 #ifdef DEBUG_PRINT
00065    assert(bindex < baseindex.GetCardinality(crslev));
00066 #endif
00067    baseindex.SetIndex(bindex,crslev);
00068    guSetBBox();
00069   }
00070 
00071 // GridUnit::~GridUnit()
00072 // {}
00073 
00074 /*
00075 *************************************************************************
00076 *                                                                       *
00077 * GridUnit const &GridUnit::operator= (GridUnit const &other)           *
00078 *                                                                       *
00079 * Overload the assignment operator for GridUnit                         *
00080 *                                                                       *
00081 *************************************************************************
00082 */
00083 
00084 GridUnit const &GridUnit::operator= (GridUnit const &other)
00085   {
00086    if (this != &other)
00087      {
00088       owner = other.owner;
00089       index = other.index;
00090       rank = other.rank;
00091       baselev = other.baselev;
00092       crslev = other.crslev;
00093       finelev = other.finelev;
00094       maxlev = other.maxlev;
00095       minlev = other.minlev;
00096       levstep = other.levstep;
00097       extent = other.extent;
00098       work = other.work;
00099       baseindex = other.baseindex;
00100       fbb = other.fbb;
00101      }
00102    return(*this);
00103   }
00104 
00105 /*
00106 *************************************************************************
00107 *                                                                       *
00108 * QUERY Routines                                                        *
00109 *                                                                       *
00110 *************************************************************************
00111 */
00112 
00113 dMapIndex GridUnit::guMaxIndex(const int lev) const
00114   { 
00115     dMapIndex mi(baseindex);
00116     if (lev <= finelev)
00117       mi.SetMax(lev,extent-(finelev-lev));
00118     else
00119       mi.SetMax(lev,extent+(lev-finelev));
00120     return (mi);
00121   }
00122 
00123 dMapIndex GridUnit::guTopIndex(const int lev) const
00124   { 
00125     dMapIndex ti(baseindex);
00126     if (lev <= finelev)
00127       ti.SetBox(lev,extent-(finelev-lev));
00128     else
00129       ti.SetBox(lev,extent+(lev-finelev));
00130     return (ti);
00131   }
00132 
00133 void GridUnit::guLCoords(int *c, const int lev) const
00134   { 
00135     baseindex.GetCoords(c,lev);  
00136   }
00137 
00138 Coords GridUnit::guLCoords(const int lev) const
00139   { 
00140     Coords coords(rank,0);
00141     baseindex.GetCoords(coords(),lev); 
00142     return (coords);
00143   }
00144 
00145 void GridUnit::guUCoords(int *c, const int lev) const
00146   { 
00147     dMapIndex ti(baseindex); ti.SetBox(lev,guExtentAbs(lev));
00148     ti.GetCoords(c,lev);
00149   }
00150 
00151 Coords GridUnit::guUCoords(const int lev) const
00152   { 
00153     dMapIndex ti(baseindex); ti.SetBox(lev,guExtentAbs(lev));
00154     Coords coords(rank,0);
00155     ti.GetCoords(coords(),lev);
00156     return (coords);
00157   }
00158 
00159 /*
00160 *************************************************************************
00161 *                                                                       *
00162 * int GridUnit::operator== (GridUnit const &other)                      *
00163 * int GridUnit::operator>= (GridUnit const &other)                      *
00164 * int GridUnit::operator<= (GridUnit const &other)                      *
00165 *                                                                       *
00166 * GridUnit domain calculus.....                                         *
00167 *                                                                       *
00168 *************************************************************************
00169 */
00170 
00171 int GridUnit::operator== (GridUnit const &other) const
00172   {
00173    if (this == &other) return 1;
00174 
00175    else if (
00176         rank == other.rank && baseindex == other.baseindex &&
00177         (finelev-other.finelev == extent-other.extent)
00178         ) return 1;
00179 
00180    else return 0;
00181   }
00182 
00183 int GridUnit::operator<= (GridUnit const &other) const
00184   {
00185    if (this == &other) return 1;
00186    else if (rank == other.rank && other.baseindex <= baseindex) 
00187     {
00188      if (other.guMaxIndex(crslev) >= guMaxIndex(crslev)) { return 1; }
00189      else { return 0; }
00190     }
00191    else return 0;
00192   }
00193 
00194 int GridUnit::operator>= (GridUnit const &other) const
00195   {
00196    if (this == &other) return 1;
00197    else if (rank == other.rank && other.baseindex >= baseindex) 
00198     {
00199      if (other.guMaxIndex(crslev) <= guMaxIndex(crslev)) { return 1; }
00200      else { return 0; }
00201     }
00202    else return 0;
00203   }
00204 
00205 /*
00206 *************************************************************************
00207 *                                                                       *
00208 * BBOX QUERY Routines                                                        *
00209 *                                                                       *
00210 *************************************************************************
00211 */
00212 void GridUnit::guSetBBox()
00213 {
00214   register int step = baseindex.GetDimCardinality(finelev);
00215   Coords lc(guLCoords(finelev));
00216   Coords uc(guUCoords(finelev));
00217   fbb = BBox (lc.getmin(uc),uc.getmax(lc),step);
00218 }
00219 
00220 
00221 BBox GridUnit::guBBoxAbs(const int lev, const int olap, 
00222                          const int extgh) const
00223 {
00224  if (fbb.empty()) 
00225    return (BBox::_empty_bbox);
00226  else  if (lev == finelev)
00227    return ( (olap==0 && extgh==0) ? fbb : 
00228             (extgh==0) ? growupper(fbb,olap) :
00229                          grow(growupper(fbb,olap),extgh) );
00230  else if (lev < finelev) 
00231    return ( (olap==0 && extgh==0) ? 
00232             coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00233             (extgh==0) ? 
00234             growupper(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00235                       olap) :
00236             grow(growupper(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00237                            olap), extgh) );
00238  else if (lev > finelev)
00239    return ( (olap==0 && extgh==0) ? 
00240             refine(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00241             (extgh==0) ? 
00242             growupper(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00243                       olap) :
00244             grow(growupper(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00245                            olap),extgh) );
00246  else
00247     return (BBox::_empty_bbox);
00248 }
00249 
00250 BBox GridUnit::guBBoxAbs(const int lev, const short* olap, 
00251                          const int extgh) const
00252 {
00253  if (fbb.empty()) 
00254    return (BBox::_empty_bbox);
00255  else  if (lev == finelev)
00256    return ( (olap==0 && extgh==0) ? fbb : 
00257             (extgh==0) ? growupperbydim(fbb,olap) :
00258                          grow(growupperbydim(fbb,olap),extgh) );
00259  else if (lev < finelev) 
00260    return ( (olap==0 && extgh==0) ? 
00261             coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00262             (extgh==0) ? 
00263             growupperbydim(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00264                            olap) :
00265             grow(growupperbydim(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00266                                 olap), extgh) );
00267  else if (lev > finelev)
00268    return ( (olap==0 && extgh==0) ? 
00269             refine(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00270             (extgh==0) ? 
00271             growupperbydim(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00272                            olap) :
00273             grow(growupperbydim(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00274                                 olap),extgh) );
00275  else
00276    return (BBox::_empty_bbox);
00277 }
00278 
00279 BBox GridUnit::guBBox(const int lev, const int olap,
00280                       const int extgh) const
00281 {
00282  if (fbb.empty() || lev > finelev || lev < crslev)
00283    return (BBox::_empty_bbox);
00284  else if (lev == finelev)
00285      return ( (olap==0 && extgh==0) ? fbb : 
00286             (extgh==0) ? growupper(fbb,olap) :
00287                          grow(growupper(fbb,olap),extgh) );
00288  else if (lev < finelev)
00289    return ( (olap==0 && extgh==0) ? 
00290             coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00291             (extgh==0) ? 
00292             growupper(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00293                       olap) :
00294             grow(growupper(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00295                            olap),extgh) );
00296  else if (lev > finelev)
00297    return ( (olap==0 && extgh==0) ? 
00298             refine(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00299             (extgh==0) ? 
00300             growupper(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00301                       olap) :
00302             grow(growupper(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00303                            olap),extgh) );
00304  else
00305    return (BBox::_empty_bbox);
00306 }
00307 
00308 BBox GridUnit::guBBox(const int lev, const short* olap,
00309                       const int extgh) const
00310 { 
00311  if (fbb.empty() || lev > finelev || lev < crslev) 
00312    return (BBox::_empty_bbox);
00313  else if (lev == finelev)
00314      return ( (olap==0 && extgh==0) ? fbb : 
00315             (extgh==0) ? growupperbydim(fbb,olap) :
00316                          grow(growupperbydim(fbb,olap),extgh) );
00317  else if (lev < finelev)
00318    return ( (olap==0 && extgh==0) ? 
00319             coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00320             (extgh==0) ? 
00321             growupperbydim(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00322                            olap) :
00323             grow(growupperbydim(coarsen(fbb,baseindex.GetCardinality(1,finelev-lev)),
00324                                 olap),extgh) );
00325  else if (lev > finelev)
00326    return ( (olap==0 && extgh==0) ? 
00327             refine(fbb,baseindex.GetCardinality(1,finelev-lev)) : 
00328             (extgh==0) ? 
00329             growupperbydim(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00330                            olap) :
00331             grow(growupperbydim(refine(fbb,baseindex.GetCardinality(1,finelev-lev)),
00332                                 olap),extgh) );
00333  else
00334    return (BBox::_empty_bbox);
00335 }
00336 
00337 BBox GridUnit::guBBox(const int minl, const int maxl, 
00338                       const short* olap, const int extgh) const 
00339 {
00340  if (fbb.empty() || minl > finelev || maxl < crslev)
00341    return (BBox::_empty_bbox);
00342  else if (maxl >= finelev)
00343      return ( (olap==0 && extgh==0) ? fbb : 
00344             (extgh==0) ? growupperbydim(fbb,olap) :
00345                          grow(growupperbydim(fbb,olap),extgh) );
00346  else if (maxl < finelev)
00347    return ( (olap==0 && extgh==0) ? 
00348             coarsen(fbb,baseindex.GetCardinality(1,finelev-maxl)) : 
00349             (extgh==0) ? 
00350             growupperbydim(coarsen(fbb,baseindex.GetCardinality(1,finelev-maxl)),
00351                            olap) :
00352             grow(growupperbydim(coarsen(fbb,baseindex.GetCardinality(1,finelev-maxl)),
00353                                 olap),extgh) );
00354  else
00355    return (BBox::_empty_bbox);
00356 }
00357 
00358 int GridUnit::guInside(const BBox& bbox, const int lev) const
00359   {
00360     if (lev>finelev || lev<crslev) return 0;
00361     Coords cu, cl;
00362     baseindex.GetCoords(cl(),lev); 
00363     dMapIndex ti(baseindex); ti.SetBox(lev,extent-(finelev-lev));
00364     ti.GetCoords(cu(),lev);
00365 
00366     if (bbox.inside(cl) && bbox.inside(cu))  {
00367       return 1; 
00368     }
00369     else { 
00370       return 0; 
00371     }
00372   }
00373 
00374 /*
00375 *************************************************************************
00376 *                                                                       *
00377 * void GridUnit::guRefine (const int levs)                              *       
00378 *                                                                       *
00379 * Member function guRefine refines the GridUnit by "levs" levels.       *
00380 * The grid extent level is incremented by "levs"; i.e. the GridUnit     *
00381 * contains (Base)^rank*(extlev+levs) points.                            *
00382 *                                                                       *
00383 *************************************************************************
00384 */
00385 
00386 void GridUnit::guRefine (const int levs)
00387   {
00388    const int levels = levs*levstep;
00389 #ifdef DEBUG_PRINT
00390    assert(finelev+levels <= maxlev);
00391 #endif
00392 
00393    extent += levels;
00394    finelev += levels;
00395    baselev = finelev-extent;
00396    guSetBBox();
00397   }
00398 
00399 void GridUnit::guRefine (GridUnit &gu, const int levs)
00400   {
00401    const int levels = levs*levstep;
00402 #ifdef DEBUG_PRINT
00403    assert(finelev+levels <= maxlev);
00404 #endif
00405 
00406    gu.owner = owner;
00407    gu.index = index;
00408    gu.rank = rank;
00409    gu.levstep = levstep;
00410    gu.maxlev = maxlev;
00411    gu.minlev = minlev;
00412    gu.work = work;
00413 
00414    gu.crslev = finelev+levstep;
00415    gu.finelev = finelev+levels;
00416    gu.extent = extent+levels; 
00417    gu.baselev = gu.finelev-gu.extent;
00418 
00419    gu.baseindex = baseindex;
00420    gu.guSetBBox();
00421   }
00422 
00423 /*
00424 *************************************************************************
00425 *                                                                       *
00426 * void GridUnit::guCoarsen (const int levs)                             *       
00427 *                                                                       *
00428 * Member function guCoarsen corsens the GridUnit by "levs" levels.      *
00429 * The grid extent level is decremented by "levs"; i.e. the GridUnit     *
00430 * contains (Base)^rank*(extlev-levs) points.                            *
00431 *                                                                       *
00432 *************************************************************************
00433 */
00434 
00435 void GridUnit::guCoarsen (const int levs)
00436   {
00437    const int levels = levs*levstep;
00438 #ifdef DEBUG_PRINT
00439    assert(finelev-levs >= crslev);
00440 #endif
00441 
00442    extent -= levels; 
00443    finelev -= levels;
00444    baselev = finelev-extent;
00445    guSetBBox();
00446   }
00447 
00448 void GridUnit::guCoarsen (GridUnit &gu, const int levs)
00449   {
00450    const int levels = levs*levstep;
00451 #ifdef DEBUG_PRINT
00452    assert(finelev-levs >= crslev);
00453 #endif
00454 
00455    gu.owner = owner;
00456    gu.index = index;
00457    gu.rank = rank;
00458    gu.levstep = levstep;
00459    gu.maxlev = maxlev;
00460    gu.minlev = minlev;
00461    gu.work = work;
00462 
00463    gu.crslev = crslev;
00464    gu.finelev = finelev-levels;
00465    gu.extent = extent-levels; 
00466    gu.baselev = gu.finelev-gu.extent;
00467 
00468    gu.baseindex = baseindex;
00469    gu.guSetBBox();
00470   }
00471 
00472 /*
00473 ****************************************************************************
00474 *                                                                          *
00475 * Member function guDecompose decomposes the GridUnit into an array of     *
00476 * (Base)^rank*lev GridUnits with extent = extent-lev;                      *
00477 * i.e. (Base)^rank*(extlev-lev) points.                                    *
00478 *                                                                          *
00479 ****************************************************************************
00480 */
00481 
00482 void GridUnit::guDecompose (GridUnit**& gu, int& cnt, 
00483                             const int lev) const
00484   {
00485    if (lev == 0) { cnt = 0; return; }
00486 #ifdef DEBUG_PRINT
00487    const int numlev = (finelev-crslev)/levstep + 1;
00488    assert(lev > 0 && lev <= extent-(numlev-1)*levstep);
00489 #endif
00490 
00491    cnt = baseindex.GetCardinality(lev);
00492    register unsigned newext = extent-lev;
00493    register unsigned newblev = baselev+lev;
00494 
00495    //if (gu) delete [] gu;
00496 #ifdef DEBUG_PRINT
00497    assert (!gu);
00498 #endif
00499    gu = new GridUnit *[cnt];
00500  
00501    for (int i=0;i<cnt;i++) {
00502      gu[i] = new GridUnit(*this);
00503      gu[i]->baselev = newblev;
00504      gu[i]->extent = newext;
00505 
00506      gu[i]->baseindex.SetIndex(i,newblev,lev);
00507      gu[i]->guSetWorkload(work/cnt);
00508      gu[i]->guSetBBox();
00509    }
00510   }
00511 
00512 /*
00513 ****************************************************************************
00514 *                                                                          *
00515 * Member function guDecomposeReplicate decomposes the GridUnit into an     *
00516 * array of (Base)^rank*lev GridUnits with extent = extent-lev;             *
00517 * i.e. (Base)^rank*(extlev-lev) points.                                    *
00518 * If the new extent at any level is less than the "minext", that level    *
00519 * is replicated across the grid units with the first GridUnit as the owner *
00520 *                                                                          *
00521 ****************************************************************************
00522 */
00523 
00524 void GridUnit::guDecomposeReplicate (GridUnit**& gu, int& cnt, 
00525                                      const int lev, 
00526                                      const int minext) const
00527   {
00528    if (lev == 0) { cnt = 0; return; }
00529 
00530    const int numlev = (finelev-crslev)/levstep + 1;
00531    int newcext = (extent-(numlev-1)*levstep) - lev;
00532 
00533    int newclev;
00534    if (newcext>=minext) newclev = crslev;
00535    else if ((minext-newcext)%levstep > 0)
00536      newclev = crslev + ((minext-newcext+levstep)/levstep)*levstep;
00537    else 
00538      newclev = crslev + minext-newcext;
00539 
00540    cnt = baseindex.GetCardinality(lev);
00541    register int newext = extent-lev;
00542    register int newblev = baselev+lev;
00543 
00544    //if (gu) delete [] gu;
00545 #ifdef DEBUG_PRINT
00546    assert (!gu);
00547 #endif
00548    gu = new GridUnit *[cnt];
00549  
00550    for (int i=0;i<cnt;i++) {
00551      gu[i] = new GridUnit(*this);
00552      gu[i]->baselev = newblev;
00553      gu[i]->extent = newext;
00554      gu[i]->baseindex.SetIndex(i,newblev,lev);
00555      if (i != 0)  {
00556        gu[i]->crslev = newclev;
00557      }
00558      gu[i]->guSetWorkload(work/cnt);
00559      gu[i]->guSetBBox();
00560    }
00561   }
00562 
00563 /*
00564 *************************************************************************
00565 *                                                                       *
00566 * GridUnit **GridUnit::guGetLevels(void) const                          *
00567 *                                                                       *
00568 * Member function guGetLevels returns the GridUnits's at different      *
00569 * levels of the composite GridUnit as an array.                         *
00570 * The returned array is of dimension maxlev-crslev. The undefined       *
00571 * levels are (GridUnit *) NULL.                                         *
00572 *                                                                       *
00573 *************************************************************************
00574 */
00575 
00576 void GridUnit::guGetLevels(GridUnit** &gu) const
00577   {
00578    //if (gu) delete [] gu;
00579 #ifdef DEBUG_PRINT
00580    assert (!gu);
00581 #endif
00582    gu = new GridUnit *[(maxlev-minlev)/levstep+1];
00583 
00584    const int numlev = (finelev-crslev)/levstep + 1;
00585    unsigned ext = extent-(numlev-1)*levstep;
00586 
00587    int offset = (minlev-crslev)/levstep;
00588    for (int i=0;i<numlev;i++) {
00589      gu[i+offset] = new GridUnit(*this);
00590      gu[i+offset]->crslev = (i*levstep)+crslev;
00591      gu[i+offset]->finelev = (i*levstep)+crslev;
00592      gu[i+offset]->extent = ext;
00593      gu[i+offset]->guSetWorkload(work);
00594      gu[i+offset]->guSetBBox();
00595      ext += levstep;
00596    }
00597   }
00598 
00599 void GridUnit::guGetLevels(GridUnit &gu, const int lev) const
00600   {
00601    register unsigned ext = extent-(finelev-lev);
00602 
00603    gu.owner = owner;
00604    gu.index = index;
00605    gu.rank = rank;
00606    gu.levstep = levstep;
00607    gu.maxlev = maxlev;
00608    gu.minlev = minlev;
00609    gu.work = work;
00610    gu.crslev = lev;
00611    gu.finelev = lev;
00612    gu.extent = ext;
00613 
00614    gu.baselev = gu.finelev-gu.extent;
00615    gu.baseindex = baseindex;
00616    gu.guSetBBox();
00617   }
00618 
00619 ostream&  operator << (ostream& os, const GridUnit& cgu)
00620   {
00621 
00622    if (&cgu == (GridUnit *)NULL) return os;
00623 
00624    GridUnit &gu = (GridUnit &) cgu;
00625 
00626    os << "Owner: " << gu.owner << " ";
00627    os << "Idx: " << gu.index << " ";
00628    os << "Rank: " << gu.rank<< " ";
00629    os << "Blev: " << gu.baselev << " ";
00630    os << "CLev: " << gu.crslev << " ";
00631    os << "Flev: " << gu.finelev << " ";
00632    os << "NLev: " << gu.guNumLev() << " ";
00633    os << "MLev: " << gu.maxlev << " ";
00634    os << "LStep: " << gu.levstep << " ";
00635    os << "Num: " << gu.guNum(0) << " ";
00636    os << "Work: " << gu.guWork(0) << " ";
00637    os << "Ext: " << gu.extent<< " ";
00638 
00639    for(int i=gu.crslev;i<=gu.finelev;i+=gu.levstep) {
00640      os <<  "\n";
00641      os << "Level " << i << ":";
00642      os << gu.guBBox(i) << " ";
00643      os << gu.guBaseIndex() << " ";
00644      os << gu.guTopIndex(i) << " ";
00645      os << gu.guMaxIndex(i) << " ";
00646      os << gu.guExtent(i) << " ";
00647      os << gu.guNum(i) << " ";
00648      os << gu.guWork(i) << " ";
00649      os <<  "\n";
00650    }
00651    return os;
00652   }
00653 
00654 ofstream&  operator << (ofstream& ofs, const GridUnit& gu)
00655   {
00656 
00657    if (&gu == (GridUnit *)NULL) return ofs;
00658 
00659    ofs.write((char*)&gu,sizeof(GridUnit));
00660 
00661    return ofs;
00662   }
00663 
00664 ifstream&  operator >> (ifstream& ifs, GridUnit& gu)
00665   {
00666 
00667    if (&gu == (GridUnit *)NULL) return ifs;
00668 
00669    ifs.read((char*)&gu,sizeof(GridUnit));
00670 
00671    return ifs;
00672   }
00673 
00674 strstream&  operator << (strstream& ofs, const GridUnit& gu)
00675   {
00676 
00677    if (&gu == (GridUnit *)NULL) return ofs;
00678 
00679    ofs.write((char*)&gu,sizeof(GridUnit));
00680 
00681    return ofs;
00682   }
00683 
00684 strstream&  operator >> (strstream& ifs, GridUnit& gu)
00685   {
00686 
00687    if (&gu == (GridUnit *)NULL) return ifs;
00688 
00689    ifs.read((char*)&gu,sizeof(GridUnit));
00690 
00691    return ifs;
00692   }


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 06/01/04