1 #ifndef AMREX_ML_NODE_LINOP_1D_K_H_
2 #define AMREX_ML_NODE_LINOP_1D_K_H_
3 #include <AMReX_Config.H>
14 if (! bflo[idim]) { gdomain.
growLo(idim,1); }
15 if (! bfhi[idim]) { gdomain.
growHi(idim,1); }
19 const int offset = domain.cellCentered() ? 0 : 1;
21 const auto dlo = domain.smallEnd(0);
22 const auto dhi = domain.bigEnd(0);
28 if (i == dlo-1 && bflo[0])
30 a(i,0,0) = a(i+1+
offset, j, k);
32 else if (i == dhi+1 && bfhi[0])
34 a(i,0,0) = a(i-1-
offset, j, k);
46 crse(i,0,0) = Real(0.0);
48 crse(i,0,0) = Real(1./4.) *(
fine(ii-1,0,0)
49 + Real(2.)*
fine(ii ,0,0)
65 crse(i,0,0) = Real(0.0);
67 const auto ndlo = fdom.smallEnd(0);
68 const auto ndhi = fdom.bigEnd(0);
70 for (
int ioff = -rr+1; ioff <= rr-1; ++ioff) {
73 if ((itmp < ndlo && (bclo[0] == LinOpBCType::Neumann ||
74 bclo[0] == LinOpBCType::inflow)) ||
75 (itmp > ndhi && (bchi[0] == LinOpBCType::Neumann ||
76 bchi[0] == LinOpBCType::inflow))) {
79 tmp += wx*
fine(itmp,0,0);
81 crse(i,0,0) = tmp*(Real(1.0)/Real(rr*rr));
89 amrex::Abort(
"mlndlap_semi_restriction: not implemented in 1D");
96 using namespace nodelap_detail;
98 int s = cmsk(i-1,0,0) + cmsk(i,0,0);
114 const auto lo = bx.smallEnd(0);
115 const auto hi = bx.bigEnd(0);
117 for (
int i = lo; i <= hi; ++i) {
119 dmsk(i,0,0) = (omsk(i-1,0,0) == 1 || omsk(i,0,0) == 1);
123 const auto domlo = dom.smallEnd(0);
124 const auto domhi = dom.bigEnd(0);
126 if (bclo[0] == LinOpBCType::Dirichlet && lo == domlo) {
130 if (bchi[0] == LinOpBCType::Dirichlet && hi == domhi) {
141 const auto lo = bx.smallEnd(0);
142 const auto hi = bx.bigEnd(0);
145 for (
int i = lo; i <= hi; ++i) {
146 dmsk(i,0,0) =
static_cast<Real
>(omsk(i,0,0));
149 const auto domlo = dom.smallEnd(0);
150 const auto domhi = dom.bigEnd(0);
152 if ((bclo[0] == LinOpBCType::Neumann || bclo[0] == LinOpBCType::inflow)
155 dmsk(lo,0,0) *= Real(0.5);
158 if ((bchi[0] == LinOpBCType::Neumann || bchi[0] == LinOpBCType::inflow)
161 dmsk(hi,0,0) *= Real(0.5);
#define AMREX_PRAGMA_SIMD
Definition: AMReX_Extension.H:80
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_HOST_DEVICE_FOR_3D(...)
Definition: AMReX_GpuLaunch.nolint.H:50
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Array4< int const > offset
Definition: AMReX_HypreMLABecLap.cpp:1089
Array4< Real > fine
Definition: AMReX_InterpFaceRegister.cpp:90
Array4< Real const > crse
Definition: AMReX_InterpFaceRegister.cpp:92
AMREX_GPU_HOST_DEVICE bool strictly_contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is strictly contained within BoxND.
Definition: AMReX_Box.H:236
AMREX_GPU_HOST_DEVICE BoxND & growHi(int idir, int n_cell=1) noexcept
Grow the BoxND on the high end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the B...
Definition: AMReX_Box.H:659
AMREX_GPU_HOST_DEVICE BoxND & growLo(int idir, int n_cell=1) noexcept
Grow the BoxND on the low end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the Bo...
Definition: AMReX_Box.H:648
AMREX_GPU_HOST_DEVICE bool contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is contained within BoxND.
Definition: AMReX_Box.H:204
constexpr int fine_cell
Definition: AMReX_MLNodeLinOp_K.H:55
constexpr int fine_node
Definition: AMReX_MLNodeLinOp_K.H:58
constexpr int crse_node
Definition: AMReX_MLNodeLinOp_K.H:56
constexpr int crse_cell
Definition: AMReX_MLNodeLinOp_K.H:54
constexpr int crse_fine_node
Definition: AMReX_MLNodeLinOp_K.H:57
Definition: AMReX_Amr.cpp:49
void mlndlap_bc_doit(Box const &vbx, Array4< T > const &a, Box const &domain, GpuArray< bool, AMREX_SPACEDIM > const &bflo, GpuArray< bool, AMREX_SPACEDIM > const &bfhi) noexcept
Definition: AMReX_MLNodeLinOp_1D_K.H:8
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_nodal_mask(int i, int, int, Array4< int > const &nmsk, Array4< int const > const &cmsk) noexcept
Definition: AMReX_MLNodeLinOp_1D_K.H:93
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition: AMReX_Box.H:1211
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T abs(const GpuComplex< T > &a_z) noexcept
Return the absolute value of a complex number.
Definition: AMReX_GpuComplex.H:356
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_restriction(int i, int, int, Array4< Real > const &crse, Array4< Real const > const &fine, Array4< int const > const &msk) noexcept
Definition: AMReX_MLNodeLinOp_1D_K.H:41
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_semi_restriction(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< int const > const &, int) noexcept
Definition: AMReX_MLNodeLinOp_1D_K.H:86
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_dirichlet_mask(Box const &bx, Array4< int > const &dmsk, Array4< int const > const &omsk, Box const &dom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bclo, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bchi) noexcept
Definition: AMReX_MLNodeLinOp_1D_K.H:109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_dot_mask(Box const &bx, Array4< Real > const &dmsk, Array4< int const > const &omsk, Box const &dom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bclo, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bchi) noexcept
Definition: AMReX_MLNodeLinOp_1D_K.H:136
Definition: AMReX_Array4.H:61
Definition: AMReX_Array.H:34