1 #ifndef AMREX_FILFC_3D_C_H_
2 #define AMREX_FILFC_3D_C_H_
3 #include <AMReX_Config.H>
15 const int dcomp,
const int numcomp,
16 Box const& domain_box,
const BCRec* bcr,
17 const int bcomp)
const noexcept
25 const auto& domain_lo = domain_box.loVect();
26 const auto& domain_hi = domain_box.hiVect();
27 const int ilo = domain_lo[0];
28 const int jlo = domain_lo[1];
29 const int klo = domain_lo[2];
30 const int ihi = domain_hi[0];
31 const int jhi = domain_hi[1];
32 const int khi = domain_hi[2];
34 for (
int n = dcomp; n < numcomp+dcomp; ++n)
36 const BCRec& bc = bcr[bcomp+n-dcomp];
41 if ((bc.
lo(0) == BCType::reflect_odd) &&
49 case (BCType::foextrap):
51 q(i,j,k,n) = q(ilo,j,k,n);
54 case (BCType::hoextrap):
58 q(i,j,k,n) = q(ilo,j,k,n);
63 q(i,j,k,n) = (idxType.
nodeCentered(0)) ? Real(2.0)*q(i+1,j,k,n) - q(i+2,j,k,n)
64 : Real(0.5)*(Real(3.)*q(i+1,j,k,n) - q(i+2,j,k,n));
68 case (BCType::reflect_even):
70 q(i,j,k,n) = (idxType.
nodeCentered(0)) ? q(2*ilo-i,j,k,n)
74 case (BCType::reflect_odd):
76 q(i,j,k,n) = (idxType.
nodeCentered(0)) ? -q(2*ilo-i,j,k,n)
77 : -q(2*ilo-i-1,j,k,n);
86 if ((bc.
hi(0) == BCType::reflect_odd) &&
94 case (BCType::foextrap):
96 q(i,j,k,n) = q(ihi,j,k,n);
99 case (BCType::hoextrap):
103 q(i,j,k,n) = q(ilo,j,k,n);
108 q(i,j,k,n) = (idxType.
nodeCentered(0)) ? Real(2.0)*q(i-1,j,k,n) - q(i-2,j,k,n)
109 : Real(0.5)*(Real(3.)*q(i-1,j,k,n) - q(i-2,j,k,n));
113 case (BCType::reflect_even):
115 q(i,j,k,n) = (idxType.
nodeCentered(0)) ? q(2*ihi-i,j,k,n)
116 : q(2*ihi-i+1,j,k,n);
119 case (BCType::reflect_odd):
121 q(i,j,k,n) = (idxType.
nodeCentered(0)) ? -q(2*ihi-i,j,k,n)
122 : -q(2*ihi-i+1,j,k,n);
132 if ((bc.
lo(1) == BCType::reflect_odd) &&
140 case (BCType::foextrap):
142 q(i,j,k,n) = q(i,jlo,k,n);
145 case (BCType::hoextrap):
149 q(i,j,k,n) = q(i,jlo,k,n);
154 q(i,j,k,n) = (idxType.
nodeCentered(1)) ? Real(2.0)*q(i,j+1,k,n) - q(i,j+2,k,n)
155 : Real(0.5)*(Real(3.)*q(i,j+1,k,n) - q(i,j+2,k,n));
159 case (BCType::reflect_even):
161 q(i,j,k,n) = (idxType.
nodeCentered(1)) ? q(i,2*jlo-j,k,n)
162 : q(i,2*jlo-j-1,k,n);
165 case (BCType::reflect_odd):
167 q(i,j,k,n) = (idxType.
nodeCentered(1)) ? -q(i,2*jlo-j,k,n)
168 : -q(i,2*jlo-j-1,k,n);
177 if ((bc.
hi(1) == BCType::reflect_odd) &&
185 case (BCType::foextrap):
187 q(i,j,k,n) = q(i,jhi,k,n);
190 case (BCType::hoextrap):
194 q(i,j,k,n) = q(i,jhi,k,n);
199 q(i,j,k,n) = (idxType.
nodeCentered(1)) ? Real(2.0)*q(i,j-1,k,n) - q(i,j-2,k,n)
200 : Real(0.5)*(Real(3.)*q(i,j-1,k,n) - q(i,j-2,k,n));
204 case (BCType::reflect_even):
206 q(i,j,k,n) = (idxType.
nodeCentered(1)) ? q(i,2*jhi-j,k,n)
207 : q(i,2*jhi-j+1,k,n);
210 case (BCType::reflect_odd):
212 q(i,j,k,n) = (idxType.
nodeCentered(1)) ? -q(i,2*jhi-j,k,n)
213 : -q(i,2*jhi-j+1,k,n);
223 if ((bc.
lo(2) == BCType::reflect_odd) &&
231 case (BCType::foextrap):
233 q(i,j,k,n) = q(i,j,klo,n);
236 case (BCType::hoextrap):
240 q(i,j,k,n) = q(i,j,klo,n);
245 q(i,j,k,n) = (idxType.
nodeCentered(2)) ? Real(2.0)*q(i,j,k+1,n) - q(i,j,k+2,n)
246 : Real(0.5)*(Real(3.)*q(i,j,k+1,n) - q(i,j,k+2,n));
250 case (BCType::reflect_even):
252 q(i,j,k,n) = (idxType.
nodeCentered(2)) ? q(i,j,2*klo-k,n)
253 : q(i,j,2*klo-k-1,n);
256 case (BCType::reflect_odd):
258 q(i,j,k,n) = (idxType.
nodeCentered(2)) ? -q(i,j,2*klo-k,n)
259 : -q(i,j,2*klo-k-1,n);
268 if ((bc.
hi(2) == BCType::reflect_odd) &&
276 case (BCType::foextrap):
278 q(i,j,k,n) = q(i,j,khi,n);
281 case (BCType::hoextrap):
285 q(i,j,k,n) = q(i,j,khi,n);
290 q(i,j,k,n) = (idxType.
nodeCentered(2)) ? Real(2.0)*q(i,j,k-1,n) - q(i,j,k-2,n)
291 : Real(0.5)*(Real(3.)*q(i,j,k-1,n) - q(i,j,k-2,n));
295 case (BCType::reflect_even):
297 q(i,j,k,n) = (idxType.
nodeCentered(2)) ? q(i,j,2*khi-k,n)
298 : q(i,j,2*khi-k+1,n);
301 case (BCType::reflect_odd):
303 q(i,j,k,n) = (idxType.
nodeCentered(2)) ? -q(i,j,2*khi-k,n)
304 : -q(i,j,2*khi-k+1,n);
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Boundary Condition Records. Necessary information and functions for computing boundary conditions.
Definition: AMReX_BCRec.H:17
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const int * hi() const &noexcept
Return high-end boundary data.
Definition: AMReX_BCRec.H:106
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const int * lo() const &noexcept
Return low-end boundary data.
Definition: AMReX_BCRec.H:100
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool nodeCentered() const noexcept
True if the IndexTypeND is NODE based in all directions.
Definition: AMReX_IndexType.H:107
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE CellIndex ixType(int dir) const noexcept
Returns the CellIndex in direction dir.
Definition: AMReX_IndexType.H:116
Definition: AMReX_Amr.cpp:49
Definition: AMReX_Array4.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const IntVect &iv, Array4< Real > const &q, const int dcomp, const int numcomp, Box const &domain_box, const BCRec *bcr, const int bcomp) const noexcept
Definition: AMReX_FilFC_1D_C.H:14