Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_FillPatchUtil.H
Go to the documentation of this file.
1#ifndef AMREX_FillPatchUtil_H_
2#define AMREX_FillPatchUtil_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_MultiFab.H>
6#include <AMReX_iMultiFab.H>
7#include <AMReX_Geometry.H>
8#include <AMReX_PhysBCFunct.H>
11#include <AMReX_Array.H>
12#include <AMReX_Utility.H>
13
19#ifdef AMREX_USE_EB
20#include <AMReX_EB2.H>
21#include <AMReX_EBFabFactory.H>
24#endif
25
26#ifdef AMREX_USE_OMP
27#include <omp.h>
28#endif
29
30#include <cmath>
31#include <limits>
32#include <map>
33
34namespace amrex
35{
36
37 template <typename MFFAB>
39 {
40 template <class F=MFFAB, std::enable_if_t<IsBaseFab<F>::value,int> = 0>
41 void operator() (MFFAB& /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const {}
42
43 template <class F=MFFAB, std::enable_if_t<IsBaseFab<F>::value,int> = 0>
44 void operator() (Array<MFFAB*, AMREX_SPACEDIM> /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const {}
45
46 template <class F=MFFAB, std::enable_if_t<IsFabArray<F>::value,int> = 0>
47 void operator() (MFFAB& /*mf*/, int /*icomp*/, int /*ncomp*/) const {}
48 };
49
63 template <typename Interp>
64 bool ProperlyNested (const IntVect& ratio, const IntVect& blocking_factor, int ngrow,
65 const IndexType& boxType, Interp* mapper);
66
90 template <typename MF, typename BC>
91 std::enable_if_t<IsFabArray<MF>::value>
92 FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time,
93 const Vector<MF*>& smf, const Vector<Real>& stime,
94 int scomp, int dcomp, int ncomp,
95 const Geometry& geom,
96 BC& physbcf, int bcfcomp);
97
121 template <typename MF, typename BC>
122 std::enable_if_t<IsFabArray<MF>::value>
123 FillPatchSingleLevel (MF& mf, Real time,
124 const Vector<MF*>& smf, const Vector<Real>& stime,
125 int scomp, int dcomp, int ncomp,
126 const Geometry& geom,
127 BC& physbcf, int bcfcomp);
128
167 template <typename MF, typename BC, typename Interp,
168 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
169 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
170 std::enable_if_t<IsFabArray<MF>::value>
171 FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time,
172 const Vector<MF*>& cmf, const Vector<Real>& ct,
173 const Vector<MF*>& fmf, const Vector<Real>& ft,
174 int scomp, int dcomp, int ncomp,
175 const Geometry& cgeom, const Geometry& fgeom,
176 BC& cbc, int cbccomp,
177 BC& fbc, int fbccomp,
178 const IntVect& ratio,
179 Interp* mapper,
180 const Vector<BCRec>& bcs, int bcscomp,
181 const PreInterpHook& pre_interp = {},
182 const PostInterpHook& post_interp = {});
183
221 template <typename MF, typename BC, typename Interp,
222 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
223 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
224 std::enable_if_t<IsFabArray<MF>::value>
225 FillPatchTwoLevels (MF& mf, Real time,
226 const Vector<MF*>& cmf, const Vector<Real>& ct,
227 const Vector<MF*>& fmf, const Vector<Real>& ft,
228 int scomp, int dcomp, int ncomp,
229 const Geometry& cgeom, const Geometry& fgeom,
230 BC& cbc, int cbccomp,
231 BC& fbc, int fbccomp,
232 const IntVect& ratio,
233 Interp* mapper,
234 const Vector<BCRec>& bcs, int bcscomp,
235 const PreInterpHook& pre_interp = {},
236 const PostInterpHook& post_interp = {});
237
279 template <typename MF, typename BC, typename Interp,
280 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
281 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
282 std::enable_if_t<IsFabArray<MF>::value>
283 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
284 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
285 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
286 int scomp, int dcomp, int ncomp,
287 const Geometry& cgeom, const Geometry& fgeom,
288 Array<BC, AMREX_SPACEDIM>& cbc, const Array<int, AMREX_SPACEDIM>& cbccomp,
289 Array<BC, AMREX_SPACEDIM>& fbc, const Array<int, AMREX_SPACEDIM>& fbccomp,
290 const IntVect& ratio,
291 Interp* mapper,
292 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, const Array<int, AMREX_SPACEDIM>& bcscomp,
293 const PreInterpHook& pre_interp = {},
294 const PostInterpHook& post_interp = {});
295
337 template <typename MF, typename BC, typename Interp,
338 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
339 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
340 std::enable_if_t<IsFabArray<MF>::value>
341 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
342 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
343 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
344 int scomp, int dcomp, int ncomp,
345 const Geometry& cgeom, const Geometry& fgeom,
346 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
347 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
348 const IntVect& ratio,
349 Interp* mapper,
350 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
351 const PreInterpHook& pre_interp = {},
352 const PostInterpHook& post_interp = {});
353
394 template <typename MF, typename BC, typename Interp,
395 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
396 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
397 std::enable_if_t<IsFabArray<MF>::value>
398 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, Real time,
399 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
400 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
401 int scomp, int dcomp, int ncomp,
402 const Geometry& cgeom, const Geometry& fgeom,
403 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
404 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
405 const IntVect& ratio,
406 Interp* mapper,
407 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
408 const PreInterpHook& pre_interp = {},
409 const PostInterpHook& post_interp = {});
410
411#ifdef AMREX_USE_EB
451 template <typename MF, typename BC, typename Interp, typename PreInterpHook, typename PostInterpHook>
452 std::enable_if_t<IsFabArray<MF>::value>
453 FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time,
454 const EB2::IndexSpace& index_space,
455 const Vector<MF*>& cmf, const Vector<Real>& ct,
456 const Vector<MF*>& fmf, const Vector<Real>& ft,
457 int scomp, int dcomp, int ncomp,
458 const Geometry& cgeom, const Geometry& fgeom,
459 BC& cbc, int cbccomp,
460 BC& fbc, int fbccomp,
461 const IntVect& ratio,
462 Interp* mapper,
463 const Vector<BCRec>& bcs, int bcscomp,
464 const PreInterpHook& pre_interp,
465 const PostInterpHook& post_interp);
466
505 template <typename MF, typename BC, typename Interp, typename PreInterpHook, typename PostInterpHook>
506 std::enable_if_t<IsFabArray<MF>::value>
507 FillPatchTwoLevels (MF& mf, Real time,
508 const EB2::IndexSpace& index_space,
509 const Vector<MF*>& cmf, const Vector<Real>& ct,
510 const Vector<MF*>& fmf, const Vector<Real>& ft,
511 int scomp, int dcomp, int ncomp,
512 const Geometry& cgeom, const Geometry& fgeom,
513 BC& cbc, int cbccomp,
514 BC& fbc, int fbccomp,
515 const IntVect& ratio,
516 Interp* mapper,
517 const Vector<BCRec>& bcs, int bcscomp,
518 const PreInterpHook& pre_interp,
519 const PostInterpHook& post_interp);
520#endif
521
552 template <typename MF, typename BC, typename Interp,
553 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
554 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
555 std::enable_if_t<IsFabArray<MF>::value>
556 InterpFromCoarseLevel (MF& mf, Real time,
557 const MF& cmf, int scomp, int dcomp, int ncomp,
558 const Geometry& cgeom, const Geometry& fgeom,
559 BC& cbc, int cbccomp,
560 BC& fbc, int fbccomp,
561 const IntVect& ratio,
562 Interp* mapper,
563 const Vector<BCRec>& bcs, int bcscomp,
564 const PreInterpHook& pre_interp = {},
565 const PostInterpHook& post_interp = {});
566
596 template <typename MF, typename BC, typename Interp,
597 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
598 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
599 std::enable_if_t<IsFabArray<MF>::value>
600 InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time,
601 const MF& cmf, int scomp, int dcomp, int ncomp,
602 const Geometry& cgeom, const Geometry& fgeom,
603 BC& cbc, int cbccomp,
604 BC& fbc, int fbccomp,
605 const IntVect& ratio,
606 Interp* mapper,
607 const Vector<BCRec>& bcs, int bcscomp,
608 const PreInterpHook& pre_interp = {},
609 const PostInterpHook& post_interp = {});
610
641 template <typename MF, typename BC, typename Interp,
642 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
643 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
644 std::enable_if_t<IsFabArray<MF>::value>
645 InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time,
646 const EB2::IndexSpace* index_space,
647 const MF& cmf, int scomp, int dcomp, int ncomp,
648 const Geometry& cgeom, const Geometry& fgeom,
649 BC& cbc, int cbccomp,
650 BC& fbc, int fbccomp,
651 const IntVect& ratio,
652 Interp* mapper,
653 const Vector<BCRec>& bcs, int bcscomp,
654 const PreInterpHook& pre_interp = {},
655 const PostInterpHook& post_interp = {});
656
687 template <typename MF, typename BC, typename Interp,
688 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
689 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
690 std::enable_if_t<IsFabArray<MF>::value>
691 InterpFromCoarseLevel (Array<MF*, AMREX_SPACEDIM> const& mf, Real time,
692 const Array<MF*, AMREX_SPACEDIM>& cmf, int scomp, int dcomp, int ncomp,
693 const Geometry& cgeom, const Geometry& fgeom,
694 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
695 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
696 const IntVect& ratio,
697 Interp* mapper,
698 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
699 const PreInterpHook& pre_interp = {},
700 const PostInterpHook& post_interp = {});
701
733 template <typename MF, typename BC, typename Interp,
734 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
735 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
736 std::enable_if_t<IsFabArray<MF>::value>
737 InterpFromCoarseLevel (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
738 const Array<MF*, AMREX_SPACEDIM>& cmf, int scomp, int dcomp, int ncomp,
739 const Geometry& cgeom, const Geometry& fgeom,
740 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
741 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
742 const IntVect& ratio,
743 Interp* mapper,
744 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
745 const PreInterpHook& pre_interp = {},
746 const PostInterpHook& post_interp = {});
747
774 template <typename MF, typename Interp>
775 std::enable_if_t<IsFabArray<MF>::value>
776 InterpFromCoarseLevel (MF& mf, IntVect const& nghost,
777 IntVect const& nghost_outside_domain,
778 const MF& cmf, int scomp, int dcomp, int ncomp,
779 const Geometry& cgeom, const Geometry& fgeom,
780 const IntVect& ratio, Interp* mapper,
781 const Vector<BCRec>& bcs, int bcscomp);
782
805 template <typename MF>
806 std::enable_if_t<IsFabArray<MF>::value>
807 FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time,
808 const Vector<MF*>& smf, IntVect const& snghost,
809 const Vector<Real>& stime, int scomp, int dcomp, int ncomp,
810 const Geometry& geom);
811
842 template <typename MF, typename Interp>
843 std::enable_if_t<IsFabArray<MF>::value>
844 FillPatchTwoLevels (MF& mf, IntVect const& nghost,
845 IntVect const& nghost_outside_domain, Real time,
846 const Vector<MF*>& cmf, const Vector<Real>& ct,
847 const Vector<MF*>& fmf, const Vector<Real>& ft,
848 int scomp, int dcomp, int ncomp,
849 const Geometry& cgeom, const Geometry& fgeom,
850 const IntVect& ratio, Interp* mapper,
851 const Vector<BCRec>& bcs, int bcscomp);
852
853#ifndef BL_NO_FORT
855
856 void InterpCrseFineBndryEMfield (InterpEM_t interp_type,
857 const Array<MultiFab,AMREX_SPACEDIM>& crse,
858 Array<MultiFab,AMREX_SPACEDIM>& fine,
859 const Geometry& cgeom, const Geometry& fgeom,
860 int ref_ratio);
861
862 void InterpCrseFineBndryEMfield (InterpEM_t interp_type,
863 const Array<MultiFab const*,AMREX_SPACEDIM>& crse,
864 const Array<MultiFab*,AMREX_SPACEDIM>& fine,
865 const Geometry& cgeom, const Geometry& fgeom,
866 int ref_ratio);
867#endif
868
907 template <typename MF, typename BC, typename Interp>
908 std::enable_if_t<IsFabArray<MF>::value>
909 FillPatchNLevels (MF& mf, int level, const IntVect& nghost, Real time,
910 const Vector<Vector<MF*>>& smf, const Vector<Vector<Real>>& st,
911 int scomp, int dcomp, int ncomp,
912 const Vector<Geometry>& geom,
913 Vector<BC>& bc, int bccomp,
914 const Vector<IntVect>& ratio,
915 Interp* mapper,
916 const Vector<BCRec>& bcr, int bcrcomp);
917
918}
919
921
922#endif
Array4< Real > fine
Definition AMReX_InterpFaceRegister.cpp:90
Array4< Real const > crse
Definition AMReX_InterpFaceRegister.cpp:92
Collection of spatial interpolaters used by FillPatch and flux-register logic.
Interpolaters that operate directly on MultiFabs (cell- or node-centered).
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
std::array< T, N > Array
Definition AMReX_Array.H:26
Definition AMReX_Amr.cpp:49
InterpEM_t
Definition AMReX_FillPatchUtil.H:854
@ InterpB
Definition AMReX_FillPatchUtil.H:854
@ InterpE
Definition AMReX_FillPatchUtil.H:854
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
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
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
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
void InterpCrseFineBndryEMfield(InterpEM_t interp_type, const Array< MultiFab, 3 > &crse, Array< MultiFab, 3 > &fine, const Geometry &cgeom, const Geometry &fgeom, int ref_ratio)
Definition AMReX_FillPatchUtil.cpp:11
IndexTypeND< 3 > IndexType
IndexType is an alias for amrex::IndexTypeND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:36
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:33
Definition AMReX_FillPatchUtil.H:39
void operator()(MFFAB &, const Box &, int, int) const
Definition AMReX_FillPatchUtil.H:41