Block-Structured AMR Software Framework
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
AMReX_EB2_GeometryShop.H
Go to the documentation of this file.
1#ifndef AMREX_EB2_GEOMETRYSHOP_H_
2#define AMREX_EB2_GEOMETRYSHOP_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_EB2_IF_Base.H>
6#include <AMReX_EB2_Graph.H>
7#include <AMReX_Geometry.H>
8#include <AMReX_BaseFab.H>
9#include <AMReX_Print.H>
10#include <AMReX_Array.H>
11#include <memory>
12#include <type_traits>
13#include <cmath>
14#include <utility>
15
16namespace amrex::EB2 {
17
18template <class F, std::enable_if_t<IsGPUable<F>::value>* FOO = nullptr>
20Real
21IF_f (F const& f, GpuArray<Real,AMREX_SPACEDIM> const& p) noexcept
22{
23 return f(AMREX_D_DECL(p[0],p[1],p[2]));
24}
25
26template <class F, std::enable_if_t<!IsGPUable<F>::value>* BAR = nullptr>
28Real
29IF_f (F const& f, GpuArray<Real,AMREX_SPACEDIM> const& p) noexcept
30{
33 amrex::Error("EB2::GeometryShop: how did this happen?");
34 return 0.0;
35 ))
36 AMREX_IF_ON_HOST((return f({AMREX_D_DECL(p[0],p[1],p[2])});))
37}
38
39template <class F>
41Real
44 int rangedir, F const& f) noexcept
45{
46#ifdef AMREX_USE_FLOAT
47 const Real tol = 1.e-4_rt;
48 const Real EPS = 1.0e-6_rt;
49#else
50 const Real tol = 1.e-12;
51 const Real EPS = 3.0e-15;
52#endif
53 const int MAXITER = 100;
54
55 Real p, q, r, s;
56
59
60 Real fa = IF_f(f, aPt);
61 Real fb = IF_f(f, bPt);
62 Real c = bPt[rangedir];
63 Real fc = fb;
64
65 if (fb*fa > 0.0_rt) {
66// amrex::AllPrint() << "fa " << fa << " fb " << fb << "\n";
67 amrex::Error("BrentRootFinder. Root must be bracketed, but instead the supplied end points have the same sign.");
68 return 0.0_rt;
69 } else if (fa == 0.0_rt) {
70 return aPt[rangedir];
71 } else if (fb == 0.0_rt) {
72 return bPt[rangedir];
73 }
74
75 Real d = 0.0_rt, e = 0.0_rt;
76 int i;
77 for (i = 0; i < MAXITER; ++i)
78 {
79 if (fb*fc > 0)
80 {
81 // Rename a, b, c and adjust bounding interval d
82 c = aPt[rangedir];
83 fc = fa;
84 d = bPt[rangedir] - aPt[rangedir];
85 e = d;
86 }
87
88 if (std::abs(fc) < std::abs(fb))
89 {
90 aPt[rangedir] = bPt[rangedir];
91 bPt[rangedir] = c;
92 c = aPt[rangedir];
93 fa = fb;
94 fb = fc;
95 fc = fa;
96 }
97
98 // Convergence check
99 Real tol1 = 2.0_rt * EPS * std::abs(bPt[rangedir]) + 0.5_rt * tol;
100 Real xm = 0.5_rt * (c - bPt[rangedir]);
101
102 if (std::abs(xm) <= tol1 || fb == 0.0_rt)
103 {
104 break;
105 }
106
107 if (std::abs(e) >= tol1 && std::abs(fa) > std::abs(fb))
108 {
109 // Attempt inverse quadratic interpolation
110 s = fb / fa;
111 if (aPt[rangedir] == c)
112 {
113 p = 2.0_rt * xm * s;
114 q = 1.0_rt - s;
115 }
116 else
117 {
118 q = fa / fc;
119 r = fb / fc;
120 p = s * (2.0_rt * xm * q * (q-r) - (bPt[rangedir]-aPt[rangedir]) * (r-1.0_rt));
121 q = (q-1.0_rt) * (r-1.0_rt) * (s-1.0_rt);
122 }
123
124 // Check whether in bounds
125 if (p > 0) { q = -q; }
126
127 p = std::abs(p);
128
129 if (2.0_rt * p < amrex::min(3.0_rt*xm*q-std::abs(tol1*q), 1.0_rt*std::abs(e*q)))
130 {
131 // Accept interpolation
132 e = d;
133 d = p / q;
134 }
135 else
136 {
137 // Interpolation failed, use bisection
138 d = xm;
139 e = d;
140 }
141 }
142 else
143 {
144 // Bounds decreasing too slowly, use bisection
145 d = xm;
146 e = d;
147 }
148
149 // Move last best guess to a
150 aPt[rangedir] = bPt[rangedir];
151 fa = fb;
152
153 // Evaluate new trial root
154 if (std::abs(d) > tol1)
155 {
156 bPt[rangedir] = bPt[rangedir] + d;
157 }
158 else
159 {
160 if (xm < 0) { bPt[rangedir] = bPt[rangedir] - tol1; }
161 else { bPt[rangedir] = bPt[rangedir] + tol1; }
162 }
163
164 fb = IF_f(f, bPt);
165 }
166
167 if (i >= MAXITER)
168 {
169 amrex::Error("BrentRootFinder: exceeding maximum iterations.");
170 }
171
172 return bPt[rangedir];
173}
174
175template <class F, class R = int>
177{
178public:
179
180 static constexpr int in_fluid = -1;
181 static constexpr int on_boundary = 0;
182 static constexpr int in_body = 1;
183 //
184 static constexpr int allregular = -1;
185 static constexpr int mixedcells = 0;
186 static constexpr int allcovered = 1;
187
189
190 explicit GeometryShop (F f)
191 : m_f(std::move(f)), m_resource()
192 {}
193
195 : m_f(std::move(f)), m_resource(std::move(r))
196 {}
197
198 [[nodiscard]] F const& GetImpFunc () const& { return m_f; }
199 F&& GetImpFunc () && { return std::move(m_f); }
200
201 [[nodiscard]] int getBoxType_Cpu (const Box& bx, Geometry const& geom) const noexcept
202 {
203 const Real* problo = geom.ProbLo();
204 const Real* dx = geom.CellSize();
205 const auto& len3 = bx.length3d();
206 const int* blo = bx.loVect();
207 int nbody = 0, nzero = 0, nfluid = 0;
208 for (int k = 0; k < len3[2]; ++k) {
209 for (int j = 0; j < len3[1]; ++j) {
210 for (int i = 0; i < len3[0]; ++i) {
211 RealArray xyz {AMREX_D_DECL(problo[0]+(i+blo[0])*dx[0],
212 problo[1]+(j+blo[1])*dx[1],
213 problo[2]+(k+blo[2])*dx[2])};
214 Real v = m_f(xyz);
215 if (v == 0.0_rt) {
216 ++nzero;
217 } else if (v > 0.0_rt) {
218 ++nbody;
219 } else {
220 ++nfluid;
221 }
222 if (nbody > 0 && nfluid > 0) { return mixedcells; }
223 }
224 }
225 }
227
228 if (nbody == 0) {
229 return allregular;
230 } else if (nfluid == 0) {
231 return allcovered;
232 } else {
233 return mixedcells;
234 }
235 }
236
237 template <class U=F, std::enable_if_t<IsGPUable<U>::value>* FOO = nullptr >
238 [[nodiscard]] int getBoxType (const Box& bx, const Geometry& geom, RunOn run_on) const noexcept
239 {
240 if (run_on == RunOn::Gpu && Gpu::inLaunchRegion())
241 {
242 const auto& problo = geom.ProbLoArray();
243 const auto& dx = geom.CellSizeArray();
244 auto const& f = m_f;
246 ReduceData<int,int,int> reduce_data(reduce_op);
247 using ReduceTuple = typename decltype(reduce_data)::Type;
248 reduce_op.eval(bx, reduce_data,
249 [=] AMREX_GPU_DEVICE (int i, int j, int k) -> ReduceTuple
250 {
252 Real v = f(AMREX_D_DECL(problo[0]+i*dx[0],
253 problo[1]+j*dx[1],
254 problo[2]+k*dx[2]));
255 int nbody = 0, nzero = 0, nfluid = 0;
256 if (v == 0.0_rt) {
257 ++nzero;
258 } else if (v > 0.0_rt) {
259 ++nbody;
260 } else {
261 ++nfluid;
262 }
263 return {nbody,nzero,nfluid};
264 });
265 ReduceTuple hv = reduce_data.value(reduce_op);
266 int nbody = amrex::get<0>(hv);
267 // int nzero = amrex::get<1>(hv);
268 int nfluid = amrex::get<2>(hv);
269
270 if (nbody == 0) {
271 return allregular;
272 } else if (nfluid == 0) {
273 return allcovered;
274 } else {
275 return mixedcells;
276 }
277 }
278 else
279 {
280 return getBoxType_Cpu(bx, geom);
281 }
282 }
283
284 template <class U=F, std::enable_if_t<!IsGPUable<U>::value>* BAR = nullptr >
285 [[nodiscard]] int getBoxType (const Box& bx, const Geometry& geom, RunOn) const noexcept
286 {
287 return getBoxType_Cpu(bx, geom);
288 }
289
290 template <class U=F, std::enable_if_t<IsGPUable<U>::value>* FOO = nullptr >
291 static constexpr bool isGPUable () noexcept { return true; }
292
293 template <class U=F, std::enable_if_t<!IsGPUable<U>::value>* BAR = nullptr >
294 static constexpr bool isGPUable () noexcept { return false; }
295
296 template <class U=F, std::enable_if_t<IsGPUable<U>::value>* FOO = nullptr >
297 void fillFab (BaseFab<Real>& levelset, const Geometry& geom, RunOn run_on,
298 Box const& bounding_box) const noexcept
299 {
300 const auto& problo = geom.ProbLoArray();
301 const auto& dx = geom.CellSizeArray();
302 const Box& bx = levelset.box();
303 const auto& a = levelset.array();
304 const auto& blo = amrex::lbound(bounding_box);
305 const auto& bhi = amrex::ubound(bounding_box);
306 const auto& f = m_f;
307 AMREX_HOST_DEVICE_FOR_3D_FLAG(run_on, bx, i, j, k,
308 {
309 a(i,j,k) = f(AMREX_D_DECL(problo[0]+amrex::Clamp(i,blo.x,bhi.x)*dx[0],
310 problo[1]+amrex::Clamp(j,blo.y,bhi.y)*dx[1],
311 problo[2]+amrex::Clamp(k,blo.z,bhi.z)*dx[2]));
312 });
313 }
314
315 template <class U=F, std::enable_if_t<!IsGPUable<U>::value>* BAR = nullptr >
317 Box const& bounding_box) const noexcept
318 {
319#ifdef AMREX_USE_GPU
320 if (!levelset.arena()->isHostAccessible()) {
321 const Box& bx = levelset.box();
322 BaseFab<Real> h_levelset(bx, levelset.nComp(), The_Pinned_Arena());
323 fillFab_Cpu(h_levelset, geom, bounding_box);
324 Gpu::htod_memcpy_async(levelset.dataPtr(), h_levelset.dataPtr(),
325 levelset.nBytes(bx, levelset.nComp()));
327 }
328 else
329#endif
330 {
331 fillFab_Cpu(levelset, geom, bounding_box);
332 }
333 }
334
336 Box const& bounding_box) const noexcept
337 {
338 const auto& problo = geom.ProbLoArray();
339 const auto& dx = geom.CellSizeArray();
340 const Box& bx = levelset.box();
341 const auto& blo = amrex::lbound(bounding_box);
342 const auto& bhi = amrex::ubound(bounding_box);
343
344 const auto& a = levelset.array();
345 amrex::LoopOnCpu(bx, [&] (int i, int j, int k) noexcept
346 {
347 a(i,j,k) = m_f(RealArray{AMREX_D_DECL(problo[0]+amrex::Clamp(i,blo.x,bhi.x)*dx[0],
348 problo[1]+amrex::Clamp(j,blo.y,bhi.y)*dx[1],
349 problo[2]+amrex::Clamp(k,blo.z,bhi.z)*dx[2])});
350 });
351 }
352
353
354 template <class U=F, std::enable_if_t<IsGPUable<U>::value>* FOO = nullptr >
355 void getIntercept (Array<Array4<Real>,AMREX_SPACEDIM> const& inter_arr,
356 Array<Array4<Type_t const>,AMREX_SPACEDIM> const& type_arr,
357 Array4<Real const> const&, Geometry const& geom, RunOn run_on,
358 Box const& bounding_box) const noexcept
359 {
360 auto const& dx = geom.CellSizeArray();
361 auto const& problo = geom.ProbLoArray();
362 const auto& blo = amrex::lbound(bounding_box);
363 const auto& bhi = amrex::ubound(bounding_box);
364 auto const& f = m_f;
365 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
366 Array4<Real> const& inter = inter_arr[idim];
367 Array4<Type_t const> const& type = type_arr[idim];
368 const Box bx{inter};
369 AMREX_HOST_DEVICE_FOR_3D_FLAG(run_on, bx, i, j, k,
370 {
371 if (type(i,j,k) == Type::irregular) {
372 IntVect ivlo(AMREX_D_DECL(i,j,k));
373 IntVect ivhi(AMREX_D_DECL(i,j,k));
374 ivhi[idim] += 1;
375 inter(i,j,k) = BrentRootFinder
376 ({AMREX_D_DECL(problo[0]+amrex::Clamp(ivlo[0],blo.x,bhi.x)*dx[0],
377 problo[1]+amrex::Clamp(ivlo[1],blo.y,bhi.y)*dx[1],
378 problo[2]+amrex::Clamp(ivlo[2],blo.z,bhi.z)*dx[2])},
379 {AMREX_D_DECL(problo[0]+amrex::Clamp(ivhi[0],blo.x,bhi.x)*dx[0],
380 problo[1]+amrex::Clamp(ivhi[1],blo.y,bhi.y)*dx[1],
381 problo[2]+amrex::Clamp(ivhi[2],blo.z,bhi.z)*dx[2])},
382 idim, f);
383 } else {
384 inter(i,j,k) = std::numeric_limits<Real>::quiet_NaN();
385 }
386 });
387 }
388 }
389
390 template <class U=F, std::enable_if_t<!IsGPUable<U>::value>* BAR = nullptr >
391 void getIntercept (Array<Array4<Real>,AMREX_SPACEDIM> const& inter_arr,
392 Array<Array4<Type_t const>,AMREX_SPACEDIM> const& type_arr,
393 Array4<Real const> const&, Geometry const& geom, RunOn,
394 Box const& bounding_box) const noexcept
395 {
396 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
397 Array4<Real> const& inter = inter_arr[idim];
398 Array4<Type_t const> const& type = type_arr[idim];
399 // When GShop is not GPUable, the intercept is either in managed memory or
400 // in device memory and needs to be copied to host and setup there.
401#ifdef AMREX_USE_GPU
402 if (!The_Arena()->isHostAccessible()) {
403 const Box bx{inter};
404 BaseFab<Real> h_inter_fab(bx, 1, The_Pinned_Arena());
405 BaseFab<Type_t> h_type_fab(bx, 1, The_Pinned_Arena());
406 Gpu::dtoh_memcpy_async(h_type_fab.dataPtr(), type.dataPtr(),
407 h_type_fab.nBytes(bx, 1));
409 const auto& h_inter = h_inter_fab.array();
410 const auto& h_type = h_type_fab.const_array();
411 getIntercept_Cpu(h_inter, h_type, geom, bounding_box, idim);
412 Gpu::htod_memcpy_async(inter.dataPtr(), h_inter.dataPtr(),
413 h_inter_fab.nBytes(bx, 1));
415 }
416 else
417#endif
418 {
419 getIntercept_Cpu(inter, type, geom, bounding_box, idim);
420 }
421
422 }
423 }
424
425 void getIntercept_Cpu (Array4<Real> const& inter,
426 Array4<Type_t const> const& type,
427 Geometry const& geom,
428 Box const& bounding_box,
429 const int idim) const noexcept
430 {
431 auto const& dx = geom.CellSizeArray();
432 auto const& problo = geom.ProbLoArray();
433 const auto& blo = amrex::lbound(bounding_box);
434 const auto& bhi = amrex::ubound(bounding_box);
435 const Box bx{inter};
436 amrex::LoopOnCpu(bx, [&] (int i, int j, int k) noexcept
437 {
438 if (type(i,j,k) == Type::irregular) {
439 IntVect ivlo(AMREX_D_DECL(i,j,k));
440 IntVect ivhi(AMREX_D_DECL(i,j,k));
441 ivhi[idim] += 1;
442 inter(i,j,k) = BrentRootFinder
443 ({AMREX_D_DECL(problo[0]+amrex::Clamp(ivlo[0],blo.x,bhi.x)*dx[0],
444 problo[1]+amrex::Clamp(ivlo[1],blo.y,bhi.y)*dx[1],
445 problo[2]+amrex::Clamp(ivlo[2],blo.z,bhi.z)*dx[2])},
446 {AMREX_D_DECL(problo[0]+amrex::Clamp(ivhi[0],blo.x,bhi.x)*dx[0],
447 problo[1]+amrex::Clamp(ivhi[1],blo.y,bhi.y)*dx[1],
448 problo[2]+amrex::Clamp(ivhi[2],blo.z,bhi.z)*dx[2])},
449 idim, m_f);
450 } else {
451 inter(i,j,k) = std::numeric_limits<Real>::quiet_NaN();
452 }
453 });
454 }
455
456
457
458 void updateIntercept (Array<Array4<Real>,AMREX_SPACEDIM> const& inter_arr,
459 Array<Array4<Type_t const>,AMREX_SPACEDIM> const& type_arr,
460 Array4<Real const> const& lst, Geometry const& geom) const noexcept
461 {
462 auto const& dx = geom.CellSizeArray();
463 auto const& problo = geom.ProbLoArray();
464 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
465 Array4<Real> const& inter = inter_arr[idim];
466 Array4<Type_t const> const& type = type_arr[idim];
467 const Box bx{inter};
469 {
470 if (type(i,j,k) == Type::irregular) {
471 bool is_nan = amrex::isnan(inter(i,j,k));
472 if (idim == 0) {
473 if (lst(i,j,k) == Real(0.0) ||
474 (lst(i,j,k) > Real(0.0) && is_nan))
475 {
476 // interp might still be quiet_nan because lst that
477 // was set to zero has been changed by FillBoundary
478 // at periodic boundaries.
479 inter(i,j,k) = problo[0] + i*dx[0];
480 }
481 else if (lst(i+1,j,k) == Real(0.0) ||
482 (lst(i+1,j,k) > Real(0.0) && is_nan))
483 {
484 inter(i,j,k) = problo[0] + (i+1)*dx[0];
485 }
486 } else if (idim == 1) {
487 if (lst(i,j,k) == Real(0.0) ||
488 (lst(i,j,k) > Real(0.0) && is_nan))
489 {
490 inter(i,j,k) = problo[1] + j*dx[1];
491 }
492 else if (lst(i,j+1,k) == Real(0.0) ||
493 (lst(i,j+1,k) > Real(0.0) && is_nan))
494 {
495 inter(i,j,k) = problo[1] + (j+1)*dx[1];
496 }
497 } else {
498 if (lst(i,j,k) == Real(0.0) ||
499 (lst(i,j,k) > Real(0.0) && is_nan))
500 {
501 inter(i,j,k) = problo[2] + k*dx[2];
502 }
503 else if (lst(i,j,k+1) == Real(0.0) ||
504 (lst(i,j,k+1) > Real(0.0) && is_nan))
505 {
506 inter(i,j,k) = problo[2] + (k+1)*dx[2];
507 }
508 }
509 }
510 });
511 }
512 }
513
514private:
515
517 R m_resource; // We use this to hold the ownership of resource for F if needed,
518 // because F needs to be a simply type suitable for GPU.
519};
520
521template <class F>
524{
525 return GeometryShop<std::decay_t<F>>(std::forward<F>(f));
526}
527
528template <class F, class R>
529GeometryShop<std::decay_t<F>, std::decay_t<R>>
530makeShop (F&& f, R&& r)
531{
533 std::decay_t<R>>
534 (std::forward<F>(f), std::forward<R>(r));
535}
536
537}
538
539#endif
#define AMREX_HOST_DEVICE_PARALLEL_FOR_3D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:110
#define AMREX_HOST_DEVICE_FOR_3D_FLAG(where_to_run, box, i, j, k, block)
Definition AMReX_GpuLaunch.nolint.H:100
#define AMREX_IF_ON_DEVICE(CODE)
Definition AMReX_GpuQualifiers.H:56
#define AMREX_IF_ON_HOST(CODE)
Definition AMReX_GpuQualifiers.H:58
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
A FortranArrayBox(FAB)-like object.
Definition AMReX_BaseFab.H:183
std::size_t nBytes() const noexcept
Returns how many bytes used.
Definition AMReX_BaseFab.H:266
AMREX_FORCE_INLINE Array4< T const > array() const noexcept
Definition AMReX_BaseFab.H:379
AMREX_FORCE_INLINE Array4< T const > const_array() const noexcept
Definition AMReX_BaseFab.H:415
T * dataPtr(int n=0) noexcept
Returns a pointer to an object of type T that is the value of the Nth component associated with the c...
Definition AMReX_BaseFab.H:352
Definition AMReX_EB2_GeometryShop.H:177
F const & GetImpFunc() const &
Definition AMReX_EB2_GeometryShop.H:198
void fillFab(BaseFab< Real > &levelset, const Geometry &geom, RunOn, Box const &bounding_box) const noexcept
Definition AMReX_EB2_GeometryShop.H:316
static constexpr bool isGPUable() noexcept
Definition AMReX_EB2_GeometryShop.H:291
GeometryShop(F f, R r)
Definition AMReX_EB2_GeometryShop.H:194
static constexpr int in_body
Definition AMReX_EB2_GeometryShop.H:182
void getIntercept(Array< Array4< Real >, AMREX_SPACEDIM > const &inter_arr, Array< Array4< Type_t const >, AMREX_SPACEDIM > const &type_arr, Array4< Real const > const &, Geometry const &geom, RunOn, Box const &bounding_box) const noexcept
Definition AMReX_EB2_GeometryShop.H:391
static constexpr int allcovered
Definition AMReX_EB2_GeometryShop.H:186
int getBoxType(const Box &bx, const Geometry &geom, RunOn) const noexcept
Definition AMReX_EB2_GeometryShop.H:285
void updateIntercept(Array< Array4< Real >, AMREX_SPACEDIM > const &inter_arr, Array< Array4< Type_t const >, AMREX_SPACEDIM > const &type_arr, Array4< Real const > const &lst, Geometry const &geom) const noexcept
Definition AMReX_EB2_GeometryShop.H:458
GeometryShop(F f)
Definition AMReX_EB2_GeometryShop.H:190
static constexpr int in_fluid
Definition AMReX_EB2_GeometryShop.H:180
R m_resource
Definition AMReX_EB2_GeometryShop.H:517
void fillFab_Cpu(BaseFab< Real > &levelset, const Geometry &geom, Box const &bounding_box) const noexcept
Definition AMReX_EB2_GeometryShop.H:335
F FunctionType
Definition AMReX_EB2_GeometryShop.H:188
void fillFab(BaseFab< Real > &levelset, const Geometry &geom, RunOn run_on, Box const &bounding_box) const noexcept
Definition AMReX_EB2_GeometryShop.H:297
static constexpr int mixedcells
Definition AMReX_EB2_GeometryShop.H:185
static constexpr int allregular
Definition AMReX_EB2_GeometryShop.H:184
void getIntercept_Cpu(Array4< Real > const &inter, Array4< Type_t const > const &type, Geometry const &geom, Box const &bounding_box, const int idim) const noexcept
Definition AMReX_EB2_GeometryShop.H:425
static constexpr int on_boundary
Definition AMReX_EB2_GeometryShop.H:181
void getIntercept(Array< Array4< Real >, AMREX_SPACEDIM > const &inter_arr, Array< Array4< Type_t const >, AMREX_SPACEDIM > const &type_arr, Array4< Real const > const &, Geometry const &geom, RunOn run_on, Box const &bounding_box) const noexcept
Definition AMReX_EB2_GeometryShop.H:355
F && GetImpFunc() &&
Definition AMReX_EB2_GeometryShop.H:199
int getBoxType_Cpu(const Box &bx, Geometry const &geom) const noexcept
Definition AMReX_EB2_GeometryShop.H:201
F m_f
Definition AMReX_EB2_GeometryShop.H:516
int getBoxType(const Box &bx, const Geometry &geom, RunOn run_on) const noexcept
Definition AMReX_EB2_GeometryShop.H:238
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:73
Definition AMReX_Reduce.H:249
Type value()
Definition AMReX_Reduce.H:281
Definition AMReX_Reduce.H:364
std::enable_if_t< IsFabArray< MF >::value > eval(MF const &mf, IntVect const &nghost, D &reduce_data, F &&f)
Definition AMReX_Reduce.H:441
static constexpr Type_t irregular
Definition AMReX_EB2_Graph.H:40
Definition AMReX_FabArrayBase.H:32
AMREX_GPU_HOST_DEVICE Real IF_f(F const &f, GpuArray< Real, AMREX_SPACEDIM > const &p) noexcept
Definition AMReX_EB2_GeometryShop.H:21
GeometryShop< std::decay_t< F > > makeShop(F &&f)
Definition AMReX_EB2_GeometryShop.H:523
AMREX_GPU_HOST_DEVICE Real BrentRootFinder(GpuArray< Real, AMREX_SPACEDIM > const &lo, GpuArray< Real, AMREX_SPACEDIM > const &hi, int rangedir, F const &f) noexcept
Definition AMReX_EB2_GeometryShop.H:42
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:237
void dtoh_memcpy_async(void *p_h, const void *p_d, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:265
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:86
void htod_memcpy_async(void *p_d, const void *p_h, const std::size_t sz) noexcept
Definition AMReX_GpuDevice.H:251
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition AMReX_Loop.H:355
RunOn
Definition AMReX_GpuControl.H:69
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const T & Clamp(const T &v, const T &lo, const T &hi)
Definition AMReX_Algorithm.H:84
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE constexpr const T & min(const T &a, const T &b) noexcept
Definition AMReX_Algorithm.H:21
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 ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:127
Array< Real, AMREX_SPACEDIM > RealArray
Definition AMReX_Array.H:26
void Error(const std::string &msg)
Print out message to cerr and exit via amrex::Abort().
Definition AMReX.cpp:224
Arena * The_Pinned_Arena()
Definition AMReX_Arena.cpp:656
Arena * The_Arena()
Definition AMReX_Arena.cpp:616
std::array< T, N > Array
Definition AMReX_Array.H:24
Definition AMReX_Array4.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T * dataPtr() const noexcept
Definition AMReX_Array4.H:238
Definition AMReX_Array.H:34