src/bvals/bvals_cc.cpp
//----------------------------------------------------------------------------------------
//! \fn void BoundaryValues::SetCellCenteredBoundaryFromCoarser(int ns, int ne,
//           Real *buf, AthenaArray<Real> &cbuf, const NeighborBlock& nb, bool *flip)
//  \brief Set hydro prolongation buffer received from a block on a coarser level
\fn void BoundaryValues::SetCellCenteredBoundaryFromCoarser(int ns, int ne,
Real *buf, AthenaArray &cbuf, const NeighborBlock& nb, bool *flip)
\brief Set hydro prolongation buffer received from a block on a coarser level
\ fn void BoundaryValues :: SetCellCenteredBoundaryFromCoarser ( int ns int ne Real * buf AthenaArray &cbuf const NeighborBlock& nb bool * flip ) \ brief Set hydro prolongation buffer received from a block on a coarser level
void BoundaryValues::SetCellCenteredBoundaryFromCoarser(int ns, int ne,
             Real *buf, AthenaArray<Real> &cbuf, const NeighborBlock& nb, bool *flip)
{
  MeshBlock *pmb=pmy_block_;
  MeshRefinement *pmr=pmb->pmr;
  int si, sj, sk, ei, ej, ek;
  int cng=pmb->cnghost;
  if(nb.ox1==0) {
    si=pmb->cis, ei=pmb->cie;
    if((pmb->loc.lx1&1L)==0L) ei+=cng;
    else             si-=cng; 
  }
  else if(nb.ox1>0)  si=pmb->cie+1,   ei=pmb->cie+cng;
  else               si=pmb->cis-cng, ei=pmb->cis-1;
  if(nb.ox2==0) {
    sj=pmb->cjs, ej=pmb->cje;
    if(pmb->block_size.nx2 > 1) {
      if((pmb->loc.lx2&1L)==0L) ej+=cng;
      else             sj-=cng; 
    }
  }
  else if(nb.ox2>0)  sj=pmb->cje+1,   ej=pmb->cje+cng;
  else               sj=pmb->cjs-cng, ej=pmb->cjs-1;
  if(nb.ox3==0) {
    sk=pmb->cks, ek=pmb->cke;
    if(pmb->block_size.nx3 > 1) {
      if((pmb->loc.lx3&1L)==0L) ek+=cng;
      else             sk-=cng; 
    }
  }
  else if(nb.ox3>0)  sk=pmb->cke+1,   ek=pmb->cke+cng;
  else               sk=pmb->cks-cng, ek=pmb->cks-1;
  int p=0;
  if (nb.polar) {
    for (int n=ns; n<=ne; ++n) {
      Real sign = 1.0;
      if(flip!=NULL) sign = flip[n] ? -1.0 : 1.0;
      for (int k=sk; k<=ek; ++k) {
        for (int j=ej; j>=sj; --j) {
#pragma simd
          for (int i=si; i<=ei; ++i)
            cbuf(n,k,j,i) = sign * buf[p++];
        }
      }
    }
  }
  else
    BufferUtility::Unpack4DData(buf, cbuf, ns, ne, si, ei, sj, ej, sk, ek, p);
  return;
}
void BoundaryValues :: SetCellCenteredBoundaryFromCoarser ( int ns , int ne , Real * buf , AthenaArray < Real > & cbuf , const NeighborBlock & nb , bool * flip ) { MeshBlock * pmb = pmy_block_ ; MeshRefinement * pmr = pmb -> pmr ; int si , sj , sk , ei , ej , ek ; int cng = pmb -> cnghost ; if ( nb . ox1 == 0 ) { si = pmb -> cis , ei = pmb -> cie ; if ( ( pmb -> loc . lx1 & 1L ) == 0L ) ei += cng ; else si -= cng ; } else if ( nb . ox1 > 0 ) si = pmb -> cie + 1 , ei = pmb -> cie + cng ; else si = pmb -> cis - cng , ei = pmb -> cis - 1 ; if ( nb . ox2 == 0 ) { sj = pmb -> cjs , ej = pmb -> cje ; if ( pmb -> block_size . nx2 > 1 ) { if ( ( pmb -> loc . lx2 & 1L ) == 0L ) ej += cng ; else sj -= cng ; } } else if ( nb . ox2 > 0 ) sj = pmb -> cje + 1 , ej = pmb -> cje + cng ; else sj = pmb -> cjs - cng , ej = pmb -> cjs - 1 ; if ( nb . ox3 == 0 ) { sk = pmb -> cks , ek = pmb -> cke ; if ( pmb -> block_size . nx3 > 1 ) { if ( ( pmb -> loc . lx3 & 1L ) == 0L ) ek += cng ; else sk -= cng ; } } else if ( nb . ox3 > 0 ) sk = pmb -> cke + 1 , ek = pmb -> cke + cng ; else sk = pmb -> cks - cng , ek = pmb -> cks - 1 ; int p = 0 ; if ( nb . polar ) { for ( int n = ns ; n <= ne ; ++ n ) { Real sign = 1.0 ; if ( flip != NULL ) sign = flip [ n ] ? -1.0 : 1.0 ; for ( int k = sk ; k <= ek ; ++ k ) { for ( int j = ej ; j >= sj ; -- j ) { #pragma  simd for ( int i = si ; i <= ei ; ++ i ) cbuf ( n , k , j , i ) = sign * buf [ p ++ ] ; } } } } else BufferUtility :: Unpack4DData ( buf , cbuf , ns , ne , si , ei , sj , ej , sk , ek , p ) ; return ; }
\fn void BoundaryValues::SetCellCenteredBoundaryFromCoarser(int ns, int ne,
Real *buf, AthenaArray<Real> &cbuf, const NeighborBlock& nb, bool *flip)
\brief Set hydro prolongation buffer received from a block on a coarser level
\ fn void BoundaryValues :: SetCellCenteredBoundaryFromCoarser ( int ns int ne Real * buf AthenaArray<Real > &cbuf const NeighborBlock& nb bool * flip ) \ brief Set hydro prolongation buffer received from a block on a coarser level