src/bvals/bvals_cc.cpp
//----------------------------------------------------------------------------------------
//! \fn int BoundaryValues::LoadCellCenteredBoundaryBufferToFiner(AthenaArray<Real> &src,
//                                  int ns, int ne, Real *buf, const NeighborBlock& nb)
//  \brief Set hydro boundary buffers for sending to a block on the finer level
\fn int BoundaryValues::LoadCellCenteredBoundaryBufferToFiner(AthenaArray &src,
int ns, int ne, Real *buf, const NeighborBlock& nb)
\brief Set hydro boundary buffers for sending to a block on the finer level
\ fn int BoundaryValues :: LoadCellCenteredBoundaryBufferToFiner ( AthenaArray &src int ns int ne Real * buf const NeighborBlock& nb ) \ brief Set hydro boundary buffers for sending to a block on the finer level
int BoundaryValues::LoadCellCenteredBoundaryBufferToFiner(AthenaArray<Real> &src,
                                    int ns, int ne, Real *buf, const NeighborBlock& nb)
{
  MeshBlock *pmb=pmy_block_;
  int si, sj, sk, ei, ej, ek;
  int cn=pmb->cnghost-1;
  si=(nb.ox1>0)?(pmb->ie-cn):pmb->is;
  ei=(nb.ox1<0)?(pmb->is+cn):pmb->ie;
  sj=(nb.ox2>0)?(pmb->je-cn):pmb->js;
  ej=(nb.ox2<0)?(pmb->js+cn):pmb->je;
  sk=(nb.ox3>0)?(pmb->ke-cn):pmb->ks;
  ek=(nb.ox3<0)?(pmb->ks+cn):pmb->ke;
  if(nb.ox1==0) {
    if(nb.fi1==1)   si+=pmb->block_size.nx1/2-pmb->cnghost;
    else            ei-=pmb->block_size.nx1/2-pmb->cnghost;
  }
  if(nb.ox2==0 && pmb->block_size.nx2 > 1) {
    if(nb.ox1!=0) {
      if(nb.fi1==1) sj+=pmb->block_size.nx2/2-pmb->cnghost;
      else          ej-=pmb->block_size.nx2/2-pmb->cnghost;
    }
    else {
      if(nb.fi2==1) sj+=pmb->block_size.nx2/2-pmb->cnghost;
      else          ej-=pmb->block_size.nx2/2-pmb->cnghost;
    }
  }
  if(nb.ox3==0 && pmb->block_size.nx3 > 1) {
    if(nb.ox1!=0 && nb.ox2!=0) {
      if(nb.fi1==1) sk+=pmb->block_size.nx3/2-pmb->cnghost;
      else          ek-=pmb->block_size.nx3/2-pmb->cnghost;
    }
    else {
      if(nb.fi2==1) sk+=pmb->block_size.nx3/2-pmb->cnghost;
      else          ek-=pmb->block_size.nx3/2-pmb->cnghost;
    }
  }
  int p=0;
  BufferUtility::Pack4DData(src, buf, ns, ne, si, ei, sj, ej, sk, ek, p);
  return p;
}
int BoundaryValues :: LoadCellCenteredBoundaryBufferToFiner ( AthenaArray < Real > & src , int ns , int ne , Real * buf , const NeighborBlock & nb ) { MeshBlock * pmb = pmy_block_ ; int si , sj , sk , ei , ej , ek ; int cn = pmb -> cnghost - 1 ; si = ( nb . ox1 > 0 ) ? ( pmb -> ie - cn ) : pmb -> is ; ei = ( nb . ox1 < 0 ) ? ( pmb -> is + cn ) : pmb -> ie ; sj = ( nb . ox2 > 0 ) ? ( pmb -> je - cn ) : pmb -> js ; ej = ( nb . ox2 < 0 ) ? ( pmb -> js + cn ) : pmb -> je ; sk = ( nb . ox3 > 0 ) ? ( pmb -> ke - cn ) : pmb -> ks ; ek = ( nb . ox3 < 0 ) ? ( pmb -> ks + cn ) : pmb -> ke ; if ( nb . ox1 == 0 ) { if ( nb . fi1 == 1 ) si += pmb -> block_size . nx1 / 2 - pmb -> cnghost ; else ei -= pmb -> block_size . nx1 / 2 - pmb -> cnghost ; } if ( nb . ox2 == 0 && pmb -> block_size . nx2 > 1 ) { if ( nb . ox1 != 0 ) { if ( nb . fi1 == 1 ) sj += pmb -> block_size . nx2 / 2 - pmb -> cnghost ; else ej -= pmb -> block_size . nx2 / 2 - pmb -> cnghost ; } else { if ( nb . fi2 == 1 ) sj += pmb -> block_size . nx2 / 2 - pmb -> cnghost ; else ej -= pmb -> block_size . nx2 / 2 - pmb -> cnghost ; } } if ( nb . ox3 == 0 && pmb -> block_size . nx3 > 1 ) { if ( nb . ox1 != 0 && nb . ox2 != 0 ) { if ( nb . fi1 == 1 ) sk += pmb -> block_size . nx3 / 2 - pmb -> cnghost ; else ek -= pmb -> block_size . nx3 / 2 - pmb -> cnghost ; } else { if ( nb . fi2 == 1 ) sk += pmb -> block_size . nx3 / 2 - pmb -> cnghost ; else ek -= pmb -> block_size . nx3 / 2 - pmb -> cnghost ; } } int p = 0 ; BufferUtility :: Pack4DData ( src , buf , ns , ne , si , ei , sj , ej , sk , ek , p ) ; return p ; }
\fn int BoundaryValues::LoadCellCenteredBoundaryBufferToFiner(AthenaArray<Real> &src,
int ns, int ne, Real *buf, const NeighborBlock& nb)
\brief Set hydro boundary buffers for sending to a block on the finer level
\ fn int BoundaryValues :: LoadCellCenteredBoundaryBufferToFiner ( AthenaArray<Real > &src int ns int ne Real * buf const NeighborBlock& nb ) \ brief Set hydro boundary buffers for sending to a block on the finer level
// send the data first and later prolongate on the target block // need to add edges for faces, add corners for edges