AMReX-Codes / amrex

AMReX: Software Framework for Block Structured AMR
https://amrex-codes.github.io/amrex
Other
536 stars 343 forks source link

what is the meaning of "(mask(hi.x+1,hi.y,hi.z) == crsecell" in the amrex_first_order_extrap_cpu function. #3933

Closed ztdepztdep closed 4 months ago

ztdepztdep commented 4 months ago
amrex_first_order_extrap_cpu(amrex::Box const& bx,
                             int               nComp,
                             amrex::Array4<const int>   const& mask,
                             amrex::Array4<amrex::Real> const& data) noexcept
{
   constexpr int crsecell = 0;

   const auto lo = amrex::lbound(bx);
   const auto hi = amrex::ubound(bx);

   if (mask(lo.x-1,lo.y,lo.z) == crsecell) {
      for (int n = 0; n < nComp; n++) {
         data(lo.x-1,lo.y,lo.z,n) = data(lo.x,lo.y,lo.z,n);
      }
   }
   if (mask(hi.x+1,hi.y,hi.z) == crsecell) {
      for (int n = 0; n < nComp; n++) {
         data(hi.x+1,hi.y,hi.z,n) = data(hi.x,hi.y,hi.z,n);
      }
   }
}
WeiqunZhang commented 4 months ago

(mask(hi.x+1,hi.y,hi.z) == crsecell means the cell at hi.x+1,hi.y,hi.z is a coarse cell (i.e., it does not exist as a valid cell on the current level).