1#ifndef AMREX_FillPatchUtil_I_H_
2#define AMREX_FillPatchUtil_I_H_
3#include <AMReX_Config.H>
10template <
typename F,
typename MF>
11auto call_interp_hook (
F const& f, MF& mf,
int icomp,
int ncomp)
12 ->
decltype(f(mf[0],
Box(),icomp,ncomp))
15#pragma omp parallel if (Gpu::notInLaunchRegion())
17 for (MFIter mfi(mf); mfi.isValid(); ++mfi) {
19 const Box& dbx = dfab.box();
20 f(dfab, dbx, icomp, ncomp);
24template <
typename F,
typename MF>
25auto call_interp_hook (
F const& f, MF& mf,
int icomp,
int ncomp)
26 ->
decltype(f(mf,icomp,ncomp))
34template <
typename Interp>
38 int ratio_max = ratio[0];
39#if (AMREX_SPACEDIM > 1)
40 ratio_max = std::max(ratio_max, ratio[1]);
42#if (AMREX_SPACEDIM == 3)
43 ratio_max = std::max(ratio_max, ratio[2]);
47 const IntVect& nbuf = blocking_factor / ratio_max;
55 fine_box.
refine(ratio_max);
57 const Box& fine_box_coarsened = mapper->CoarseBox(fine_box, ratio_max);
58 return crse_box.
contains(fine_box_coarsened);
61template <
typename MF,
typename BC>
62std::enable_if_t<IsFabArray<MF>::value>
65 int scomp,
int dcomp,
int ncomp,
67 BC& physbcf,
int bcfcomp)
70 geom, physbcf, bcfcomp);
73template <
typename MF,
typename BC>
74std::enable_if_t<IsFabArray<MF>::value>
77 int scomp,
int dcomp,
int ncomp,
79 BC& physbcf,
int bcfcomp)
84 (scomp+ncomp <= smf[0]->nComp()) &&
85 (dcomp+ncomp <= mf.nComp()) &&
87 nghost.
allLE(mf.nGrowVect()));
90 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
91 src_ghost = physbcf.fp1_src_ghost;
96 if (&mf == smf[0] && scomp == dcomp) {
97 mf.FillBoundary(dcomp, ncomp, nghost, geom.
periodicity());
99 mf.ParallelCopy(*smf[0], scomp, dcomp, ncomp, src_ghost, nghost, geom.
periodicity());
102 else if (smf.
size() == 2)
109 if (mf.boxArray() == smf[0]->boxArray() &&
110 mf.DistributionMap() == smf[0]->DistributionMap())
117 MFInfo(), smf[0]->Factory());
124 if ((dmf != smf[0] && dmf != smf[1]) || scomp != dcomp)
127 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
128 interp_ghost = physbcf.fp1_src_ghost;
130 interp_ghost.
min(nghost);
134#pragma omp parallel if (Gpu::notInLaunchRegion())
138 const Box& bx = mfi.growntilebox(interp_ghost);
139 const Real t0 = stime[0];
140 const Real t1 = stime[1];
141 auto const sfab0 = smf[0]->array(mfi);
142 auto const sfab1 = smf[1]->array(mfi);
143 auto dfab = dmf->array(mfi);
149 dfab(i,j,k,n+destcomp) = sfab0(i,j,k,n+scomp);
156 dfab(i,j,k,n+destcomp) = sfab1(i,j,k,n+scomp);
161 Real alpha = (t1-time)/(t1-t0);
162 Real beta = (time-t0)/(t1-t0);
165 dfab(i,j,k,n+destcomp) = alpha*sfab0(i,j,k,n+scomp)
166 + beta*sfab1(i,j,k,n+scomp);
173 dfab(i,j,k,n+destcomp) = sfab0(i,j,k,n+scomp);
183 mf.FillBoundary(dcomp, ncomp, nghost, geom.
periodicity());
187 mf.ParallelCopy(*dmf, 0, dcomp, ncomp, src_ghost, nghost, geom.
periodicity());
191 amrex::Abort(
"FillPatchSingleLevel: high-order interpolation in time not implemented yet");
194 physbcf(mf, dcomp, ncomp, nghost, time, bcfcomp);
214void FillPatchInterp (MultiFab& mf_fine_patch,
int fcomp, MultiFab
const& mf_crse_patch,
int ccomp,
215 int ncomp,
IntVect const& ng,
const Geometry& cgeom,
const Geometry& fgeom,
217 MFInterpolater* mapper,
const Vector<BCRec>& bcs,
int bcscomp);
219template <
typename MF,
typename Interp>
220std::enable_if_t<IsFabArray<MF>::value && !std::is_same_v<Interp,MFInterpolater>>
231#pragma omp parallel if (Gpu::notInLaunchRegion())
237 auto& sfab = mf_crse_patch[mfi];
238 const Box& sbx = sfab.box();
240 auto& dfab = mf_fine_patch[mfi];
244 mapper->interp(sfab, ccomp, dfab, fcomp, ncomp, dbx, ratio,
245 cgeom, fgeom, bcr, idummy, idummy,
RunOn::Gpu);
250template <
typename MF>
251std::enable_if_t<IsFabArray<MF>::value>
259 ncomp, ng, cgeom, fgeom, dest_domain, ratio,
263 ncomp, ng, cgeom, fgeom, dest_domain, ratio,
270template <
typename MF,
typename iMF,
typename Interp>
271std::enable_if_t<IsFabArray<MF>::value && !std::is_same_v<Interp,MFInterpolater>>
273 MF
const& mf_crse_patch,
int crse_comp,
274 MF& mf_refined_patch,
int fine_comp,
275 int ncomp,
const IntVect& ratio,
276 const iMF& solve_mask,
const Geometry& crse_geom,
const Geometry& fine_geom,
277 int bcscomp,
RunOn gpu_or_cpu,
284 auto& sfab = mf_crse_patch[mfi];
285 const Box& sbx = sfab.box();
286 auto& dfab = mf_refined_patch[mfi];
287 Box const& dbx = dfab.box();
288 auto& ifab = solve_mask[mfi];
290 interp->interp_face(sfab,crse_comp,dfab,fine_comp,ncomp,
291 dbx, ratio, ifab, crse_geom, fine_geom,
292 bcr, bcscomp, gpu_or_cpu);
296template <
typename MF,
typename iMF>
297std::enable_if_t<IsFabArray<MF>::value>
299 MF
const& mf_crse_patch,
int crse_comp,
300 MF& mf_refined_patch,
int fine_comp,
301 int ncomp,
const IntVect& ratio,
302 const iMF& solve_mask,
const Geometry& crse_geom,
const Geometry& fine_geom,
303 int bccomp,
RunOn gpu_or_cpu,
308 mf_crse_patch, crse_comp,mf_refined_patch, fine_comp,
309 ncomp, ratio, solve_mask, crse_geom, fine_geom, bccomp,
314 mf_crse_patch, crse_comp,mf_refined_patch, fine_comp,
315 ncomp, ratio, solve_mask, crse_geom, fine_geom, bccomp,
329 template <
typename MF,
330 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
333 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
335 MF mf_crse_patch(fpc.ba_crse_patch, fpc.dm_patch, ncomp, 0, MFInfo(),
336 *fpc.fact_crse_patch);
337 return mf_crse_patch;
340 template <
typename MF,
341 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
344 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type)
346 MF mf_crse_patch(
amrex::convert(fpc.ba_crse_patch, idx_type), fpc.dm_patch,
347 ncomp, 0, MFInfo(), *fpc.fact_crse_patch);
348 return mf_crse_patch;
351 template <
typename MF,
352 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
355 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
357 MF mf_fine_patch(fpc.ba_fine_patch, fpc.dm_patch, ncomp, 0, MFInfo(),
358 *fpc.fact_fine_patch);
359 return mf_fine_patch;
362 template <
typename MF,
363 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
366 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type)
368 MF mf_fine_patch(
amrex::convert(fpc.ba_fine_patch, idx_type), fpc.dm_patch,
369 ncomp, 0, MFInfo(), *fpc.fact_fine_patch);
370 return mf_fine_patch;
373 template <
typename MF,
374 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
377 MF make_mf_refined_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type,
IntVect ratio)
380 fpc.dm_patch, ncomp, 0, MFInfo(), *fpc.fact_fine_patch);
381 return mf_refined_patch;
384 template <
typename MF,
385 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
388 MF make_mf_crse_mask (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type,
IntVect ratio)
391 fpc.dm_patch, ncomp, 0, MFInfo(), *fpc.fact_fine_patch);
395 template <
typename MF,
396 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
399 void mf_set_domain_bndry (MF &mf, Geometry
const & geom)
401 mf.setDomainBndry(std::numeric_limits<Real>::quiet_NaN(), geom);
407 template <
typename MF,
408 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
411 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
413 return MF(fpc.ba_crse_patch, fpc.dm_patch, ncomp, 0);
416 template <
typename MF,
417 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
420 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type)
422 return MF(
amrex::convert(fpc.ba_crse_patch, idx_type), fpc.dm_patch, ncomp, 0);
425 template <
typename MF,
426 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
429 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
431 return MF(fpc.ba_fine_patch, fpc.dm_patch, ncomp, 0);
434 template <
typename MF,
435 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
438 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type)
440 return MF(
amrex::convert(fpc.ba_fine_patch, idx_type), fpc.dm_patch, ncomp, 0);
443 template <
typename MF,
444 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
447 MF make_mf_refined_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type,
IntVect ratio)
452 template <
typename MF,
453 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
456 MF make_mf_crse_mask (FabArrayBase::FPinfo
const& fpc,
int ncomp,
IndexType idx_type,
IntVect ratio)
461 template <
typename MF,
462 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
465 void mf_set_domain_bndry (MF &, Geometry
const & )
470 template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
471 std::enable_if_t<IsFabArray<MF>::value,
int>
472 FillPatchTwoLevels_doit (MF& mf,
IntVect const& nghost,
Real time,
473 const Vector<MF*>& cmf,
const Vector<Real>& ct,
474 const Vector<MF*>& fmf,
const Vector<Real>& ft,
475 int scomp,
int dcomp,
int ncomp,
476 const Geometry& cgeom,
const Geometry& fgeom,
477 BC& cbc,
int cbccomp,
478 BC& fbc,
int fbccomp,
481 const Vector<BCRec>& bcs,
int bcscomp,
482 const PreInterpHook& pre_interp,
483 const PostInterpHook& post_interp,
484 EB2::IndexSpace
const* index_space,
485 bool return_error_code =
false)
489 int success_code = return_error_code ? 0 : -1;
490 int failure_code = 1;
492 if (nghost.max() > 0 || mf.getBDKey() != fmf[0]->getBDKey())
494 const InterpolaterBoxCoarsener& coarsener = mapper->BoxCoarsener(ratio);
498 + mf.ixType().nodeCentered(1),
499 + mf.ixType().nodeCentered(2) ) == 1 )
501 if ( !
dynamic_cast<Interpolater*
>(mapper) ){
502 amrex::Abort(
"This interpolater has not yet implemented a version for face-based data");
507 mf.DistributionMap(), ncomp, nghost, MFInfo().SetAlloc(
false) );
518 if ( ! fpc.ba_crse_patch.empty())
520 if (return_error_code) {
522 if (!cba.contains(fpc.ba_crse_patch,cgeom.periodicity())) {
527 MF mf_crse_patch = make_mf_crse_patch<MF> (fpc, ncomp, mf.boxArray().ixType());
532 MF mf_refined_patch = make_mf_refined_patch<MF> (fpc, ncomp, mf.boxArray().ixType(), ratio);
533 auto solve_mask = make_mf_crse_mask<iMultiFab>(fpc, ncomp, mf.boxArray().ixType(), ratio);
535 mf_set_domain_bndry(mf_crse_patch, cgeom);
536 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
537 cbc.fp1_src_ghost = cbc.cghost;
540 cgeom, cbc, cbccomp);
542 mf_set_domain_bndry(mf_refined_patch, fgeom);
543 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
544 fbc.fp1_src_ghost =
IntVect(0);
547 fgeom, fbc, fbccomp);
551 ncomp, nghost, MFInfo().SetAlloc(
false) );
552 MF mf_solution(
amrex::coarsen(mf_refined_patch.boxArray(), ratio), mf_refined_patch.DistributionMap(),
553 ncomp, 0, MFInfo().SetAlloc(
false) );
557 cgeom.periodicity());
559 solve_mask.setVal(1);
560 solve_mask.setVal(0, mask_cpc, 0, 1);
562 detail::call_interp_hook(pre_interp, mf_crse_patch, 0, ncomp);
564 InterpFace(mapper, mf_crse_patch, 0, mf_refined_patch, 0, ncomp,
565 ratio, solve_mask, cgeom, fgeom, bcscomp,
RunOn::Gpu, bcs);
567 detail::call_interp_hook(post_interp, mf_refined_patch, 0, ncomp);
569 bool aliasing =
false;
570 for (
auto const& fmf_a : fmf) {
571 aliasing = aliasing || (&mf == fmf_a);
574 mf.ParallelCopyToGhost(mf_refined_patch, 0, dcomp, ncomp,
577 mf.ParallelCopy(mf_refined_patch, 0, dcomp, ncomp,
591 if ( ! fpc.ba_crse_patch.empty())
593 if (return_error_code) {
594 BoxArray
const& cba = cmf[0]->boxArray();
595 if (!cba.contains(fpc.ba_crse_patch,cgeom.periodicity())) {
600 MF mf_crse_patch = make_mf_crse_patch<MF>(fpc, ncomp);
601 mf_set_domain_bndry (mf_crse_patch, cgeom);
603 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
604 cbc.fp1_src_ghost = cbc.cghost;
608 MF mf_fine_patch = make_mf_fine_patch<MF>(fpc, ncomp);
610 detail::call_interp_hook(pre_interp, mf_crse_patch, 0, ncomp);
613 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
614 if (fgeom.isPeriodic(i)) {
615 fdomain_g.grow(i, nghost[i]);
617 if constexpr (std::is_same_v
618 <BC, PhysBCFunctUseCoarseGhost>) {
619 fdomain_g.grow(i, fbc.nghost_outside_domain[i]);
624 ncomp,
IntVect(0), cgeom, fgeom,
625 fdomain_g, ratio, mapper, bcs, bcscomp);
627 detail::call_interp_hook(post_interp, mf_fine_patch, 0, ncomp);
629 mf.ParallelCopy(mf_fine_patch, 0, dcomp, ncomp,
IntVect{0}, nghost);
634 if constexpr(std::is_same_v<BC, PhysBCFunctUseCoarseGhost>) {
635 fbc.fp1_src_ghost =
IntVect(0);
638 fgeom, fbc, fbccomp);
643 template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
644 std::enable_if_t<IsFabArray<MF>::value>
645 FillPatchTwoLevels_doit (Array<MF*, AMREX_SPACEDIM>
const& mf,
IntVect const& nghost,
Real time,
646 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf,
const Vector<Real>& ct,
647 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf,
const Vector<Real>& ft,
648 int scomp,
int dcomp,
int ncomp,
649 const Geometry& cgeom,
const Geometry& fgeom,
650 Array<BC, AMREX_SPACEDIM>& cbc,
const Array<int, AMREX_SPACEDIM>& cbccomp,
651 Array<BC, AMREX_SPACEDIM>& fbc,
const Array<int, AMREX_SPACEDIM>& fbccomp,
654 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs,
const Array<int, AMREX_SPACEDIM>& bcscomp,
655 const PreInterpHook& pre_interp,
656 const PostInterpHook& post_interp,
657 EB2::IndexSpace
const* index_space)
659 BL_PROFILE(
"FillPatchTwoLevels (Array<MF*>)");
661 using FAB =
typename MF::FABType::value_type;
662 using iFAB =
typename iMultiFab::FABType::value_type;
665 && mf[1]->ixType().nodeCentered(1),
666 && mf[2]->ixType().nodeCentered(2)));
681 if (nghost.max() > 0 || mf[0]->getBDKey() != fmf[0][0]->getBDKey())
683 const InterpolaterBoxCoarsener& coarsener = mapper->BoxCoarsener(ratio);
689 fmf[0][0]->
DistributionMap(), ncomp, nghost, MFInfo().SetAlloc(
false) );
698 if ( !fpc.ba_crse_patch.empty() )
700 Array<MF, AMREX_SPACEDIM> mf_crse_patch;
701 Array<MF, AMREX_SPACEDIM> mf_refined_patch;
702 Array<iMultiFab, AMREX_SPACEDIM> solve_mask;
704 for (
int d=0; d<AMREX_SPACEDIM; ++d)
706 mf_crse_patch[d] = make_mf_crse_patch<MF> (fpc, ncomp, mf[d]->
boxArray().ixType());
707 mf_refined_patch[d] = make_mf_refined_patch<MF> (fpc, ncomp, mf[d]->
boxArray().ixType(), ratio);
708 solve_mask[d] = make_mf_crse_mask<iMultiFab>(fpc, ncomp, mf[d]->
boxArray().ixType(), ratio);
710 mf_set_domain_bndry(mf_crse_patch[d], cgeom);
711 Vector<MF*> cmf_time;
712 for (
const auto & mfab : cmf)
713 { cmf_time.push_back(mfab[d]); }
716 cgeom, cbc[d], cbccomp[d]);
718 mf_set_domain_bndry(mf_refined_patch[d], fgeom);
719 Vector<MF*> fmf_time;
720 for (
const auto & mfab : fmf)
721 { fmf_time.push_back(mfab[d]); }
724 fgeom, fbc[d], fbccomp[d]);
729 ncomp, nghost, MFInfo().SetAlloc(
false) );
731 ncomp, 0, MFInfo().SetAlloc(
false) );
735 cgeom.periodicity() );
737 solve_mask[d].setVal(1);
738 solve_mask[d].setVal(0, mask_cpc, 0, 1);
745#pragma omp parallel if (cc && Gpu::notInLaunchRegion() )
748 Vector<Array<BCRec, AMREX_SPACEDIM> > bcr(ncomp);
749 for (MFIter mfi(mf_refined_patch[0]); mfi.isValid(); ++mfi)
751 Array<FAB*, AMREX_SPACEDIM> sfab{
AMREX_D_DECL( &(mf_crse_patch[0][mfi]),
752 &(mf_crse_patch[1][mfi]),
753 &(mf_crse_patch[2][mfi]) )};
754 Array<FAB*, AMREX_SPACEDIM> dfab{
AMREX_D_DECL( &(mf_refined_patch[0][mfi]),
755 &(mf_refined_patch[1][mfi]),
756 &(mf_refined_patch[2][mfi]) )};
757 Array<iFAB*, AMREX_SPACEDIM> mfab{
AMREX_D_DECL( &(solve_mask[0][mfi]),
758 &(solve_mask[1][mfi]),
759 &(solve_mask[2][mfi]) )};
764 for (
int d=0; d<AMREX_SPACEDIM; ++d)
766 Vector<BCRec> bcr_d(ncomp);
769 bcscomp[d],0,ncomp,bcs[d],bcr_d);
771 for (
int n=0; n<ncomp; ++n)
772 { bcr[n][d] = bcr_d[n]; }
775 pre_interp(sfab, sbx_cc, 0, ncomp);
777 mapper->interp_arr(sfab, 0, dfab, 0, ncomp, dbx_cc, ratio, mfab,
778 cgeom, fgeom, bcr, idummy, idummy,
RunOn::Gpu);
780 post_interp(dfab, dbx_cc, 0, ncomp);
784 for (
int d=0; d<AMREX_SPACEDIM; ++d)
786 bool aliasing =
false;
787 for (
auto const& fmf_a : fmf) {
788 aliasing = aliasing || (mf[d] == fmf_a[d]);
791 mf[d]->ParallelCopyToGhost(mf_refined_patch[d], 0, dcomp, ncomp,
794 mf[d]->ParallelCopy(mf_refined_patch[d], 0, dcomp, ncomp,
801 for (
int d=0; d<AMREX_SPACEDIM; ++d)
803 Vector<MF*> fmf_time;
804 for (
auto const& ffab : fmf)
805 { fmf_time.push_back(ffab[d]); }
808 fgeom, fbc[d], fbccomp[d]);
815template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
816std::enable_if_t<IsFabArray<MF>::value>
820 int scomp,
int dcomp,
int ncomp,
822 BC& cbc,
int cbccomp,
823 BC& fbc,
int fbccomp,
827 const PreInterpHook& pre_interp,
828 const PostInterpHook& post_interp)
835 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
836 scomp,dcomp,ncomp,cgeom,fgeom,
837 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
838 pre_interp,post_interp,index_space);
841template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
842std::enable_if_t<IsFabArray<MF>::value>
846 int scomp,
int dcomp,
int ncomp,
848 BC& cbc,
int cbccomp,
849 BC& fbc,
int fbccomp,
853 const PreInterpHook& pre_interp,
854 const PostInterpHook& post_interp)
862 detail::FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft,
863 scomp,dcomp,ncomp,cgeom,fgeom,
864 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
865 pre_interp,post_interp,index_space);
868template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
869std::enable_if_t<IsFabArray<MF>::value>
873 int scomp,
int dcomp,
int ncomp,
880 const PreInterpHook& pre_interp,
881 const PostInterpHook& post_interp)
889 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
890 scomp,dcomp,ncomp,cgeom,fgeom,
891 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
892 pre_interp,post_interp,index_space);
895template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
896std::enable_if_t<IsFabArray<MF>::value>
900 int scomp,
int dcomp,
int ncomp,
907 const PreInterpHook& pre_interp,
908 const PostInterpHook& post_interp)
920 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
921 scomp,dcomp,ncomp,cgeom,fgeom,
922 cbc,cbccomp_arr,fbc,fbccomp_arr,ratio,mapper,bcs,bcscomp_arr,
923 pre_interp,post_interp,index_space);
926template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
927std::enable_if_t<IsFabArray<MF>::value>
931 int scomp,
int dcomp,
int ncomp,
938 const PreInterpHook& pre_interp,
939 const PostInterpHook& post_interp)
951 detail::FillPatchTwoLevels_doit(mf,mf[0]->
nGrowVect(),time,cmf,ct,fmf,ft,
952 scomp,dcomp,ncomp,cgeom,fgeom,
953 cbc,cbccomp_arr,fbc,fbccomp_arr,ratio,mapper,bcs,bcscomp_arr,
954 pre_interp,post_interp,index_space);
958template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
959std::enable_if_t<IsFabArray<MF>::value>
964 int scomp,
int dcomp,
int ncomp,
966 BC& cbc,
int cbccomp,
967 BC& fbc,
int fbccomp,
971 const PreInterpHook& pre_interp,
972 const PostInterpHook& post_interp)
974 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
975 scomp,dcomp,ncomp,cgeom,fgeom,
976 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
977 pre_interp,post_interp,&index_space);
980template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
981std::enable_if_t<IsFabArray<MF>::value>
986 int scomp,
int dcomp,
int ncomp,
988 BC& cbc,
int cbccomp,
989 BC& fbc,
int fbccomp,
993 const PreInterpHook& pre_interp,
994 const PostInterpHook& post_interp)
996 detail::FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft,
997 scomp,dcomp,ncomp,cgeom,fgeom,
998 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
999 pre_interp,post_interp,&index_space);
1003template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1004std::enable_if_t<IsFabArray<MF>::value>
1006 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
1008 BC& cbc,
int cbccomp,
1009 BC& fbc,
int fbccomp,
1013 const PreInterpHook& pre_interp,
1014 const PostInterpHook& post_interp)
1022 InterpFromCoarseLevel(mf,mf.nGrowVect(),time,index_space,cmf,scomp,dcomp,ncomp,cgeom,fgeom,
1023 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
1024 pre_interp,post_interp);
1027template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1028std::enable_if_t<IsFabArray<MF>::value>
1037 const PreInterpHook& pre_interp,
1038 const PostInterpHook& post_interp)
1041 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
1042 pre_interp,post_interp);
1045template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1046std::enable_if_t<IsFabArray<MF>::value>
1048 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
1050 BC& cbc,
int cbccomp,
1051 BC& fbc,
int fbccomp,
1055 const PreInterpHook& pre_interp,
1056 const PostInterpHook& post_interp)
1064 InterpFromCoarseLevel(mf,nghost,time,index_space,cmf,scomp,dcomp,ncomp,cgeom,fgeom,
1065 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
1066 pre_interp,post_interp);
1069template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1070std::enable_if_t<IsFabArray<MF>::value>
1073 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
1075 BC& cbc,
int cbccomp,
1076 BC& fbc,
int fbccomp,
1080 const PreInterpHook& pre_interp,
1081 const PostInterpHook& post_interp)
1085 using FAB =
typename MF::FABType::value_type;
1089 const BoxArray& ba = mf.boxArray();
1097 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
1099 fdomain_g.
grow(i, nghost[i]);
1101 if constexpr (std::is_same_v<BC, PhysBCFunctUseCoarseGhost>) {
1102 fdomain_g.
grow(i, fbc.nghost_outside_domain[i]);
1108 IntVect send_ghost(0), recv_ghost(0);
1109 if constexpr (std::is_same_v<BC, PhysBCFunctUseCoarseGhost>) {
1110 mf_crse_patch.define(
amrex::coarsen(ba,ratio), dm, ncomp, fbc.src_ghost);
1111 send_ghost = fbc.cghost;
1112 recv_ghost = fbc.src_ghost;
1116 for (
int i = 0, N = ba.
size(); i < N; ++i)
1120 ba_crse_patch.
set(i, coarsener.
doit(bx));
1130 mf_crse_patch.define(ba_crse_patch, dm, ncomp, 0,
MFInfo(), *factory);
1134 mf_crse_patch.define(ba_crse_patch, dm, ncomp, 0);
1136 detail::mf_set_domain_bndry (mf_crse_patch, cgeom);
1139 mf_crse_patch.ParallelCopy(cmf, scomp, 0, ncomp, send_ghost, recv_ghost,
1142 cbc(mf_crse_patch, 0, ncomp, mf_crse_patch.nGrowVect(), time, cbccomp);
1144 detail::call_interp_hook(pre_interp, mf_crse_patch, 0, ncomp);
1146 FillPatchInterp(mf, dcomp, mf_crse_patch, 0, ncomp, nghost, cgeom, fgeom, fdomain_g,
1147 ratio, mapper, bcs, bcscomp);
1150#pragma omp parallel if (Gpu::notInLaunchRegion())
1154 FAB& dfab = mf[mfi];
1155 Box dfab_bx = dfab.box();
1156 dfab_bx.
grow(nghost-mf.nGrowVect());
1157 const Box& dbx = dfab_bx & fdomain_g;
1159 post_interp(dfab, dbx, dcomp, ncomp);
1162 fbc(mf, dcomp, ncomp, nghost, time, fbccomp);
1165template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1166std::enable_if_t<IsFabArray<MF>::value>
1175 const PreInterpHook& pre_interp,
1176 const PostInterpHook& post_interp)
1180 using FAB =
typename MF::FABType::value_type;
1181 using iFAB =
typename iMultiFab::FABType::value_type;
1184 const BoxArray& ba = mf[0]->boxArray();
1188 && mf[1]->ixType().nodeCentered(1),
1189 && mf[2]->ixType().nodeCentered(2)));
1204 for (
int d=0; d<AMREX_SPACEDIM; ++d) {
1205 if (nghost[d] % ratio[d] != 0) {
1206 nghost_adj[d] += ratio[d] - (nghost[d] % ratio[d]);
1211 int dcomp_adj = dcomp;
1213 if (! nghost.
allGE(nghost_adj)) {
1214 for (
int d=0; d<AMREX_SPACEDIM; ++d) {
1215 mf_temp[d] = std::make_unique<MF>(mf[d]->
boxArray(),
1217 mf_local[d] = mf_temp[d].get();
1225 Box fdomain_g(fdomain);
1226 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
1228 fdomain_g.
grow(d,nghost_adj[d]);
1235 for (
int i = 0, N = ba.
size(); i < N; ++i)
1239 ba_crse_patch.
set(i, coarsener.
doit(bx));
1244 for (
int d = 0; d<AMREX_SPACEDIM; ++d)
1251 mf_crse_patch[d].define(ba_crse_idxed, dm, ncomp, 0,
MFInfo(), *crse_factory);
1253 mf_crse_patch[d].define(ba_crse_idxed, dm, ncomp, 0);
1255 detail::mf_set_domain_bndry(mf_crse_patch[d], cgeom);
1257 mf_crse_patch[d].ParallelCopy(*(cmf[d]), scomp, 0, ncomp, cgeom.
periodicity());
1258 cbc[d](mf_crse_patch[d], 0, ncomp, mf_crse_patch[d].nGrowVect(), time, cbccomp);
1261 int idummy1=0, idummy2=0;
1263#pragma omp parallel if (Gpu::notInLaunchRegion())
1274 &(mf_crse_patch[1][mfi]),
1275 &(mf_crse_patch[2][mfi]) )};
1277 &(*mf_local[1])[mfi],
1278 &(*mf_local[2])[mfi] )};
1282 const Box& dbx_cc = dfab_cc & fdomain_g;
1284 for (
int d=0; d<AMREX_SPACEDIM; ++d)
1290 bcscomp,0,ncomp,bcs[d],bcr_d);
1292 for (
int n=0; n<ncomp; ++n)
1293 { bcr[n][d] = bcr_d[n]; }
1296 pre_interp(sfab, sbx_cc, 0, ncomp);
1298 mapper->interp_arr(sfab, 0, dfab, 0, ncomp, dbx_cc, ratio, mfab,
1299 cgeom, fgeom, bcr, idummy1, idummy2,
RunOn::Gpu);
1301 post_interp(dfab, dbx_cc, 0, ncomp);
1305 for (
int d=0; d<AMREX_SPACEDIM; ++d)
1307 if (mf[d] != mf_local[d]) {
1308 amrex::Copy(*mf[d], *mf_local[d], 0, dcomp_adj, ncomp, nghost);
1311 fbc[d](*mf[d], dcomp, ncomp, nghost, time, fbccomp);
1315template <
typename MF,
typename Interp>
1316std::enable_if_t<IsFabArray<MF>::value>
1318 IntVect const& nghost_outside_domain,
1319 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
1321 const IntVect& ratio, Interp* mapper,
1326 cgeom, fgeom, erfbc, 0, erfbc, 0, ratio, mapper,
1330template <
typename MF>
1331std::enable_if_t<IsFabArray<MF>::value>
1334 const Vector<Real>& stime,
int scomp,
int dcomp,
int ncomp,
1342template <
typename MF,
typename Interp>
1343std::enable_if_t<IsFabArray<MF>::value>
1348 int scomp,
int dcomp,
int ncomp,
1350 const IntVect& ratio, Interp* mapper,
1356 FillPatchTwoLevels(mf, nghost, time, cmf, ct, fmf, ft, scomp, dcomp, ncomp,
1357 cgeom, fgeom, erfbc, 0, erfbc, 0, ratio, mapper,
1361template <
typename MF,
typename BC,
typename Interp>
1362std::enable_if_t<IsFabArray<MF>::value>
1365 int scomp,
int dcomp,
int ncomp,
1380 auto get_clayout = [&] () -> std::tuple<BoxArray,BoxArray,DistributionMapping>
1385 BoxArray const& ba = mf.boxArray();
1386 auto const& typ = ba.
ixType();
1387 std::map<int,Vector<Box>> extra_boxes_map;
1390 for (
int i = 0, N =
int(ba.
size()); i < N; ++i) {
1391 Box const& cbox = mapper->CoarseBox(
amrex::grow(ba[i],nghost),ratio[level-1]);
1393 Box gdomain = geom[level-1].growNonPeriodicDomain(cbox.
length());
1396 auto& extra_boxes = extra_boxes_map[i];
1397 auto const& pshift = geom[level-1].periodicity().shiftIntVect();
1398 for (
auto const& piv : pshift) {
1401 extra_boxes.push_back(ibox);
1409 if (!extra_boxes_map.empty()) {
1411 auto& lbox = cbl2.
data();
1414 for (
auto const& [i, vb] : extra_boxes_map) {
1416 for (
int j = 1, nj =
int(vb.size()); j < nj; ++j) {
1417 lbox.push_back(vb[j]);
1418 procmap2.push_back(dm[i]);
1425 return std::make_tuple(
BoxArray(std::move(cbl)), cba2, dm2);
1436 level <
int(bc.
size()) &&
1437 level <
int(ratio.
size()+1));
1441 }
else if (level >=
int(smf.size()))
1443 auto const& [ba1, ba2, dm2] = get_clayout();
1448 mf.DistributionMap(), {0,0,0},
1450 cmf1.define(ba1, mf.DistributionMap(), ncomp, 0,
MFInfo(), *factory);
1455 cmf2.define(ba2, dm2, ncomp, 0,
MFInfo(), *factory2);
1460 cmf1.define(ba1, mf.DistributionMap(), ncomp, 0);
1462 cmf2.define(ba2, dm2, ncomp, 0);
1466 MF* p_mf_inside = (ba2.empty()) ? &cmf1 : &cmf2;
1468 geom, bc, bccomp, ratio, mapper, bcr, bcrcomp);
1469 if (&cmf1 != p_mf_inside) {
1470 cmf1.ParallelCopy(*p_mf_inside, geom[level-1].periodicity());
1472 Box domain_g = geom[level].growPeriodicDomain(nghost);
1473 domain_g.
convert(mf.ixType());
1474 FillPatchInterp(mf, dcomp, cmf1, 0, ncomp, nghost, geom[level-1], geom[level],
1475 domain_g, ratio[level-1], mapper, bcr, bcrcomp);
1478 int error_code = detail::FillPatchTwoLevels_doit(mf, nghost, time,
1479 smf[level-1], st[level-1],
1480 smf[level ], st[level ],
1481 scomp, dcomp, ncomp,
1482 geom[level-1], geom[level],
1483 bc[level-1], bccomp,
1485 ratio[level-1], mapper, bcr, bcrcomp,
1486 hook, hook, index_space,
true);
1487 if (error_code == 0) {
return; }
1489 auto const& [ba1, ba2, dm2] = get_clayout();
1495 mf.DistributionMap(), {0,0,0},
1497 cmf_tmp.define(ba1, mf.DistributionMap(), ncomp, 0,
MFInfo(), *factory);
1502 cmf_tmp.define(ba2, dm2, ncomp, 0,
MFInfo(), *factory);
1508 cmf_tmp.define(ba1, mf.DistributionMap(), ncomp, 0);
1510 cmf_tmp.define(ba2, dm2, ncomp, 0);
1515 geom, bc, bccomp, ratio, mapper, bcr, bcrcomp);
1521 for (
auto const* p : fmf) {
1526 detail::FillPatchTwoLevels_doit(mf, nghost, time,
1530 geom[level-1], geom[level],
1531 bc[level-1], bccomp,
1533 ratio[level-1], mapper, bcr, bccomp,
1534 hook, hook, index_space);
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:551
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX, MSG)
Definition AMReX_BLassert.H:49
#define BL_ASSERT(EX)
Definition AMReX_BLassert.H:39
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_ALWAYS_ASSERT(EX)
Definition AMReX_BLassert.H:50
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:111
#define AMREX_D_TERM(a, b, c)
Definition AMReX_SPACE.H:172
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:568
IndexType ixType() const noexcept
Return index type of this BoxArray.
Definition AMReX_BoxArray.H:858
static bool SameRefs(const BoxArray &lhs, const BoxArray &rhs)
whether two BoxArrays share the same data
Definition AMReX_BoxArray.H:841
Long size() const noexcept
Return the number of boxes in the BoxArray.
Definition AMReX_BoxArray.H:615
void set(int i, const Box &ibox)
Set element i in this BoxArray to Box ibox.
Definition AMReX_BoxArray.cpp:878
A class for managing a List of Boxes that share a common IndexType. This class implements operations ...
Definition AMReX_BoxList.H:52
Vector< Box > & data() noexcept
Returns a reference to the Vector<Box>.
Definition AMReX_BoxList.H:215
void reserve(std::size_t n)
Definition AMReX_BoxList.H:90
void push_back(const Box &bn)
Append a Box to this BoxList.
Definition AMReX_BoxList.H:93
__host__ __device__ BoxND & grow(int i) noexcept
Definition AMReX_Box.H:641
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:154
__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:974
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:212
__host__ __device__ IndexTypeND< dim > ixType() const noexcept
Return the indexing type.
Definition AMReX_Box.H:135
__host__ __device__ BoxND & refine(int ref_ratio) noexcept
Refine BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo*ratio...
Definition AMReX_Box.H:698
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:43
const Vector< int > & ProcessorMap() const noexcept
Returns a constant reference to the mapping of boxes in the underlying BoxArray to the CPU that holds...
Definition AMReX_DistributionMapping.cpp:47
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:2065
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:74
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:211
Periodicity periodicity() const noexcept
Definition AMReX_Geometry.H:356
bool isPeriodic(int dir) const noexcept
Is the domain periodic in the specified direction?
Definition AMReX_Geometry.H:332
__host__ __device__ constexpr CellIndex ixType(int dir) const noexcept
Returns the CellIndex in direction dir.
Definition AMReX_IndexType.H:119
__host__ __device__ constexpr int min() const noexcept
minimum (no absolute values) value
Definition AMReX_IntVect.H:232
__host__ __device__ constexpr bool allGE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is greater than or equal to argument for all components. NOTE: This is NOT a str...
Definition AMReX_IntVect.H:450
__host__ static __device__ constexpr IntVectND< dim > TheZeroVector() noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:679
__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:400
Definition AMReX_InterpBase.H:34
Definition AMReX_InterpBase.H:20
Box doit(const Box &fine) const override
Apply the coarse-box logic to the supplied fine box.
Definition AMReX_InterpBase.cpp:10
Virtual base class for interpolaters.
Definition AMReX_Interpolater.H:27
Definition AMReX_MFInterpolater.H:20
Iterator for looping ever tiles and boxes of amrex::FabArray based containers.
Definition AMReX_MFIter.H:85
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:169
Definition AMReX_PhysBCFunct.H:127
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
Long size() const noexcept
Definition AMReX_Vector.H:53
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
std::unique_ptr< EBFArrayBoxFactory > makeEBFabFactory(const Geometry &a_geom, const BoxArray &a_ba, const DistributionMapping &a_dm, const Vector< int > &a_ngrow, EBSupport a_support)
Definition AMReX_EBFabFactory.cpp:215
__host__ __device__ BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) coarsening ratio.
Definition AMReX_Box.H:1409
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition AMReX_Box.H:1280
__host__ __device__ BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Definition AMReX_Box.H:1459
std::array< T, N > Array
Definition AMReX_Array.H:26
const IndexSpace * TopIndexSpaceIfPresent() noexcept
Definition AMReX_EB2.cpp:93
Definition AMReX_Amr.cpp:49
@ make_alias
Definition AMReX_MakeType.H:7
__host__ __device__ void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition AMReX.H:139
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a BoxND with different type.
Definition AMReX_Box.H:1558
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2866
IntVect nGrowVect(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2856
std::enable_if_t< IsFabArray< MF >::value > FillPatchNLevels(MF &mf, int level, const IntVect &nghost, Real time, const Vector< Vector< MF * > > &smf, const Vector< Vector< Real > > &st, int scomp, int dcomp, int ncomp, const Vector< Geometry > &geom, Vector< BC > &bc, int bccomp, const Vector< IntVect > &ratio, Interp *mapper, const Vector< BCRec > &bcr, int bcrcomp)
FillPatch with data from AMR levels.
Definition AMReX_FillPatchUtil_I.H:1363
RunOn
Definition AMReX_GpuControl.H:69
bool ProperlyNested(const IntVect &ratio, const IntVect &blocking_factor, int ngrow, const IndexType &boxType, Interp *mapper)
Test if AMR grids are properly nested.
Definition AMReX_FillPatchUtil_I.H:35
std::enable_if_t< IsFabArray< MF >::value > 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
void Copy(FabArray< DFAB > &dst, FabArray< SFAB > const &src, int srccomp, int dstcomp, int numcomp, int nghost)
Definition AMReX_FabArray.H:180
std::enable_if_t< IsFabArray< MF >::value > FillPatchTwoLevels(MF &mf, IntVect const &nghost, Real time, const Vector< MF * > &cmf, const Vector< Real > &ct, const Vector< MF * > &fmf, const Vector< Real > &ft, int scomp, int dcomp, int ncomp, const Geometry &cgeom, const Geometry &fgeom, BC &cbc, int cbccomp, BC &fbc, int fbccomp, const IntVect &ratio, Interp *mapper, const Vector< BCRec > &bcs, int bcscomp, const PreInterpHook &pre_interp={}, const PostInterpHook &post_interp={})
FillPatch with data from the current level and the level below.
Definition AMReX_FillPatchUtil_I.H:817
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:30
std::enable_if_t< IsFabArray< MF >::value > InterpFromCoarseLevel(MF &mf, Real time, const MF &cmf, int scomp, int dcomp, int ncomp, const Geometry &cgeom, const Geometry &fgeom, BC &cbc, int cbccomp, BC &fbc, int fbccomp, const IntVect &ratio, Interp *mapper, const Vector< BCRec > &bcs, int bcscomp, const PreInterpHook &pre_interp={}, const PostInterpHook &post_interp={})
Fill with interpolation of coarse level data.
Definition AMReX_FillPatchUtil_I.H:1005
__host__ __device__ BoxND< dim > shift(const BoxND< dim > &b, int dir, int nzones) noexcept
Return a BoxND with indices shifted by nzones in dir direction.
Definition AMReX_Box.H:1495
IndexTypeND< 3 > IndexType
IndexType is an alias for amrex::IndexTypeND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:36
std::enable_if_t< IsFabArray< MF >::value &&!std::is_same_v< Interp, MFInterpolater > > InterpFace(Interp *interp, MF const &mf_crse_patch, int crse_comp, MF &mf_refined_patch, int fine_comp, int ncomp, const IntVect &ratio, const iMF &solve_mask, const Geometry &crse_geom, const Geometry &fine_geom, int bcscomp, RunOn gpu_or_cpu, const Vector< BCRec > &bcs)
Definition AMReX_FillPatchUtil_I.H:272
__host__ __device__ std::enable_if_t< std::is_floating_point_v< T >, bool > almostEqual(T x, T y, int ulp=2)
Definition AMReX_Algorithm.H:122
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:33
bool TilingIfNotGPU() noexcept
Definition AMReX_MFIter.H:12
void setBC(const Box &bx, const Box &domain, int src_comp, int dest_comp, int ncomp, const Vector< BCRec > &bc_dom, Vector< BCRec > &bcr) noexcept
Function for setting array of BCs.
Definition AMReX_BCRec.cpp:8
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:240
BoxArray const & boxArray(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2861
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:140
FabArray memory allocation information.
Definition AMReX_FabArray.H:66
Definition AMReX_FillPatchUtil.H:39