Block-Structured AMR Software Framework
AMReX_MLCellABecLap_2D_K.H
Go to the documentation of this file.
1 #ifndef AMREX_MLCELLABECLAP_2D_K_H_
2 #define AMREX_MLCELLABECLAP_2D_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 j = lo.y; j <= hi.y; ++j) {
15  for (int i = lo.x; i <= hi.x; ++i) {
16  int ii = 2*i;
17  int jj = 2*j;
18  cmsk(i,j,0) = fmsk(ii,jj,0) + fmsk(ii+1,jj,0) + fmsk(ii,jj+1,0) + fmsk(ii+1,jj+1,0);
19  if (cmsk(i,j,0) == 4) {
20  cmsk(i,j,0) = 1;
21  } else if (cmsk(i,j,0) != 0) {
22  ++nerrors;
23  }
24  }}
25  return nerrors;
26 }
27 
29 void coarsen_overset_mask (int i, int j, int, Array4<int> const& cmsk,
30  Array4<int const> const& fmsk) noexcept
31 {
32  int ii = 2*i;
33  int jj = 2*j;
34  cmsk(i,j,0) = fmsk(ii,jj,0) + fmsk(ii+1,jj,0) + fmsk(ii,jj+1,0) + fmsk(ii+1,jj+1,0);
35  if (cmsk(i,j,0) == 4) {
36  cmsk(i,j,0) = 1;
37  }
38 }
39 
40 }
41 
42 #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