Block-Structured AMR Software Framework
AMReX_MLCellABecLap_3D_K.H
Go to the documentation of this file.
1 #ifndef AMREX_MLCELLABECLAP_3D_K_H_
2 #define AMREX_MLCELLABECLAP_3D_K_H_
3 #include <AMReX_Config.H>
4 
5 namespace amrex {
6 
8 int coarsen_overset_mask (Box const& bx, Array4<int> const& cmsk, Array4<int const> const& fmsk)
9  noexcept
10 {
11  int nerrors = 0;
12  const auto lo = amrex::lbound(bx);
13  const auto hi = amrex::ubound(bx);
14  for (int k = lo.z; k <= hi.z; ++k) {
15  for (int j = lo.y; j <= hi.y; ++j) {
16  for (int i = lo.x; i <= hi.x; ++i) {
17  int ii = 2*i;
18  int jj = 2*j;
19  int kk = 2*k;
20  cmsk(i,j,k) = fmsk(ii,jj ,kk ) + fmsk(ii+1,jj ,kk )
21  + fmsk(ii,jj+1,kk ) + fmsk(ii+1,jj+1,kk )
22  + fmsk(ii,jj ,kk+1) + fmsk(ii+1,jj ,kk+1)
23  + fmsk(ii,jj+1,kk+1) + fmsk(ii+1,jj+1,kk+1);
24  if (cmsk(i,j,k) == 8) {
25  cmsk(i,j,k) = 1;
26  } else if (cmsk(i,j,k) != 0) {
27  ++nerrors;
28  }
29  }}}
30  return nerrors;
31 }
32 
34 void coarsen_overset_mask (int i, int j, int k, Array4<int> const& cmsk,
35  Array4<int const> const& fmsk) noexcept
36 {
37  int ii = 2*i;
38  int jj = 2*j;
39  int kk = 2*k;
40  cmsk(i,j,k) = fmsk(ii,jj ,kk ) + fmsk(ii+1,jj ,kk )
41  + fmsk(ii,jj+1,kk ) + fmsk(ii+1,jj+1,kk )
42  + fmsk(ii,jj ,kk+1) + fmsk(ii+1,jj ,kk+1)
43  + fmsk(ii,jj+1,kk+1) + fmsk(ii+1,jj+1,kk+1);
44  if (cmsk(i,j,k) == 8) {
45  cmsk(i,j,k) = 1;
46  }
47 }
48 
49 }
50 
51 #endif
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int coarsen_overset_mask(Box const &bx, Array4< int > const &cmsk, Array4< int const > const &fmsk) noexcept
Definition: AMReX_MLCellABecLap_1D_K.H:8
BoxND< AMREX_SPACEDIM > Box
Definition: AMReX_BaseFwd.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:315
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:308