Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_FillPatcher.H
Go to the documentation of this file.
1#ifndef AMREX_FILLPATCHER_H_
2#define AMREX_FILLPATCHER_H_
3#include <AMReX_Config.H>
4
6#include <utility>
7
13namespace amrex {
14
76template <class MF = MultiFab>
78{
79public:
80
95 FillPatcher (BoxArray const& fba, DistributionMapping const& fdm,
96 Geometry const& fgeom,
97 BoxArray const& cba, DistributionMapping const& cdm, // NOLINT
98 Geometry const& cgeom,
99 IntVect const& nghost, int ncomp, InterpBase* interp,
100#ifdef AMREX_USE_EB
101 EB2::IndexSpace const* eb_index_space = EB2::TopIndexSpaceIfPresent());
102#else
103 EB2::IndexSpace const* eb_index_space = nullptr);
104#endif
105
129 template <typename BC,
130 typename PreInterpHook=NullInterpHook<MF>,
131 typename PostInterpHook=NullInterpHook<MF> >
132 void fill (MF& mf, IntVect const& nghost, Real time,
133 Vector<MF*> const& cmf, Vector<Real> const& ct,
134 Vector<MF*> const& fmf, Vector<Real> const& ft,
135 int scomp, int dcomp, int ncomp,
136 BC& cbc, int cbccomp, BC& fbc, int fbccomp,
137 Vector<BCRec> const& bcs, int bcscomp,
138 PreInterpHook const& pre_interp = {},
139 PostInterpHook const& post_interp = {});
140
160 template <typename BC,
161 typename PreInterpHook=NullInterpHook<MF>,
162 typename PostInterpHook=NullInterpHook<MF> >
163 void fillCoarseFineBoundary (MF& mf, IntVect const& nghost, Real time,
164 Vector<MF*> const& cmf,
165 Vector<Real> const& ct,
166 int scomp, int dcomp, int ncomp,
167 BC& cbc, int cbccomp,
168 Vector<BCRec> const& bcs, int bcscomp,
169 PreInterpHook const& pre_interp = {},
170 PostInterpHook const& post_interp = {});
171
181 template <std::size_t order>
182 requires (order == 3 || order == 4)
183 void storeRKCoarseData (Real time, Real dt, MF const& S_old,
184 Array<MF,order> const& RK_k);
185
202 template <typename BC>
203 void fillRK (int stage, int iteration, int ncycle, MF& mf, Real time,
204 BC& cbc, BC& fbc, Vector<BCRec> const& bcs);
205
206private:
207
208 BoxArray m_fba;
209 BoxArray m_cba;
212 Geometry m_fgeom;
213 Geometry m_cgeom;
214 IntVect m_nghost;
215 int m_ncomp;
216 InterpBase* m_interp;
217 EB2::IndexSpace const* m_eb_index_space = nullptr;
218 MF m_sfine;
219 IntVect m_ratio;
221 std::unique_ptr<MF> m_cf_crse_data_tmp;
222 std::unique_ptr<MF> m_cf_fine_data;
223 Real m_dt_coarse = std::numeric_limits<Real>::lowest();
224
225 FabArrayBase::FPinfo const& getFPinfo ();
226};
227
228template <class MF>
230 Geometry const& fgeom,
231 BoxArray const& cba, DistributionMapping const& cdm, // NOLINT
232 Geometry const& cgeom,
233 IntVect const& nghost, int ncomp, InterpBase* interp,
234 EB2::IndexSpace const* eb_index_space)
235 : m_fba(fba),
236 m_cba(cba),
237 m_fdm(fdm),
238 m_cdm(cdm),
239 m_fgeom(fgeom),
240 m_cgeom(cgeom),
241 m_nghost(nghost),
242 m_ncomp(ncomp),
243 m_interp(interp),
244 m_eb_index_space(eb_index_space),
245 m_sfine(fba, fdm, 1, nghost, MFInfo().SetAlloc(false))
246{
247 static_assert(IsFabArray<MF>::value,
248 "FillPatcher<MF>: MF must be FabArray type");
250
251 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
252 m_ratio[idim] = m_fgeom.Domain().length(idim) / m_cgeom.Domain().length(idim);
253 }
254 AMREX_ASSERT(m_fgeom.Domain() == amrex::refine(m_cgeom.Domain(),m_ratio));
255}
256
257template <class MF>
258template <typename BC, typename PreInterpHook, typename PostInterpHook>
259void
260FillPatcher<MF>::fill (MF& mf, IntVect const& nghost, Real time,
261 Vector<MF*> const& cmf, Vector<Real> const& ct,
262 Vector<MF*> const& fmf, Vector<Real> const& ft,
263 int scomp, int dcomp, int ncomp,
264 BC& cbc, int cbccomp,
265 BC& fbc, int fbccomp,
266 Vector<BCRec> const& bcs, int bcscomp,
267 PreInterpHook const& pre_interp,
268 PostInterpHook const& post_interp)
269{
270 BL_PROFILE("FillPatcher::fill()");
271
272 AMREX_ALWAYS_ASSERT(!cmf.empty() && cmf.size() == ct.size() &&
273 !fmf.empty() && fmf.size() == ft.size() &&
274 m_fba == fmf[0]->boxArray() && m_fdm == fmf[0]->DistributionMap());
275
276 fillCoarseFineBoundary(mf, nghost, time, cmf, ct, scomp, dcomp, ncomp,
277 cbc, cbccomp, bcs, bcscomp, pre_interp, post_interp);
278
279 FillPatchSingleLevel(mf, nghost, time, fmf, ft, scomp, dcomp, ncomp,
280 m_fgeom, fbc, fbccomp);
281}
282
283template <class MF>
286{
287 const InterpolaterBoxCoarsener& coarsener = m_interp->BoxCoarsener(m_ratio);
288 return FabArrayBase::TheFPinfo(m_sfine, m_sfine, m_nghost, coarsener,
289 m_fgeom, m_cgeom, m_eb_index_space);
290}
291
292template <class MF>
293template <typename BC, typename PreInterpHook, typename PostInterpHook>
294void
296 Vector<MF*> const& cmf,
297 Vector<Real> const& ct,
298 int scomp, int dcomp, int ncomp,
299 BC& cbc, int cbccomp,
300 Vector<BCRec> const& bcs, int bcscomp,
301 PreInterpHook const& pre_interp,
302 PostInterpHook const& post_interp)
303{
304 BL_PROFILE("FillPatcher::fillCFB");
305
306 AMREX_ALWAYS_ASSERT(!cmf.empty() && cmf.size() == ct.size() &&
307 nghost.allLE(m_nghost) &&
308 m_fba == mf.boxArray() &&
309 m_fdm == mf.DistributionMap() &&
310 m_cba == cmf[0]->boxArray() &&
311 m_cdm == cmf[0]->DistributionMap() &&
312 m_ncomp >= ncomp &&
313 m_ncomp == cmf[0]->nComp());
314
315 auto const& fpc = getFPinfo();
316
317 if ( ! fpc.ba_crse_patch.empty())
318 {
319 if (m_cf_fine_data == nullptr) {
320 m_cf_fine_data = std::make_unique<MF>
321 (detail::make_mf_fine_patch<MF>(fpc, m_ncomp));
322 }
323
324 int ncmfs = cmf.size();
325 for (int icmf = 0; icmf < ncmfs; ++icmf) {
326 Real t = ct[icmf];
327 auto it = std::find_if(m_cf_crse_data.begin(), m_cf_crse_data.end(),
328 [=] (auto const& x) {
329 return amrex::almostEqual(x.first,t,5);
330 });
331
332 if (it == std::end(m_cf_crse_data)) {
333 MF mf_crse_patch = detail::make_mf_crse_patch<MF>(fpc, m_ncomp);
334 mf_crse_patch.ParallelCopy(*cmf[icmf], m_cgeom.periodicity());
335
336 std::pair<Real,std::unique_ptr<MF>> tmp;
337 tmp.first = t;
338 tmp.second = std::make_unique<MF>(std::move(mf_crse_patch));
339 m_cf_crse_data.push_back(std::move(tmp));
340 }
341 }
342
343 if (m_cf_crse_data_tmp == nullptr) {
344 m_cf_crse_data_tmp = std::make_unique<MF>
345 (detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
346 }
347
348 int const ng_space_interp = 8; // Need to be big enough
349 Box domain = m_cgeom.growPeriodicDomain(ng_space_interp);
350 domain.convert(mf.ixType());
351
352 int idata = -1;
353 if (m_cf_crse_data.size() == 1) {
354 idata = 0;
355 } else if (m_cf_crse_data.size() == 2) {
356 Real const teps = std::abs(m_cf_crse_data[1].first -
357 m_cf_crse_data[0].first) * 1.e-3_rt;
358 if (time > m_cf_crse_data[0].first - teps &&
359 time < m_cf_crse_data[0].first + teps) {
360 idata = 0;
361 } else if (time > m_cf_crse_data[1].first - teps &&
362 time < m_cf_crse_data[1].first + teps) {
363 idata = 1;
364 } else {
365 idata = 2;
366 }
367 }
368
369 if (idata == 0 || idata == 1) {
370 auto const& dst = m_cf_crse_data_tmp->arrays();
371 auto const& src = m_cf_crse_data[idata].second->const_arrays();
372 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), ncomp,
373 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
374 {
375 if (domain.contains(i,j,k)) {
376 dst[bi](i,j,k,n) = src[bi](i,j,k,n+scomp);
377 }
378 });
379 } else if (idata == 2) {
380 Real t0 = m_cf_crse_data[0].first;
381 Real t1 = m_cf_crse_data[1].first;
382 Real alpha = (t1-time)/(t1-t0);
383 Real beta = (time-t0)/(t1-t0);
384 auto const& a = m_cf_crse_data_tmp->arrays();
385 auto const& a0 = m_cf_crse_data[0].second->const_arrays();
386 auto const& a1 = m_cf_crse_data[1].second->const_arrays();
387 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), ncomp,
388 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
389 {
390 if (domain.contains(i,j,k)) {
391 a[bi](i,j,k,n)
392 = alpha*a0[bi](i,j,k,scomp+n)
393 + beta*a1[bi](i,j,k,scomp+n);
394 }
395 });
396 }
397 else
398 {
399 amrex::Abort("FillPatcher: High order interpolation in time not supported. Or FillPatcher was not properly deleted.");
400 }
401 // Sync required: user callback cbc may read fab on host (e.g. if pinned)
403
404 cbc(*m_cf_crse_data_tmp, 0, ncomp, m_cf_crse_data_tmp->nGrowVect(), time, cbccomp);
405
406 detail::call_interp_hook(pre_interp, *m_cf_crse_data_tmp, 0, ncomp);
407
408 FillPatchInterp(*m_cf_fine_data, scomp, *m_cf_crse_data_tmp, 0,
409 ncomp, IntVect(0), m_cgeom, m_fgeom,
410 amrex::grow(amrex::convert(m_fgeom.Domain(),
411 mf.ixType()),nghost),
412 m_ratio, m_interp, bcs, bcscomp);
413
414 detail::call_interp_hook(post_interp, *m_cf_fine_data, scomp, ncomp);
415
416 mf.ParallelCopy(*m_cf_fine_data, scomp, dcomp, ncomp, IntVect{0}, nghost);
417 }
418}
419
420template <typename MF>
421template <std::size_t order>
422requires (order == 3 || order == 4)
423void FillPatcher<MF>::storeRKCoarseData (Real /*time*/, Real dt, MF const& S_old,
424 Array<MF,order> const& RK_k)
425{
426 BL_PROFILE("FillPatcher::storeRKCoarseData()");
427 m_dt_coarse = dt;
428 m_cf_crse_data.resize(order+1);
429
430 auto const& fpc = getFPinfo();
431
432 for (auto& tmf : m_cf_crse_data) {
433 tmf.first = std::numeric_limits<Real>::lowest(); // because we don't need it
434 tmf.second = std::make_unique<MF>(detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
435 }
436 m_cf_crse_data[0].second->ParallelCopy(S_old, m_cgeom.periodicity());
437 for (std::size_t i = 0; i < order; ++i) {
438 m_cf_crse_data[i+1].second->ParallelCopy(RK_k[i], m_cgeom.periodicity());
439 }
440}
441
442template <typename MF>
443template <typename BC>
444void FillPatcher<MF>::fillRK (int stage, int iteration, int ncycle,
445 MF& mf, Real time, BC& cbc, BC& fbc,
446 Vector<BCRec> const& bcs)
447{
448 BL_PROFILE("FillPatcher::fillRK()");
449 int rk_order = m_cf_crse_data.size()-1;
450 if (rk_order != 3 && rk_order != 4) {
451 amrex::Abort("FillPatcher: unsupported RK order "+std::to_string(rk_order));
452 return;
453 }
454 AMREX_ASSERT(stage > 0 && stage <= rk_order);
455
456 auto const& fpc = getFPinfo();
457 if (m_cf_crse_data_tmp == nullptr) {
458 m_cf_crse_data_tmp = std::make_unique<MF>
459 (detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
460 }
461
462 auto const& u = m_cf_crse_data_tmp->arrays();
463 auto const& u0 = m_cf_crse_data[0].second->const_arrays();
464 auto const& k1 = m_cf_crse_data[1].second->const_arrays();
465 auto const& k2 = m_cf_crse_data[2].second->const_arrays();
466 auto const& k3 = m_cf_crse_data[3].second->const_arrays();
467
468 Real dtc = m_dt_coarse;
469 Real r = Real(1) / Real(ncycle);
470 Real xsi = Real(iteration-1) / Real(ncycle);
471
472 int const ng_space_interp = 8; // Need to be big enough
473 Box cdomain = m_cgeom.growPeriodicDomain(ng_space_interp);
474 cdomain.convert(m_cf_crse_data_tmp->ixType());
475
476 if (rk_order == 3) {
477 // coefficients for U
478 Real b1 = xsi - Real(5./6.)*xsi*xsi;
479 Real b2 = Real(1./6.)*xsi*xsi;
480 Real b3 = Real(2./3)*xsi*xsi;
481 // coefficients for Ut
482 Real c1 = Real(1.) - Real(5./3.)*xsi;
483 Real c2 = Real(1./3.)*xsi;
484 Real c3 = Real(4./3.)*xsi;
485 // coefficients for Utt
486 constexpr Real d1 = Real(-5./3.);
487 constexpr Real d2 = Real(1./3.);
488 constexpr Real d3 = Real(4./3.);
489 if (stage == 1) {
490 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
491 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
492 {
493 if (cdomain.contains(i,j,k)) {
494 Real kk1 = k1[bi](i,j,k,n);
495 Real kk2 = k2[bi](i,j,k,n);
496 Real kk3 = k3[bi](i,j,k,n);
497 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
498 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*uu;
499 }
500 });
501 } else if (stage == 2) {
502 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
503 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
504 {
505 if (cdomain.contains(i,j,k)) {
506 Real kk1 = k1[bi](i,j,k,n);
507 Real kk2 = k2[bi](i,j,k,n);
508 Real kk3 = k3[bi](i,j,k,n);
509 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
510 Real ut = c1*kk1 + c2*kk2 + c3*kk3;
511 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*(uu + r*ut);
512 }
513 });
514 } else if (stage == 3) {
515 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
516 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
517 {
518 if (cdomain.contains(i,j,k)) {
519 Real kk1 = k1[bi](i,j,k,n);
520 Real kk2 = k2[bi](i,j,k,n);
521 Real kk3 = k3[bi](i,j,k,n);
522 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
523 Real ut = c1*kk1 + c2*kk2 + c3*kk3;
524 Real utt = d1*kk1 + d2*kk2 + d3*kk3;
525 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*
526 (uu + Real(0.5)*r*ut + Real(0.25)*r*r*utt);
527 }
528 });
529 }
530 } else if (rk_order == 4) {
531 auto const& k4 = m_cf_crse_data[4].second->const_arrays();
532 Real xsi2 = xsi*xsi;
533 Real xsi3 = xsi2*xsi;
534 // coefficients for U
535 Real b1 = xsi - Real(1.5)*xsi2 + Real(2./3.)*xsi3;
536 Real b2 = xsi2 - Real(2./3.)*xsi3;
537 Real b3 = b2;
538 Real b4 = Real(-0.5)*xsi2 + Real(2./3.)*xsi3;
539 // coefficients for Ut
540 Real c1 = Real(1.) - Real(3.)*xsi + Real(2.)*xsi2;
541 Real c2 = Real(2.)*xsi - Real(2.)*xsi2;
542 Real c3 = c2;
543 Real c4 = -xsi + Real(2.)*xsi2;
544 // coefficients for Utt
545 Real d1 = Real(-3.) + Real(4.)*xsi;
546 Real d2 = Real( 2.) - Real(4.)*xsi;
547 Real d3 = d2;
548 Real d4 = Real(-1.) + Real(4.)*xsi;
549 // coefficients for Uttt
550 constexpr Real e1 = Real( 4.);
551 constexpr Real e2 = Real(-4.);
552 constexpr Real e3 = Real(-4.);
553 constexpr Real e4 = Real( 4.);
554 if (stage == 1) {
555 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
556 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
557 {
558 if (cdomain.contains(i,j,k)) {
559 Real kk1 = k1[bi](i,j,k,n);
560 Real kk2 = k2[bi](i,j,k,n);
561 Real kk3 = k3[bi](i,j,k,n);
562 Real kk4 = k4[bi](i,j,k,n);
563 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
564 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*uu;
565 }
566 });
567 } else if (stage == 2) {
568 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
569 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
570 {
571 if (cdomain.contains(i,j,k)) {
572 Real kk1 = k1[bi](i,j,k,n);
573 Real kk2 = k2[bi](i,j,k,n);
574 Real kk3 = k3[bi](i,j,k,n);
575 Real kk4 = k4[bi](i,j,k,n);
576 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
577 Real ut = c1*kk1 + c2*kk2 + c3*kk3 + c4*kk4;
578 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*(uu + Real(0.5)*r*ut);
579 }
580 });
581 } else if (stage == 3 || stage == 4) {
582 Real r2 = r*r;
583 Real r3 = r2*r;
584 Real at = (stage == 3) ? Real(0.5)*r : r;
585 Real att = (stage == 3) ? Real(0.25)*r2 : Real(0.5)*r2;
586 Real attt = (stage == 3) ? Real(0.0625)*r3 : Real(0.125)*r3;
587 Real akk = (stage == 3) ? Real(-4.) : Real(4.);
588 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
589 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
590 {
591 if (cdomain.contains(i,j,k)) {
592 Real kk1 = k1[bi](i,j,k,n);
593 Real kk2 = k2[bi](i,j,k,n);
594 Real kk3 = k3[bi](i,j,k,n);
595 Real kk4 = k4[bi](i,j,k,n);
596 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
597 Real ut = c1*kk1 + c2*kk2 + c3*kk3 + c4*kk4;
598 Real utt = d1*kk1 + d2*kk2 + d3*kk3 + d4*kk4;
599 Real uttt = e1*kk1 + e2*kk2 + e3*kk3 + e4*kk4;
600 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc *
601 (uu + at*ut + att*utt + attt*(uttt+akk*(kk3-kk2)));
602 }
603 });
604 }
605 }
606 // Sync required: user callback cbc may read fab on host (e.g. if pinned)
608
609 cbc(*m_cf_crse_data_tmp, 0, m_ncomp, m_cf_crse_data_tmp->nGrowVect(), time, 0);
610
611 if (m_cf_fine_data == nullptr) {
612 m_cf_fine_data = std::make_unique<MF>(detail::make_mf_fine_patch<MF>(fpc, m_ncomp));
613 }
614
615 FillPatchInterp(*m_cf_fine_data, 0, *m_cf_crse_data_tmp, 0,
616 m_ncomp, IntVect(0), m_cgeom, m_fgeom,
617 amrex::grow(amrex::convert(m_fgeom.Domain(),
618 mf.ixType()),m_nghost),
619 m_ratio, m_interp, bcs, 0);
620
621 // xxxxx We can optimize away this ParallelCopy by making a special fpinfo.
622 mf.ParallelCopy(*m_cf_fine_data, 0, 0, m_ncomp, IntVect(0), m_nghost);
623
624 mf.FillBoundary(m_fgeom.periodicity());
625 fbc(mf, 0, m_ncomp, m_nghost, time, 0);
626}
627
628}
629
630#endif
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:551
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_ALWAYS_ASSERT(EX)
Definition AMReX_BLassert.H:50
High-level FillPatch helpers for AMR coarse-to-fine synchronization.
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:676
IndexType ixType() const noexcept
Return index type of this BoxArray.
Definition AMReX_BoxArray.H:1252
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:167
__host__ __device__ BoxND & convert(IndexTypeND< dim > typ) noexcept
Convert the BoxND from the current type into the argument type. This may change the BoxND coordinates...
Definition AMReX_Box.H:1008
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:233
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:51
Definition AMReX_EB2.H:28
static const FPinfo & TheFPinfo(const FabArrayBase &srcfa, const FabArrayBase &dstfa, const IntVect &dstng, const BoxConverter &coarsener, const Geometry &fgeom, const Geometry &cgeom, const EB2::IndexSpace *)
Definition AMReX_FabArrayBase.cpp:2066
FillPatcher is for filling a fine level MultiFab/FabArray.
Definition AMReX_FillPatcher.H:78
void storeRKCoarseData(Real time, Real dt, MF const &S_old, Array< MF, order > const &RK_k)
Store coarse AMR level data for RK3 and RK4.
Definition AMReX_FillPatcher.H:423
void fillCoarseFineBoundary(MF &mf, IntVect const &nghost, Real time, Vector< MF * > const &cmf, Vector< Real > const &ct, int scomp, int dcomp, int ncomp, BC &cbc, int cbccomp, Vector< BCRec > const &bcs, int bcscomp, PreInterpHook const &pre_interp={}, PostInterpHook const &post_interp={})
Function to fill data at coarse/fine boundary only.
Definition AMReX_FillPatcher.H:295
void fill(MF &mf, IntVect const &nghost, Real time, Vector< MF * > const &cmf, Vector< Real > const &ct, Vector< MF * > const &fmf, Vector< Real > const &ft, int scomp, int dcomp, int ncomp, BC &cbc, int cbccomp, BC &fbc, int fbccomp, Vector< BCRec > const &bcs, int bcscomp, PreInterpHook const &pre_interp={}, PostInterpHook const &post_interp={})
Function to fill data.
Definition AMReX_FillPatcher.H:260
void fillRK(int stage, int iteration, int ncycle, MF &mf, Real time, BC &cbc, BC &fbc, Vector< BCRec > const &bcs)
Fill ghost cells of fine AMR level for RK3 and RK4.
Definition AMReX_FillPatcher.H:444
FillPatcher(BoxArray const &fba, DistributionMapping const &fdm, Geometry const &fgeom, BoxArray const &cba, DistributionMapping const &cdm, Geometry const &cgeom, IntVect const &nghost, int ncomp, InterpBase *interp, EB2::IndexSpace const *eb_index_space=EB2::TopIndexSpaceIfPresent())
Constructor of FillPatcher.
Definition AMReX_FillPatcher.H:229
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:75
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:216
__host__ __device__ bool cellCentered() const noexcept
True if the IndexTypeND is CELL based in all directions.
Definition AMReX_IndexType.H:102
__host__ __device__ bool nodeCentered() const noexcept
True if the IndexTypeND is NODE based in all directions.
Definition AMReX_IndexType.H:108
__host__ __device__ constexpr bool allLE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is less than or equal to argument for all components. NOTE: This is NOT a strict...
Definition AMReX_IntVect.H:492
Definition AMReX_InterpBase.H:34
Definition AMReX_InterpBase.H:20
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
Long size() const noexcept
Definition AMReX_Vector.H:54
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a copy of b converted to the nodal flags typ.
Definition AMReX_Box.H:1630
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Return a copy of b grown uniformly by i cells in every direction.
Definition AMReX_Box.H:1326
__host__ __device__ BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Return a copy of b refined by the isotropic ratio ref_ratio.
Definition AMReX_Box.H:1510
std::array< T, N > Array
Definition AMReX_Array.H:31
const IndexSpace * TopIndexSpaceIfPresent() noexcept
Return the top IndexSpace if one has been built (nullptr otherwise).
Definition AMReX_EB2.cpp:93
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:310
Definition AMReX_Amr.cpp:50
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
void FillPatchSingleLevel(MF &mf, IntVect const &nghost, Real time, const Vector< MF * > &smf, const Vector< Real > &stime, int scomp, int dcomp, int ncomp, const Geometry &geom, BC &physbcf, int bcfcomp)
FillPatch with data from the current level.
Definition AMReX_FillPatchUtil_I.H:75
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:241
void FillPatchInterp(MultiFab &mf_fine_patch, int fcomp, MultiFab const &mf_crse_patch, int ccomp, int ncomp, IntVect const &ng, const Geometry &cgeom, const Geometry &fgeom, Box const &dest_domain, const IntVect &ratio, MFInterpolater *mapper, const Vector< BCRec > &bcs, int bcscomp)
Helper that applies a MFInterpolater to fill a fine patch from a coarse patch.
Definition AMReX_FillPatchUtil.cpp:139
Definition AMReX_FabArrayBase.H:304
Definition AMReX_TypeTraits.H:27
FabArray memory allocation information.
Definition AMReX_FabArray.H:68
Definition AMReX_FillPatchUtil.H:39