releasedExamples/MultiDimPhase/advectSrc/OldLoHiCenter.cpp
// This function is used when in direction a_dir a 3 point stencil of cell-
// centered data is being used to compute something at the cell center of the
// center cell of the stencil.  The data for the stencil is valid in
// a_inBox.  It divides a_inBox into a cell-centered box where the full
// stencil can be used, a_centerBox, and cell-centered boxes where 2 point
// stencils must be used, a_loBox and a_hiBox based on the current problem
// domain, a_domain, and the stencil direction, a_dir.  The union of these 2
// and 3 point stencil boxes is returned as a_entireBox.  The 2 point stencil
// boxes are one wide, at most, and if they have been defined then the
// corresponding flag, a_hasLo or a_hasHi, is set to one, otherwise these
// flags are zero.  All output boxes lie within the domain.
This function is used when in direction a_dir a 3 point stencil of cell
centered data is being used to compute something at the cell center of the
center cell of the stencil.  The data for the stencil is valid in
a_inBox.  It divides a_inBox into a cell-centered box where the full
stencil can be used, a_centerBox, and cell-centered boxes where 2 point
stencils must be used, a_loBox and a_hiBox based on the current problem
domain, a_domain, and the stencil direction, a_dir.  The union of these 2
and 3 point stencil boxes is returned as a_entireBox.  The 2 point stencil
boxes are one wide, at most, and if they have been defined then the
corresponding flag, a_hasLo or a_hasHi, is set to one, otherwise these
flags are zero.  All output boxes lie within the domain.
This function is used when in direction a_dir a 3 point stencil of cell centered data is being used to compute something at the cell center of the center cell of the stencil . The data for the stencil is valid in a_inBox . It divides a_inBox into a cell - centered box where the full stencil can be used a_centerBox and cell - centered boxes where 2 point stencils must be used a_loBox and a_hiBox based on the current problem domain a_domain and the stencil direction a_dir . The union of these 2 and 3 point stencil boxes is returned as a_entireBox . The 2 point stencil boxes are one wide at most and if they have been defined then the corresponding flag a_hasLo or a_hasHi is set to one otherwise these flags are zero . All output boxes lie within the domain .
void oldLoHiCenter(Box&                 a_loBox,
                   int&                 a_hasLo,
                   Box&                 a_hiBox,
                   int&                 a_hasHi,
                   Box&                 a_centerBox,
                   Box&                 a_entireBox,
                   const Box&           a_inBox,
                   const ProblemDomain& a_domain,
                   const int&           a_dir)
{
  Box inBox = a_inBox;
  inBox &= a_domain;
  a_centerBox = inBox;
  a_centerBox.grow(a_dir,-1);
  a_entireBox = a_centerBox;
  Box tmp = a_inBox;
  tmp.shift(a_dir,-1);
  tmp &= a_domain;
  tmp.shift(a_dir,1);
  if (!a_domain.contains(tmp))
  {
    a_hasHi = 1;
    tmp.shift(a_dir,-2);
    a_hiBox = adjCellHi(tmp,a_dir);
    a_entireBox.growHi(a_dir,1);
  }
  else
  {
    a_hasHi = 0;
    a_hiBox = Box();
  }
  tmp = a_inBox;
  tmp.shift(a_dir,1);
  tmp &= a_domain;
  tmp.shift(a_dir,-1);
  if (!a_domain.contains(tmp))
  {
    a_hasLo = 1;
    tmp.shift(a_dir,2);
    a_loBox = adjCellLo(tmp,a_dir);
    a_entireBox.growLo(a_dir,1);
  }
  else
  {
    a_hasLo = 0;
    a_loBox = Box();
  }
  CH_assert(a_entireBox.contains(a_centerBox));
  if (a_hasLo == 1)
  {
    CH_assert(a_entireBox.contains(a_loBox));
  }
  if (a_hasHi == 1)
  {
    CH_assert(a_entireBox.contains(a_hiBox));
  }
}
void oldLoHiCenter ( Box & a_loBox , int & a_hasLo , Box & a_hiBox , int & a_hasHi , Box & a_centerBox , Box & a_entireBox , const Box & a_inBox , const ProblemDomain & a_domain , const int & a_dir ) { Box inBox = a_inBox ; inBox &= a_domain ; a_centerBox = inBox ; a_centerBox . grow ( a_dir , -1 ) ; a_entireBox = a_centerBox ; Box tmp = a_inBox ; tmp . shift ( a_dir , -1 ) ; tmp &= a_domain ; tmp . shift ( a_dir , 1 ) ; if ( ! a_domain . contains ( tmp ) ) { a_hasHi = 1 ; tmp . shift ( a_dir , -2 ) ; a_hiBox = adjCellHi ( tmp , a_dir ) ; a_entireBox . growHi ( a_dir , 1 ) ; } else { a_hasHi = 0 ; a_hiBox = Box ( ) ; } tmp = a_inBox ; tmp . shift ( a_dir , 1 ) ; tmp &= a_domain ; tmp . shift ( a_dir , -1 ) ; if ( ! a_domain . contains ( tmp ) ) { a_hasLo = 1 ; tmp . shift ( a_dir , 2 ) ; a_loBox = adjCellLo ( tmp , a_dir ) ; a_entireBox . growLo ( a_dir , 1 ) ; } else { a_hasLo = 0 ; a_loBox = Box ( ) ; } CH_assert ( a_entireBox . contains ( a_centerBox ) ) ; if ( a_hasLo == 1 ) { CH_assert ( a_entireBox . contains ( a_loBox ) ) ; } if ( a_hasHi == 1 ) { CH_assert ( a_entireBox . contains ( a_hiBox ) ) ; } }
This function is used when in direction a_dir a 3 point stencil of cell
centered data is being used to compute something at the cell center of the
center cell of the stencil.
This function is used when in direction a_dir a 3 point stencil of cell centered data is being used to compute something at the cell center of the center cell of the stencil .
// Make a copy of the input box which can be modified // The centered difference box is always one smaller in a_dir // The union of all the output boxes start off equal to the center // difference portion on the input box (intersected with the domain) // See if this chops off the high side of the input box // If so, set up the high, one-sided difference box, a_hiBox, and expand // the entire box to include it // See if this chops off the low side of the input box // If so, set up the low, one-sided difference box, a_loBox, and expand // the entire box to include it // Make some simple sanity checks