1 #ifndef AMREX_INTERP_FACE_REG_3D_C_H_
2 #define AMREX_INTERP_FACE_REG_3D_C_H_
15 for (
int n = 0; n < ncomp; ++n) {
16 fine(i,j,k,n+scomp) =
crse(ic,jc,kc,n);
20 for (
int n = 0; n < ncomp; ++n) {
21 Real dc = Real(0.5) * (
crse(ic,jc+1,kc,n) -
crse(ic,jc-1,kc,n));
22 Real df = Real(2.0) * (
crse(ic,jc+1,kc,n) -
crse(ic,jc ,kc,n));
23 Real db = Real(2.0) * (
crse(ic,jc ,kc,n) -
crse(ic,jc-1,kc,n));
24 Real sy = (df*db >= Real(0.0)) ?
27 if (dc != Real(0.0)) {
32 Real yoff = (
static_cast<Real
>(j - jc*rr[1]) + Real(0.5)) / Real(rr[1]) - Real(0.5);
33 for (
int n = 0; n < ncomp; ++n) {
34 fine(i,j,k,n+scomp) += yoff *
slope(i,j,k,n) * sfy;
40 for (
int n = 0; n < ncomp; ++n) {
41 Real dc = Real(0.5) * (
crse(ic,jc,kc+1,n) -
crse(ic,jc,kc-1,n));
42 Real df = Real(2.0) * (
crse(ic,jc,kc+1,n) -
crse(ic,jc,kc ,n));
43 Real db = Real(2.0) * (
crse(ic,jc,kc ,n) -
crse(ic,jc,kc-1,n));
44 Real sz = (df*db >= Real(0.0)) ?
47 if (dc != Real(0.0)) {
52 Real zoff = (
static_cast<Real
>(k - kc*rr[2]) + Real(0.5)) / Real(rr[2]) - Real(0.5);
53 for (
int n = 0; n < ncomp; ++n) {
54 fine(i,j,k,n+scomp) += zoff *
slope(i,j,k,n) * sfz;
57 }
else if (idim == 1) {
58 for (
int n = 0; n < ncomp; ++n) {
59 fine(i,j,k,n+scomp) =
crse(ic,jc,kc,n);
63 for (
int n = 0; n < ncomp; ++n) {
64 Real dc = Real(0.5) * (
crse(ic+1,jc,kc,n) -
crse(ic-1,jc,kc,n));
65 Real df = Real(2.0) * (
crse(ic+1,jc,kc,n) -
crse(ic ,jc,kc,n));
66 Real db = Real(2.0) * (
crse(ic ,jc,kc,n) -
crse(ic-1,jc,kc,n));
67 Real sx = (df*db >= Real(0.0)) ?
70 if (dc != Real(0.0)) {
75 Real xoff = (
static_cast<Real
>(i - ic*rr[0]) + Real(0.5)) / Real(rr[0]) - Real(0.5);
76 for (
int n = 0; n < ncomp; ++n) {
77 fine(i,j,k,n+scomp) += xoff *
slope(i,j,k,n) * sfx;
83 for (
int n = 0; n < ncomp; ++n) {
84 Real dc = Real(0.5) * (
crse(ic,jc,kc+1,n) -
crse(ic,jc,kc-1,n));
85 Real df = Real(2.0) * (
crse(ic,jc,kc+1,n) -
crse(ic,jc,kc ,n));
86 Real db = Real(2.0) * (
crse(ic,jc,kc ,n) -
crse(ic,jc,kc-1,n));
87 Real sz = (df*db >= Real(0.0)) ?
90 if (dc != Real(0.0)) {
95 Real zoff = (
static_cast<Real
>(k - kc*rr[2]) + Real(0.5)) / Real(rr[2]) - Real(0.5);
96 for (
int n = 0; n < ncomp; ++n) {
97 fine(i,j,k,n+scomp) += zoff *
slope(i,j,k,n) * sfz;
101 for (
int n = 0; n < ncomp; ++n) {
102 fine(i,j,k,n+scomp) =
crse(ic,jc,kc,n);
105 Real sfx = Real(1.0);
106 for (
int n = 0; n < ncomp; ++n) {
107 Real dc = Real(0.5) * (
crse(ic+1,jc,kc,n) -
crse(ic-1,jc,kc,n));
108 Real df = Real(2.0) * (
crse(ic+1,jc,kc,n) -
crse(ic ,jc,kc,n));
109 Real db = Real(2.0) * (
crse(ic ,jc,kc,n) -
crse(ic-1,jc,kc,n));
110 Real sx = (df*db >= Real(0.0)) ?
113 if (dc != Real(0.0)) {
118 Real xoff = (
static_cast<Real
>(i - ic*rr[0]) + Real(0.5)) / Real(rr[0]) - Real(0.5);
119 for (
int n = 0; n < ncomp; ++n) {
120 fine(i,j,k,n+scomp) += xoff *
slope(i,j,k,n) * sfx;
125 Real sfy = Real(1.0);
126 for (
int n = 0; n < ncomp; ++n) {
127 Real dc = Real(0.5) * (
crse(ic,jc+1,kc,n) -
crse(ic,jc-1,kc,n));
128 Real df = Real(2.0) * (
crse(ic,jc+1,kc,n) -
crse(ic,jc ,kc,n));
129 Real db = Real(2.0) * (
crse(ic,jc ,kc,n) -
crse(ic,jc-1,kc,n));
130 Real sy = (df*db >= Real(0.0)) ?
133 if (dc != Real(0.0)) {
138 Real yoff = (
static_cast<Real
>(j - jc*rr[1]) + Real(0.5)) / Real(rr[1]) - Real(0.5);
139 for (
int n = 0; n < ncomp; ++n) {
140 fine(i,j,k,n+scomp) += yoff *
slope(i,j,k,n) * sfy;
#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 > slope
Definition: AMReX_InterpFaceRegister.cpp:91
Array4< Real const > crse
Definition: AMReX_InterpFaceRegister.cpp:92
Box domface
Definition: AMReX_InterpFaceRegister.cpp:94
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & smallEnd() const &noexcept
Get the smallend of the BoxND.
Definition: AMReX_Box.H:105
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & bigEnd() const &noexcept
Get the bigend.
Definition: AMReX_Box.H:116
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & min(const T &a, const T &b) noexcept
Definition: AMReX_Algorithm.H:21
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 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
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void interp_face_reg(int i, int j, IntVect const &rr, Array4< Real > const &fine, int scomp, Array4< Real const > const &crse, Array4< Real > const &slope, int ncomp, Box const &domface, int idim)
Definition: AMReX_InterpFaceReg_2D_C.H:7
Definition: AMReX_Array4.H:61