1 #ifndef AMREX_MLMG_3D_K_H_
2 #define AMREX_MLMG_3D_K_H_
3 #include <AMReX_Config.H>
10 Array4<T const>
const& cc,
int nc) noexcept
15 for (
int n = 0; n < nc; ++n) {
16 for (
int k = lo.z; k <= hi.z; ++k) {
18 const int koff = 2*(k-kc*2)-1;
19 for (
int j = lo.y; j <= hi.y; ++j) {
21 const int joff = 2*(j-jc*2)-1;
23 for (
int i = lo.x; i <= hi.x; ++i) {
25 const int ioff = 2*(i-ic*2)-1;
26 ff(i,j,k,n) = T(0.421875)*cc(ic ,jc ,kc ,n)
27 + T(0.140625)*cc(ic+ioff,jc ,kc ,n)
28 + T(0.140625)*cc(ic ,jc+joff,kc ,n)
29 + T(0.140625)*cc(ic ,jc ,kc+koff,n)
30 + T(0.046875)*cc(ic ,jc+joff,kc+koff,n)
31 + T(0.046875)*cc(ic+ioff,jc ,kc+koff,n)
32 + T(0.046875)*cc(ic+ioff,jc+joff,kc ,n)
33 + T(0.015625)*cc(ic+ioff,jc+joff,kc+koff,n);
43 Array4<T const>
const& cc,
int nc) noexcept
48 for (
int n = 0; n < nc; ++n) {
49 for (
int k = lo.z; k <= hi.z; ++k) {
51 for (
int j = lo.y; j <= hi.y; ++j) {
54 for (
int i = lo.x; i <= hi.x; ++i) {
56 ff(i,j,k,n) = cc(ic,jc,kc,n);
64 template <
int R,
typename T>
66 void mlmg_eb_cc_interp_r (
Box const& bx, Array4<T>
const&
ff, Array4<T const>
const& cc,
67 Array4<EBCellFlag const>
const& flag,
int nc) noexcept
72 for (
int n = 0; n < nc; ++n) {
73 for (
int k = lo.z; k <= hi.z; ++k) {
75 for (
int j = lo.y; j <= hi.y; ++j) {
78 for (
int i = lo.x; i <= hi.x; ++i) {
80 if (flag(i,j,k).isCovered()) {
83 ff(i,j,k,n) = cc(ic,jc,kc,n);
95 Array4<T const>
const&
crse) noexcept
100 bool i_is_odd = (ic*2 != i);
101 bool j_is_odd = (jc*2 != j);
102 bool k_is_odd = (kc*2 != k);
103 if (i_is_odd && j_is_odd && k_is_odd) {
105 fine(i,j,k,n) = T(0.125)*(
crse(ic, jc, kc,n) +
crse(ic, jc, kc+1,n) +
106 crse(ic, jc+1,kc,n) +
crse(ic, jc+1,kc+1,n) +
107 crse(ic+1,jc, kc,n) +
crse(ic+1,jc, kc+1,n) +
108 crse(ic+1,jc+1,kc,n) +
crse(ic+1,jc+1,kc+1,n));
109 }
else if (j_is_odd && k_is_odd) {
111 fine(i,j,k,n) = T(0.25)*(
crse(ic, jc, kc,n) +
crse(ic, jc, kc+1,n) +
112 crse(ic, jc+1,kc,n) +
crse(ic, jc+1,kc+1,n));
113 }
else if (i_is_odd && k_is_odd) {
115 fine(i,j,k,n) = T(0.25)*(
crse(ic, jc,kc,n) +
crse(ic, jc,kc+1,n) +
116 crse(ic+1,jc,kc,n) +
crse(ic+1,jc,kc+1,n));
117 }
else if (i_is_odd && j_is_odd) {
119 fine(i,j,k,n) = T(0.25)*(
crse(ic ,jc,kc,n) +
crse(ic ,jc+1,kc,n) +
120 crse(ic+1,jc,kc,n) +
crse(ic+1,jc+1,kc,n));
121 }
else if (i_is_odd) {
123 fine(i,j,k,n) = T(0.5)*(
crse(ic,jc,kc,n) +
crse(ic+1,jc,kc,n));
124 }
else if (j_is_odd) {
126 fine(i,j,k,n) = T(0.5)*(
crse(ic,jc,kc,n) +
crse(ic,jc+1,kc,n));
127 }
else if (k_is_odd) {
129 fine(i,j,k,n) = T(0.5)*(
crse(ic,jc,kc,n) +
crse(ic,jc,kc+1,n));
136 template <
typename T>
139 Array4<T const>
const&
crse) noexcept
144 bool i_injection = (ic*4 == i);
145 bool j_injection = (jc*4 == j);
146 bool k_injection = (kc*4 == k);
148 #define I_LO (4*(ic+1)-i)
149 #define J_LO (4*(jc+1)-j)
150 #define K_LO (4*(kc+1)-k)
151 #define I_HI (i-4*ic)
152 #define J_HI (j-4*jc)
153 #define K_HI (k-4*kc)
155 if (i_injection && j_injection && k_injection)
159 else if (i_injection && j_injection)
164 else if (i_injection && k_injection)
169 else if (j_injection && k_injection)
174 else if (i_injection)
181 else if (j_injection)
188 }
else if (k_injection) {
#define AMREX_PRAGMA_SIMD
Definition: AMReX_Extension.H:80
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Array4< Real > fine
Definition: AMReX_InterpFaceRegister.cpp:90
Array4< Real const > crse
Definition: AMReX_InterpFaceRegister.cpp:92
static int ff(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:59
Definition: AMReX_Amr.cpp:49
BoxND< AMREX_SPACEDIM > Box
Definition: AMReX_BaseFwd.H:27
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlmg_lin_cc_interp_r2(Box const &bx, Array4< T > const &ff, Array4< T const > const &cc, int nc) noexcept
Definition: AMReX_MLMG_1D_K.H:9
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlmg_lin_cc_interp_r4(Box const &bx, Array4< T > const &ff, Array4< T const > const &cc, int nc) noexcept
Definition: AMReX_MLMG_1D_K.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
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlmg_lin_nd_interp_r2(int i, int, int, int n, Array4< T > const &fine, Array4< T const > const &crse) noexcept
Definition: AMReX_MLMG_1D_K.H:44
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlmg_lin_nd_interp_r4(int i, int, int, int n, Array4< T > const &fine, Array4< T const > const &crse) noexcept
Definition: AMReX_MLMG_1D_K.H:60
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition: AMReX_Box.H:1304