1 #ifndef AMREX_INTERP_BNDRYDATA_3D_K_H_
2 #define AMREX_INTERP_BNDRYDATA_3D_K_H_
3 #include <AMReX_Config.H>
12 Array4<T>
const& bdry,
int nb,
13 Array4<T const>
const&
crse,
int nc, Dim3
const& r) noexcept
18 bdry(i,j,k,n+nb) =
crse(ic,jc,kc,n+nc);
24 Array4<T>
const& bdry,
int nb,
25 Array4<T const>
const&
crse,
int nc, Dim3
const& r,
26 Array4<int const>
const&
mask,
int not_covered,
int ) noexcept
32 int lo = (
mask(i,j-
r.y,k) == not_covered) ? jc-1 : jc;
33 int hi = (
mask(i,j+
r.y,k) == not_covered) ? jc+1 : jc;
34 T fac = (hi == lo+1) ? T(1.0) : T(0.5);
35 T dy = fac*(
crse(ic,hi,kc,n+nc)-
crse(ic,lo,kc,n+nc));
36 T dy2 = (hi==lo+2) ? T(0.5)*(
crse(ic,jc+1,kc,n+nc) - T(2.)*
crse(ic,jc,kc,n+nc) +
crse(ic,jc-1,kc,n+nc)) : T(0.);
38 lo = (
mask(i,j,k-
r.z) == not_covered) ? kc-1 : kc;
39 hi = (
mask(i,j,k+
r.z) == not_covered) ? kc+1 : kc;
40 fac = (hi == lo+1) ? T(1.0) : T(0.5);
41 T dz = fac*(
crse(ic,jc,hi,n+nc)-
crse(ic,jc,lo,n+nc));
42 T dz2 = (hi==lo+2) ? T(0.5)*(
crse(ic,jc,kc+1,n+nc) - T(2.)*
crse(ic,jc,kc,n+nc) +
crse(ic,jc,kc-1,n+nc)) : T(0.);
44 T dyz = (
mask(i,j-
r.y,k-
r.z) == not_covered &&
mask(i,j+
r.y,k-
r.z) == not_covered &&
45 mask(i,j-
r.y,k+
r.z) == not_covered &&
mask(i,j+
r.y,k+
r.z) == not_covered)
46 ? T(0.25)*(
crse(ic,jc+1,kc+1,n+nc)-
crse(ic,jc-1,kc+1,n+nc)+
crse(ic,jc-1,kc-1,n+nc)-
crse(ic,jc+1,kc-1,n+nc))
49 T y = -T(0.5) + (j-jc*
r.y+T(0.5))/
r.y;
50 T z = -T(0.5) + (k-kc*
r.z+T(0.5))/
r.z;
51 bdry(i,j,k,n+nb) =
crse(ic,jc,kc,n+nc) + y*dy + (y*y)*dy2 + z*dz + (z*z)*dz2 + y*z*dyz;
57 Array4<T>
const& bdry,
int nb,
58 Array4<T const>
const&
crse,
int nc, Dim3
const& r,
59 Array4<int const>
const&
mask,
int not_covered,
int ) noexcept
65 int lo = (
mask(i-
r.x,j,k) == not_covered) ? ic-1 : ic;
66 int hi = (
mask(i+
r.x,j,k) == not_covered) ? ic+1 : ic;
67 T fac = (hi == lo+1) ? T(1.0) : T(0.5);
68 T dx = fac*(
crse(hi,jc,kc,n+nc)-
crse(lo,jc,kc,n+nc));
69 T dx2 = (hi==lo+2) ? T(0.5)*(
crse(ic+1,jc,kc,n+nc) - T(2.)*
crse(ic,jc,kc,n+nc) +
crse(ic-1,jc,kc,n+nc)) : T(0.);
71 lo = (
mask(i,j,k-
r.z) == not_covered) ? kc-1 : kc;
72 hi = (
mask(i,j,k+
r.z) == not_covered) ? kc+1 : kc;
73 fac = (hi == lo+1) ? T(1.0) : T(0.5);
74 T dz = fac*(
crse(ic,jc,hi,n+nc)-
crse(ic,jc,lo,n+nc));
75 T dz2 = (hi==lo+2) ? T(0.5)*(
crse(ic,jc,kc+1,n+nc) - T(2.)*
crse(ic,jc,kc,n+nc) +
crse(ic,jc,kc-1,n+nc)) : T(0.);
77 T dxz = (
mask(i-
r.x,j,k-
r.z) == not_covered &&
mask(i+
r.x,j,k-
r.z) == not_covered &&
78 mask(i-
r.x,j,k+
r.z) == not_covered &&
mask(i+
r.x,j,k+
r.z) == not_covered)
79 ? T(0.25)*(
crse(ic+1,jc,kc+1,n+nc)-
crse(ic-1,jc,kc+1,n+nc)+
crse(ic-1,jc,kc-1,n+nc)-
crse(ic+1,jc,kc-1,n+nc))
83 T
x = -T(0.5) + (i-ic*
r.x+T(0.5))/
r.x;
84 T z = -T(0.5) + (k-kc*
r.z+T(0.5))/
r.z;
85 bdry(i,j,k,n+nb) =
crse(ic,jc,kc,n+nc) +
x*dx + (
x*
x)*dx2 + z*dz + (z*z)*dz2 +
x*z*dxz;
99 int lo = (
mask(i-
r.x,j,k) == not_covered) ? ic-1 : ic;
100 int hi = (
mask(i+
r.x,j,k) == not_covered) ? ic+1 : ic;
101 T fac = (hi == lo+1) ? T(1.0) : T(0.5);
102 T dx = fac*(
crse(hi,jc,kc,n+nc)-
crse(lo,jc,kc,n+nc));
103 T dx2 = (hi==lo+2) ? T(0.5)*(
crse(ic+1,jc,kc,n+nc) - T(2.)*
crse(ic,jc,kc,n+nc) +
crse(ic-1,jc,kc,n+nc)) : T(0.);
105 lo = (
mask(i,j-
r.y,k) == not_covered) ? jc-1 : jc;
106 hi = (
mask(i,j+
r.y,k) == not_covered) ? jc+1 : jc;
107 fac = (hi == lo+1) ? T(1.0) : T(0.5);
108 T dy = fac*(
crse(ic,hi,kc,n+nc)-
crse(ic,lo,kc,n+nc));
109 T dy2 = (hi==lo+2) ? T(0.5)*(
crse(ic,jc+1,kc,n+nc) - T(2.)*
crse(ic,jc,kc,n+nc) +
crse(ic,jc-1,kc,n+nc)) : T(0.);
111 T dxy = (
mask(i-
r.x,j-
r.y,k) == not_covered &&
mask(i+
r.x,j-
r.y,k) == not_covered &&
112 mask(i-
r.x,j+
r.y,k) == not_covered &&
mask(i+
r.x,j+
r.y,k) == not_covered)
113 ? T(0.25)*(
crse(ic+1,jc+1,kc,n+nc)-
crse(ic-1,jc+1,kc,n+nc)+
crse(ic-1,jc-1,kc,n+nc)-
crse(ic+1,jc-1,kc,n+nc))
116 T
x = -T(0.5) + (i-ic*
r.x+T(0.5))/
r.x;
117 T y = -T(0.5) + (j-jc*
r.y+T(0.5))/
r.y;
118 bdry(i,j,k,n+nb) =
crse(ic,jc,kc,n+nc) +
x*dx + (
x*
x)*dx2 + y*dy + (y*y)*dy2 +
x*y*dxy;
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Array4< int const > mask
Definition: AMReX_InterpFaceRegister.cpp:93
Array4< Real const > crse
Definition: AMReX_InterpFaceRegister.cpp:92
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void interpbndrydata_y_o3(int i, int j, int, int n, Array4< T > const &bdry, int nb, Array4< T const > const &crse, int nc, Dim3 const &r, Array4< int const > const &mask, int not_covered, int max_width) noexcept
Definition: AMReX_InterpBndryData_2D_K.H:75
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void interpbndrydata_x_o3(int i, int, int, int n, Array4< T > const &bdry, int nb, Array4< T const > const &crse, int nc, Dim3 const &r, Array4< int const > const &, int, int) noexcept
Definition: AMReX_InterpBndryData_1D_K.H:22
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void interpbndrydata_z_o3(int i, int j, int k, int n, Array4< T > const &bdry, int nb, Array4< T const > const &crse, int nc, Dim3 const &r, Array4< int const > const &mask, int not_covered, int) noexcept
Definition: AMReX_InterpBndryData_3D_K.H:90
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void interpbndrydata_o1(int i, int, int, int n, Array4< T > const &bdry, int nb, Array4< T const > const &crse, int nc, Dim3 const &r) noexcept
Definition: AMReX_InterpBndryData_1D_K.H:11
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
Definition: AMReX_Array4.H:61
Definition: AMReX_Dim3.H:12