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)
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);
197void FillPatchInterp (MultiFab& mf_fine_patch,
int fcomp, MultiFab
const& mf_crse_patch,
int ccomp,
198 int ncomp,
IntVect const& ng,
const Geometry& cgeom,
const Geometry& fgeom,
200 MFInterpolater* mapper,
const Vector<BCRec>& bcs,
int bcscomp);
202template <
typename MF,
typename Interp>
203std::enable_if_t<IsFabArray<MF>::value && !std::is_same_v<Interp,MFInterpolater>>
214#pragma omp parallel if (Gpu::notInLaunchRegion())
220 auto& sfab = mf_crse_patch[mfi];
221 const Box& sbx = sfab.box();
223 auto& dfab = mf_fine_patch[mfi];
227 mapper->interp(sfab, ccomp, dfab, fcomp, ncomp, dbx, ratio,
228 cgeom, fgeom, bcr, idummy, idummy,
RunOn::Gpu);
233template <
typename MF>
234std::enable_if_t<IsFabArray<MF>::value>
242 ncomp, ng, cgeom, fgeom, dest_domain, ratio,
246 ncomp, ng, cgeom, fgeom, dest_domain, ratio,
253template <
typename MF,
typename iMF,
typename Interp>
254std::enable_if_t<IsFabArray<MF>::value && !std::is_same_v<Interp,MFInterpolater>>
256 MF
const& mf_crse_patch,
int crse_comp,
257 MF& mf_refined_patch,
int fine_comp,
258 int ncomp,
const IntVect& ratio,
259 const iMF& solve_mask,
const Geometry& crse_geom,
const Geometry& fine_geom,
260 int bcscomp,
RunOn gpu_or_cpu,
267 auto& sfab = mf_crse_patch[mfi];
268 const Box& sbx = sfab.box();
269 auto& dfab = mf_refined_patch[mfi];
270 Box const& dbx = dfab.box();
271 auto& ifab = solve_mask[mfi];
273 interp->interp_face(sfab,crse_comp,dfab,fine_comp,ncomp,
274 dbx, ratio, ifab, crse_geom, fine_geom,
275 bcr, bcscomp, gpu_or_cpu);
279template <
typename MF,
typename iMF>
280std::enable_if_t<IsFabArray<MF>::value>
282 MF
const& mf_crse_patch,
int crse_comp,
283 MF& mf_refined_patch,
int fine_comp,
284 int ncomp,
const IntVect& ratio,
285 const iMF& solve_mask,
const Geometry& crse_geom,
const Geometry& fine_geom,
286 int bccomp,
RunOn gpu_or_cpu,
291 mf_crse_patch, crse_comp,mf_refined_patch, fine_comp,
292 ncomp, ratio, solve_mask, crse_geom, fine_geom, bccomp,
297 mf_crse_patch, crse_comp,mf_refined_patch, fine_comp,
298 ncomp, ratio, solve_mask, crse_geom, fine_geom, bccomp,
312 template <
typename MF,
313 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
316 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
318 MF mf_crse_patch(fpc.ba_crse_patch, fpc.dm_patch, ncomp, 0, MFInfo(),
319 *fpc.fact_crse_patch);
320 return mf_crse_patch;
323 template <
typename MF,
324 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
327 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type)
329 MF mf_crse_patch(
amrex::convert(fpc.ba_crse_patch, idx_type), fpc.dm_patch,
330 ncomp, 0, MFInfo(), *fpc.fact_crse_patch);
331 return mf_crse_patch;
334 template <
typename MF,
335 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
338 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
340 MF mf_fine_patch(fpc.ba_fine_patch, fpc.dm_patch, ncomp, 0, MFInfo(),
341 *fpc.fact_fine_patch);
342 return mf_fine_patch;
345 template <
typename MF,
346 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
349 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type)
351 MF mf_fine_patch(
amrex::convert(fpc.ba_fine_patch, idx_type), fpc.dm_patch,
352 ncomp, 0, MFInfo(), *fpc.fact_fine_patch);
353 return mf_fine_patch;
356 template <
typename MF,
357 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
360 MF make_mf_refined_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type, IntVect ratio)
363 fpc.dm_patch, ncomp, 0, MFInfo(), *fpc.fact_fine_patch);
364 return mf_refined_patch;
367 template <
typename MF,
368 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
371 MF make_mf_crse_mask (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type, IntVect ratio)
374 fpc.dm_patch, ncomp, 0, MFInfo(), *fpc.fact_fine_patch);
378 template <
typename MF,
379 std::enable_if_t<std::is_same_v<
typename MF::FABType::value_type,
382 void mf_set_domain_bndry (MF &mf, Geometry
const & geom)
384 mf.setDomainBndry(std::numeric_limits<Real>::quiet_NaN(), geom);
390 template <
typename MF,
391 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
394 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
396 return MF(fpc.ba_crse_patch, fpc.dm_patch, ncomp, 0);
399 template <
typename MF,
400 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
403 MF make_mf_crse_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type)
405 return MF(
amrex::convert(fpc.ba_crse_patch, idx_type), fpc.dm_patch, ncomp, 0);
408 template <
typename MF,
409 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
412 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp)
414 return MF(fpc.ba_fine_patch, fpc.dm_patch, ncomp, 0);
417 template <
typename MF,
418 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
421 MF make_mf_fine_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type)
423 return MF(
amrex::convert(fpc.ba_fine_patch, idx_type), fpc.dm_patch, ncomp, 0);
426 template <
typename MF,
427 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
430 MF make_mf_refined_patch (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type, IntVect ratio)
435 template <
typename MF,
436 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
439 MF make_mf_crse_mask (FabArrayBase::FPinfo
const& fpc,
int ncomp, IndexType idx_type, IntVect ratio)
444 template <
typename MF,
445 std::enable_if_t<!std::is_same_v<
typename MF::FABType::value_type,
448 void mf_set_domain_bndry (MF &, Geometry
const & )
453 template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
454 std::enable_if_t<IsFabArray<MF>::value,
int>
455 FillPatchTwoLevels_doit (MF& mf, IntVect
const& nghost, Real time,
456 const Vector<MF*>& cmf,
const Vector<Real>& ct,
457 const Vector<MF*>& fmf,
const Vector<Real>& ft,
458 int scomp,
int dcomp,
int ncomp,
459 const Geometry& cgeom,
const Geometry& fgeom,
460 BC& cbc,
int cbccomp,
461 BC& fbc,
int fbccomp,
462 const IntVect& ratio,
464 const Vector<BCRec>& bcs,
int bcscomp,
465 const PreInterpHook& pre_interp,
466 const PostInterpHook& post_interp,
467 EB2::IndexSpace
const* index_space,
468 bool return_error_code =
false)
472 int success_code = return_error_code ? 0 : -1;
473 int failure_code = 1;
475 if (nghost.max() > 0 || mf.getBDKey() != fmf[0]->getBDKey())
477 const InterpolaterBoxCoarsener& coarsener = mapper->BoxCoarsener(ratio);
481 + mf.ixType().nodeCentered(1),
482 + mf.ixType().nodeCentered(2) ) == 1 )
484 if ( !
dynamic_cast<Interpolater*
>(mapper) ){
485 amrex::Abort(
"This interpolater has not yet implemented a version for face-based data");
489 MF mf_cc_dummy(
amrex::convert(mf.boxArray(), IntVect::TheZeroVector()),
490 mf.DistributionMap(), ncomp, nghost, MFInfo().SetAlloc(
false) );
494 const FabArrayBase::FPinfo& fpc = FabArrayBase::TheFPinfo(fmf_cc_dummy, mf_cc_dummy,
501 if ( ! fpc.ba_crse_patch.empty())
503 if (return_error_code) {
505 if (!cba.contains(fpc.ba_crse_patch,cgeom.periodicity())) {
510 MF mf_crse_patch = make_mf_crse_patch<MF> (fpc, ncomp, mf.boxArray().ixType());
515 MF mf_refined_patch = make_mf_refined_patch<MF> (fpc, ncomp, mf.boxArray().ixType(), ratio);
516 auto solve_mask = make_mf_crse_mask<iMultiFab>(fpc, ncomp, mf.boxArray().ixType(), ratio);
518 mf_set_domain_bndry(mf_crse_patch, cgeom);
519 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
520 cbc.fp1_src_ghost = cbc.cghost;
523 cgeom, cbc, cbccomp);
525 mf_set_domain_bndry(mf_refined_patch, fgeom);
526 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
527 fbc.fp1_src_ghost =
IntVect(0);
530 fgeom, fbc, fbccomp);
534 ncomp, nghost, MFInfo().SetAlloc(
false) );
535 MF mf_solution(
amrex::coarsen(mf_refined_patch.boxArray(), ratio), mf_refined_patch.DistributionMap(),
536 ncomp, 0, MFInfo().SetAlloc(
false) );
538 const FabArrayBase::CPC mask_cpc( mf_solution, IntVect::TheZeroVector(),
539 mf_known, IntVect::TheZeroVector(),
540 cgeom.periodicity());
542 solve_mask.setVal(1);
543 solve_mask.setVal(0, mask_cpc, 0, 1);
545 detail::call_interp_hook(pre_interp, mf_crse_patch, 0, ncomp);
547 InterpFace(mapper, mf_crse_patch, 0, mf_refined_patch, 0, ncomp,
548 ratio, solve_mask, cgeom, fgeom, bcscomp, RunOn::Gpu, bcs);
550 detail::call_interp_hook(post_interp, mf_refined_patch, 0, ncomp);
552 bool aliasing =
false;
553 for (
auto const& fmf_a : fmf) {
554 aliasing = aliasing || (&mf == fmf_a);
557 mf.ParallelCopyToGhost(mf_refined_patch, 0, dcomp, ncomp,
560 mf.ParallelCopy(mf_refined_patch, 0, dcomp, ncomp,
567 const FabArrayBase::FPinfo& fpc = FabArrayBase::TheFPinfo(*fmf[0], mf,
574 if ( ! fpc.ba_crse_patch.empty())
576 if (return_error_code) {
577 BoxArray
const& cba = cmf[0]->boxArray();
578 if (!cba.contains(fpc.ba_crse_patch,cgeom.periodicity())) {
583 MF mf_crse_patch = make_mf_crse_patch<MF>(fpc, ncomp);
584 mf_set_domain_bndry (mf_crse_patch, cgeom);
586 if constexpr (std::is_same_v<BC,PhysBCFunctUseCoarseGhost>) {
587 cbc.fp1_src_ghost = cbc.cghost;
591 MF mf_fine_patch = make_mf_fine_patch<MF>(fpc, ncomp);
593 detail::call_interp_hook(pre_interp, mf_crse_patch, 0, ncomp);
596 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
597 if (fgeom.isPeriodic(i)) {
598 fdomain_g.grow(i, nghost[i]);
600 if constexpr (std::is_same_v
601 <BC, PhysBCFunctUseCoarseGhost>) {
602 fdomain_g.grow(i, fbc.nghost_outside_domain[i]);
607 ncomp,
IntVect(0), cgeom, fgeom,
608 fdomain_g, ratio, mapper, bcs, bcscomp);
610 detail::call_interp_hook(post_interp, mf_fine_patch, 0, ncomp);
612 mf.ParallelCopy(mf_fine_patch, 0, dcomp, ncomp, IntVect{0}, nghost);
617 if constexpr(std::is_same_v<BC, PhysBCFunctUseCoarseGhost>) {
618 fbc.fp1_src_ghost =
IntVect(0);
621 fgeom, fbc, fbccomp);
626 template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
627 std::enable_if_t<IsFabArray<MF>::value>
628 FillPatchTwoLevels_doit (Array<MF*, AMREX_SPACEDIM>
const& mf, IntVect
const& nghost, Real time,
629 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf,
const Vector<Real>& ct,
630 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf,
const Vector<Real>& ft,
631 int scomp,
int dcomp,
int ncomp,
632 const Geometry& cgeom,
const Geometry& fgeom,
633 Array<BC, AMREX_SPACEDIM>& cbc,
const Array<int, AMREX_SPACEDIM>& cbccomp,
634 Array<BC, AMREX_SPACEDIM>& fbc,
const Array<int, AMREX_SPACEDIM>& fbccomp,
635 const IntVect& ratio,
637 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs,
const Array<int, AMREX_SPACEDIM>& bcscomp,
638 const PreInterpHook& pre_interp,
639 const PostInterpHook& post_interp,
640 EB2::IndexSpace
const* index_space)
642 BL_PROFILE(
"FillPatchTwoLevels (Array<MF*>)");
644 using FAB =
typename MF::FABType::value_type;
645 using iFAB =
typename iMultiFab::FABType::value_type;
648 && mf[1]->ixType().nodeCentered(1),
649 && mf[2]->ixType().nodeCentered(2)));
664 if (nghost.max() > 0 || mf[0]->getBDKey() != fmf[0][0]->getBDKey())
666 const InterpolaterBoxCoarsener& coarsener = mapper->BoxCoarsener(ratio);
672 fmf[0][0]->
DistributionMap(), ncomp, nghost, MFInfo().SetAlloc(
false) );
674 const FabArrayBase::FPinfo& fpc = FabArrayBase::TheFPinfo(fmf_cc_dummy, mf_cc_dummy,
681 if ( !fpc.ba_crse_patch.empty() )
683 Array<MF, AMREX_SPACEDIM> mf_crse_patch;
684 Array<MF, AMREX_SPACEDIM> mf_refined_patch;
685 Array<iMultiFab, AMREX_SPACEDIM> solve_mask;
687 for (
int d=0; d<AMREX_SPACEDIM; ++d)
689 mf_crse_patch[d] = make_mf_crse_patch<MF> (fpc, ncomp, mf[d]->
boxArray().ixType());
690 mf_refined_patch[d] = make_mf_refined_patch<MF> (fpc, ncomp, mf[d]->
boxArray().ixType(), ratio);
691 solve_mask[d] = make_mf_crse_mask<iMultiFab>(fpc, ncomp, mf[d]->
boxArray().ixType(), ratio);
693 mf_set_domain_bndry(mf_crse_patch[d], cgeom);
694 Vector<MF*> cmf_time;
695 for (
const auto & mfab : cmf)
696 { cmf_time.push_back(mfab[d]); }
699 cgeom, cbc[d], cbccomp[d]);
701 mf_set_domain_bndry(mf_refined_patch[d], fgeom);
702 Vector<MF*> fmf_time;
703 for (
const auto & mfab : fmf)
704 { fmf_time.push_back(mfab[d]); }
707 fgeom, fbc[d], fbccomp[d]);
712 ncomp, nghost, MFInfo().SetAlloc(
false) );
714 ncomp, 0, MFInfo().SetAlloc(
false) );
716 const FabArrayBase::CPC mask_cpc( mf_solution, IntVect::TheZeroVector(),
717 mf_known, IntVect::TheZeroVector(),
718 cgeom.periodicity() );
720 solve_mask[d].setVal(1);
721 solve_mask[d].setVal(0, mask_cpc, 0, 1);
728#pragma omp parallel if (cc && Gpu::notInLaunchRegion() )
731 Vector<Array<BCRec, AMREX_SPACEDIM> > bcr(ncomp);
732 for (MFIter mfi(mf_refined_patch[0]); mfi.isValid(); ++mfi)
734 Array<FAB*, AMREX_SPACEDIM> sfab{
AMREX_D_DECL( &(mf_crse_patch[0][mfi]),
735 &(mf_crse_patch[1][mfi]),
736 &(mf_crse_patch[2][mfi]) )};
737 Array<FAB*, AMREX_SPACEDIM> dfab{
AMREX_D_DECL( &(mf_refined_patch[0][mfi]),
738 &(mf_refined_patch[1][mfi]),
739 &(mf_refined_patch[2][mfi]) )};
740 Array<iFAB*, AMREX_SPACEDIM> mfab{
AMREX_D_DECL( &(solve_mask[0][mfi]),
741 &(solve_mask[1][mfi]),
742 &(solve_mask[2][mfi]) )};
747 for (
int d=0; d<AMREX_SPACEDIM; ++d)
749 Vector<BCRec> bcr_d(ncomp);
752 bcscomp[d],0,ncomp,bcs[d],bcr_d);
754 for (
int n=0; n<ncomp; ++n)
755 { bcr[n][d] = bcr_d[n]; }
758 pre_interp(sfab, sbx_cc, 0, ncomp);
760 mapper->interp_arr(sfab, 0, dfab, 0, ncomp, dbx_cc, ratio, mfab,
761 cgeom, fgeom, bcr, idummy, idummy, RunOn::Gpu);
763 post_interp(dfab, dbx_cc, 0, ncomp);
767 for (
int d=0; d<AMREX_SPACEDIM; ++d)
769 bool aliasing =
false;
770 for (
auto const& fmf_a : fmf) {
771 aliasing = aliasing || (mf[d] == fmf_a[d]);
774 mf[d]->ParallelCopyToGhost(mf_refined_patch[d], 0, dcomp, ncomp,
777 mf[d]->ParallelCopy(mf_refined_patch[d], 0, dcomp, ncomp,
784 for (
int d=0; d<AMREX_SPACEDIM; ++d)
786 Vector<MF*> fmf_time;
787 for (
auto const& ffab : fmf)
788 { fmf_time.push_back(ffab[d]); }
791 fgeom, fbc[d], fbccomp[d]);
798template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
799std::enable_if_t<IsFabArray<MF>::value>
803 int scomp,
int dcomp,
int ncomp,
805 BC& cbc,
int cbccomp,
806 BC& fbc,
int fbccomp,
810 const PreInterpHook& pre_interp,
811 const PostInterpHook& post_interp)
818 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
819 scomp,dcomp,ncomp,cgeom,fgeom,
820 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
821 pre_interp,post_interp,index_space);
824template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
825std::enable_if_t<IsFabArray<MF>::value>
829 int scomp,
int dcomp,
int ncomp,
831 BC& cbc,
int cbccomp,
832 BC& fbc,
int fbccomp,
836 const PreInterpHook& pre_interp,
837 const PostInterpHook& post_interp)
845 detail::FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft,
846 scomp,dcomp,ncomp,cgeom,fgeom,
847 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
848 pre_interp,post_interp,index_space);
851template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
852std::enable_if_t<IsFabArray<MF>::value>
856 int scomp,
int dcomp,
int ncomp,
863 const PreInterpHook& pre_interp,
864 const PostInterpHook& post_interp)
872 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
873 scomp,dcomp,ncomp,cgeom,fgeom,
874 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
875 pre_interp,post_interp,index_space);
878template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
879std::enable_if_t<IsFabArray<MF>::value>
883 int scomp,
int dcomp,
int ncomp,
890 const PreInterpHook& pre_interp,
891 const PostInterpHook& post_interp)
903 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
904 scomp,dcomp,ncomp,cgeom,fgeom,
905 cbc,cbccomp_arr,fbc,fbccomp_arr,ratio,mapper,bcs,bcscomp_arr,
906 pre_interp,post_interp,index_space);
909template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
910std::enable_if_t<IsFabArray<MF>::value>
914 int scomp,
int dcomp,
int ncomp,
921 const PreInterpHook& pre_interp,
922 const PostInterpHook& post_interp)
934 detail::FillPatchTwoLevels_doit(mf,mf[0]->
nGrowVect(),time,cmf,ct,fmf,ft,
935 scomp,dcomp,ncomp,cgeom,fgeom,
936 cbc,cbccomp_arr,fbc,fbccomp_arr,ratio,mapper,bcs,bcscomp_arr,
937 pre_interp,post_interp,index_space);
941template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
942std::enable_if_t<IsFabArray<MF>::value>
947 int scomp,
int dcomp,
int ncomp,
949 BC& cbc,
int cbccomp,
950 BC& fbc,
int fbccomp,
954 const PreInterpHook& pre_interp,
955 const PostInterpHook& post_interp)
957 detail::FillPatchTwoLevels_doit(mf,nghost,time,cmf,ct,fmf,ft,
958 scomp,dcomp,ncomp,cgeom,fgeom,
959 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
960 pre_interp,post_interp,&index_space);
963template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
964std::enable_if_t<IsFabArray<MF>::value>
969 int scomp,
int dcomp,
int ncomp,
971 BC& cbc,
int cbccomp,
972 BC& fbc,
int fbccomp,
976 const PreInterpHook& pre_interp,
977 const PostInterpHook& post_interp)
979 detail::FillPatchTwoLevels_doit(mf,mf.nGrowVect(),time,cmf,ct,fmf,ft,
980 scomp,dcomp,ncomp,cgeom,fgeom,
981 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
982 pre_interp,post_interp,&index_space);
986template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
987std::enable_if_t<IsFabArray<MF>::value>
989 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
991 BC& cbc,
int cbccomp,
992 BC& fbc,
int fbccomp,
996 const PreInterpHook& pre_interp,
997 const PostInterpHook& post_interp)
1005 InterpFromCoarseLevel(mf,mf.nGrowVect(),time,index_space,cmf,scomp,dcomp,ncomp,cgeom,fgeom,
1006 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
1007 pre_interp,post_interp);
1010template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1011std::enable_if_t<IsFabArray<MF>::value>
1020 const PreInterpHook& pre_interp,
1021 const PostInterpHook& post_interp)
1024 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
1025 pre_interp,post_interp);
1028template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1029std::enable_if_t<IsFabArray<MF>::value>
1031 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
1033 BC& cbc,
int cbccomp,
1034 BC& fbc,
int fbccomp,
1038 const PreInterpHook& pre_interp,
1039 const PostInterpHook& post_interp)
1047 InterpFromCoarseLevel(mf,nghost,time,index_space,cmf,scomp,dcomp,ncomp,cgeom,fgeom,
1048 cbc,cbccomp,fbc,fbccomp,ratio,mapper,bcs,bcscomp,
1049 pre_interp,post_interp);
1052template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1053std::enable_if_t<IsFabArray<MF>::value>
1056 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
1058 BC& cbc,
int cbccomp,
1059 BC& fbc,
int fbccomp,
1063 const PreInterpHook& pre_interp,
1064 const PostInterpHook& post_interp)
1068 using FAB =
typename MF::FABType::value_type;
1072 const BoxArray& ba = mf.boxArray();
1080 for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
1082 fdomain_g.
grow(i, nghost[i]);
1084 if constexpr (std::is_same_v<BC, PhysBCFunctUseCoarseGhost>) {
1085 fdomain_g.
grow(i, fbc.nghost_outside_domain[i]);
1091 IntVect send_ghost(0), recv_ghost(0);
1092 if constexpr (std::is_same_v<BC, PhysBCFunctUseCoarseGhost>) {
1093 mf_crse_patch.define(
amrex::coarsen(ba,ratio), dm, ncomp, fbc.src_ghost);
1094 send_ghost = fbc.cghost;
1095 recv_ghost = fbc.src_ghost;
1099 for (
int i = 0, N = ba.
size(); i < N; ++i)
1103 ba_crse_patch.
set(i, coarsener.
doit(bx));
1113 mf_crse_patch.define(ba_crse_patch, dm, ncomp, 0,
MFInfo(), *factory);
1117 mf_crse_patch.define(ba_crse_patch, dm, ncomp, 0);
1119 detail::mf_set_domain_bndry (mf_crse_patch, cgeom);
1122 mf_crse_patch.ParallelCopy(cmf, scomp, 0, ncomp, send_ghost, recv_ghost,
1125 cbc(mf_crse_patch, 0, ncomp, mf_crse_patch.nGrowVect(), time, cbccomp);
1127 detail::call_interp_hook(pre_interp, mf_crse_patch, 0, ncomp);
1129 FillPatchInterp(mf, dcomp, mf_crse_patch, 0, ncomp, nghost, cgeom, fgeom, fdomain_g,
1130 ratio, mapper, bcs, bcscomp);
1133#pragma omp parallel if (Gpu::notInLaunchRegion())
1137 FAB& dfab = mf[mfi];
1138 Box dfab_bx = dfab.box();
1139 dfab_bx.
grow(nghost-mf.nGrowVect());
1140 const Box& dbx = dfab_bx & fdomain_g;
1142 post_interp(dfab, dbx, dcomp, ncomp);
1145 fbc(mf, dcomp, ncomp, nghost, time, fbccomp);
1148template <
typename MF,
typename BC,
typename Interp,
typename PreInterpHook,
typename PostInterpHook>
1149std::enable_if_t<IsFabArray<MF>::value>
1158 const PreInterpHook& pre_interp,
1159 const PostInterpHook& post_interp)
1163 using FAB =
typename MF::FABType::value_type;
1164 using iFAB =
typename iMultiFab::FABType::value_type;
1167 const BoxArray& ba = mf[0]->boxArray();
1171 && mf[1]->ixType().nodeCentered(1),
1172 && mf[2]->ixType().nodeCentered(2)));
1187 for (
int d=0; d<AMREX_SPACEDIM; ++d) {
1188 if (nghost[d] % ratio[d] != 0) {
1189 nghost_adj[d] += ratio[d] - (nghost[d] % ratio[d]);
1194 int dcomp_adj = dcomp;
1196 if (! nghost.
allGE(nghost_adj)) {
1197 for (
int d=0; d<AMREX_SPACEDIM; ++d) {
1198 mf_temp[d] = std::make_unique<MF>(mf[d]->
boxArray(),
1200 mf_local[d] = mf_temp[d].get();
1208 Box fdomain_g(fdomain);
1209 for (
int d = 0; d < AMREX_SPACEDIM; ++d) {
1211 fdomain_g.
grow(d,nghost_adj[d]);
1218 for (
int i = 0, N = ba.
size(); i < N; ++i)
1222 ba_crse_patch.
set(i, coarsener.
doit(bx));
1227 for (
int d = 0; d<AMREX_SPACEDIM; ++d)
1234 mf_crse_patch[d].define(ba_crse_idxed, dm, ncomp, 0,
MFInfo(), *crse_factory);
1236 mf_crse_patch[d].define(ba_crse_idxed, dm, ncomp, 0);
1238 detail::mf_set_domain_bndry(mf_crse_patch[d], cgeom);
1240 mf_crse_patch[d].ParallelCopy(*(cmf[d]), scomp, 0, ncomp, cgeom.
periodicity());
1241 cbc[d](mf_crse_patch[d], 0, ncomp, mf_crse_patch[d].nGrowVect(), time, cbccomp);
1244 int idummy1=0, idummy2=0;
1246#pragma omp parallel if (Gpu::notInLaunchRegion())
1257 &(mf_crse_patch[1][mfi]),
1258 &(mf_crse_patch[2][mfi]) )};
1260 &(*mf_local[1])[mfi],
1261 &(*mf_local[2])[mfi] )};
1265 const Box& dbx_cc = dfab_cc & fdomain_g;
1267 for (
int d=0; d<AMREX_SPACEDIM; ++d)
1273 bcscomp,0,ncomp,bcs[d],bcr_d);
1275 for (
int n=0; n<ncomp; ++n)
1276 { bcr[n][d] = bcr_d[n]; }
1279 pre_interp(sfab, sbx_cc, 0, ncomp);
1281 mapper->interp_arr(sfab, 0, dfab, 0, ncomp, dbx_cc, ratio, mfab,
1282 cgeom, fgeom, bcr, idummy1, idummy2,
RunOn::Gpu);
1284 post_interp(dfab, dbx_cc, 0, ncomp);
1288 for (
int d=0; d<AMREX_SPACEDIM; ++d)
1290 if (mf[d] != mf_local[d]) {
1291 amrex::Copy(*mf[d], *mf_local[d], 0, dcomp_adj, ncomp, nghost);
1294 fbc[d](*mf[d], dcomp, ncomp, nghost, time, fbccomp);
1298template <
typename MF,
typename Interp>
1299std::enable_if_t<IsFabArray<MF>::value>
1301 IntVect const& nghost_outside_domain,
1302 const MF& cmf,
int scomp,
int dcomp,
int ncomp,
1304 const IntVect& ratio, Interp* mapper,
1309 cgeom, fgeom, erfbc, 0, erfbc, 0, ratio, mapper,
1313template <
typename MF>
1314std::enable_if_t<IsFabArray<MF>::value>
1317 const Vector<Real>& stime,
int scomp,
int dcomp,
int ncomp,
1325template <
typename MF,
typename Interp>
1326std::enable_if_t<IsFabArray<MF>::value>
1331 int scomp,
int dcomp,
int ncomp,
1333 const IntVect& ratio, Interp* mapper,
1339 FillPatchTwoLevels(mf, nghost, time, cmf, ct, fmf, ft, scomp, dcomp, ncomp,
1340 cgeom, fgeom, erfbc, 0, erfbc, 0, ratio, mapper,
1344template <
typename MF,
typename BC,
typename Interp>
1345std::enable_if_t<IsFabArray<MF>::value>
1348 int scomp,
int dcomp,
int ncomp,
1363 auto get_clayout = [&] () -> std::tuple<BoxArray,BoxArray,DistributionMapping>
1368 BoxArray const& ba = mf.boxArray();
1369 auto const& typ = ba.
ixType();
1370 std::map<int,Vector<Box>> extra_boxes_map;
1373 for (
int i = 0, N =
int(ba.
size()); i < N; ++i) {
1374 Box const& cbox = mapper->CoarseBox(
amrex::grow(ba[i],nghost),ratio[level-1]);
1376 Box gdomain = geom[level-1].growNonPeriodicDomain(cbox.
length());
1379 auto& extra_boxes = extra_boxes_map[i];
1380 auto const& pshift = geom[level-1].periodicity().shiftIntVect();
1381 for (
auto const& piv : pshift) {
1384 extra_boxes.push_back(ibox);
1392 if (!extra_boxes_map.empty()) {
1394 auto& lbox = cbl2.
data();
1397 for (
auto const& [i, vb] : extra_boxes_map) {
1399 for (
int j = 1, nj =
int(vb.size()); j < nj; ++j) {
1400 lbox.push_back(vb[j]);
1401 procmap2.push_back(dm[i]);
1408 return std::make_tuple(
BoxArray(std::move(cbl)), cba2, dm2);
1419 level <
int(bc.
size()) &&
1420 level <
int(ratio.
size()+1));
1424 }
else if (level >=
int(smf.size()))
1426 auto const& [ba1, ba2, dm2] = get_clayout();
1431 mf.DistributionMap(), {0,0,0},
1433 cmf1.define(ba1, mf.DistributionMap(), ncomp, 0,
MFInfo(), *factory);
1438 cmf2.define(ba2, dm2, ncomp, 0,
MFInfo(), *factory2);
1443 cmf1.define(ba1, mf.DistributionMap(), ncomp, 0);
1445 cmf2.define(ba2, dm2, ncomp, 0);
1449 MF* p_mf_inside = (ba2.empty()) ? &cmf1 : &cmf2;
1451 geom, bc, bccomp, ratio, mapper, bcr, bcrcomp);
1452 if (&cmf1 != p_mf_inside) {
1453 cmf1.ParallelCopy(*p_mf_inside, geom[level-1].periodicity());
1455 Box domain_g = geom[level].growPeriodicDomain(nghost);
1456 domain_g.
convert(mf.ixType());
1457 FillPatchInterp(mf, dcomp, cmf1, 0, ncomp, nghost, geom[level-1], geom[level],
1458 domain_g, ratio[level-1], mapper, bcr, bcrcomp);
1461 int error_code = detail::FillPatchTwoLevels_doit(mf, nghost, time,
1462 smf[level-1], st[level-1],
1463 smf[level ], st[level ],
1464 scomp, dcomp, ncomp,
1465 geom[level-1], geom[level],
1466 bc[level-1], bccomp,
1468 ratio[level-1], mapper, bcr, bcrcomp,
1469 hook, hook, index_space,
true);
1470 if (error_code == 0) {
return; }
1472 auto const& [ba1, ba2, dm2] = get_clayout();
1478 mf.DistributionMap(), {0,0,0},
1480 cmf_tmp.define(ba1, mf.DistributionMap(), ncomp, 0,
MFInfo(), *factory);
1485 cmf_tmp.define(ba2, dm2, ncomp, 0,
MFInfo(), *factory);
1491 cmf_tmp.define(ba1, mf.DistributionMap(), ncomp, 0);
1493 cmf_tmp.define(ba2, dm2, ncomp, 0);
1498 geom, bc, bccomp, ratio, mapper, bcr, bcrcomp);
1504 for (
auto const* p : fmf) {
1509 detail::FillPatchTwoLevels_doit(mf, nghost, time,
1513 geom[level-1], geom[level],
1514 bc[level-1], bccomp,
1516 ratio[level-1], mapper, bcr, bccomp,
1517 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:567
IndexType ixType() const noexcept
Return index type of this BoxArray.
Definition AMReX_BoxArray.H:857
static bool SameRefs(const BoxArray &lhs, const BoxArray &rhs)
whether two BoxArrays share the same data
Definition AMReX_BoxArray.H:840
Long size() const noexcept
Return the number of boxes in the BoxArray.
Definition AMReX_BoxArray.H:614
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
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__ 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:451
__host__ __device__ int min() const noexcept
minimum (no absolute values) value
Definition AMReX_IntVect.H:233
__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:680
__host__ __device__ 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:401
Definition AMReX_InterpBase.H:26
Definition AMReX_InterpBase.H:15
Box doit(const Box &fine) const override
Definition AMReX_InterpBase.cpp:10
Virtual base class for interpolaters.
Definition AMReX_Interpolater.H:22
Definition AMReX_MFInterpolater.H:15
Iterator for looping ever tiles and boxes of amrex::FabArray based containers.
Definition AMReX_MFIter.H:63
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:147
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:202
__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:25
const IndexSpace * TopIndexSpaceIfPresent() noexcept
Definition AMReX_EB2.cpp:81
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:138
__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
int nComp(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2854
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2869
IntVect nGrowVect(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2859
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:1346
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:800
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:27
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:988
__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
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:255
__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:93
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)
Definition AMReX_FillPatchUtil.cpp:140
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:30
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:230
BoxArray const & boxArray(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2864
FabArray memory allocation information.
Definition AMReX_FabArray.H:66
Definition AMReX_FillPatchUtil.H:34