releasedExamples/AMRINS/util/Gradient.cpp
// simple little function to turn DBL->IVS in region around
// a given box.
simple little function to turn DBL->IVS in region around
a given box.
simple little function to turn DBL - > IVS in region around a given box .
void
Gradient::createGridIVS(IntVectSet& a_gridIVS,
                        const DisjointBoxLayout& a_grids,
                        const Box& a_localBox,
                        const int a_nGrow)
{
  LayoutIterator lit = a_grids.layoutIterator();
  if (!a_gridIVS.isEmpty())
    {
      a_gridIVS.makeEmpty();
    }
  Box checkBox(a_localBox);
  checkBox.grow(a_nGrow);
  bool done = false;
    for (lit.begin(); lit.ok() && !done; ++lit)
    {
      const Box& thisBox = a_grids.get(lit());
      Box intersectBox(thisBox);
      intersectBox &= checkBox;
      if (!intersectBox.isEmpty())
        {
          a_gridIVS |= intersectBox;
        }
      done = true;
      for (int dir=0; dir<SpaceDim; dir++)
        {
          Box lobox = adjCellLo(thisBox, dir, 1);
          Box hibox = adjCellHi(thisBox, dir, 1);
          lobox &= checkBox;
          hibox &= checkBox;
          if (!lobox.isEmpty())
            {
              a_gridIVS |= lobox;
            }
          if (!hibox.isEmpty())
            {
              a_gridIVS |= hibox;
            }
          if (lobox.smallEnd() <= checkBox.bigEnd())
            {
              done = false;
            }
        }
    }
}
void Gradient :: createGridIVS ( IntVectSet & a_gridIVS , const DisjointBoxLayout & a_grids , const Box & a_localBox , const int a_nGrow ) { LayoutIterator lit = a_grids . layoutIterator ( ) ; if ( ! a_gridIVS . isEmpty ( ) ) { a_gridIVS . makeEmpty ( ) ; } Box checkBox ( a_localBox ) ; checkBox . grow ( a_nGrow ) ; bool done = false ; for ( lit . begin ( ) ; lit . ok ( ) && ! done ; ++ lit ) { const Box & thisBox = a_grids . get ( lit ( ) ) ; Box intersectBox ( thisBox ) ; intersectBox &= checkBox ; if ( ! intersectBox . isEmpty ( ) ) { a_gridIVS |= intersectBox ; } done = true ; for ( int dir = 0 ; dir < SpaceDim ; dir ++ ) { Box lobox = adjCellLo ( thisBox , dir , 1 ) ; Box hibox = adjCellHi ( thisBox , dir , 1 ) ; lobox &= checkBox ; hibox &= checkBox ; if ( ! lobox . isEmpty ( ) ) { a_gridIVS |= lobox ; } if ( ! hibox . isEmpty ( ) ) { a_gridIVS |= hibox ; } if ( lobox . smallEnd ( ) <= checkBox . bigEnd ( ) ) { done = false ; } } } }
simple little function to turn DBL->IVS in region around
a given box.
simple little function to turn DBL - > IVS in region around a given box .
// if this isn't already empty, then make it empty // this is the neigborhood around thisBox in which we're interested. // to make sure we do boundaries correctly, also include // adjacent cells // also check for whether we can stop due to ordering