Block-Structured AMR Software Framework
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
14#ifdef AMREX_USE_EB
15#include <AMReX_EB2.H>
16#include <AMReX_EBFabFactory.H>
19#endif
20
21#ifdef AMREX_USE_OMP
22#include <omp.h>
23#endif
24
25#include <cmath>
26#include <limits>
27#include <map>
28
29namespace amrex
30{
31
32 template <typename MFFAB>
34 {
35 template <class F=MFFAB, std::enable_if_t<IsBaseFab<F>::value,int> = 0>
36 void operator() (MFFAB& /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const {}
37
38 template <class F=MFFAB, std::enable_if_t<IsBaseFab<F>::value,int> = 0>
39 void operator() (Array<MFFAB*, AMREX_SPACEDIM> /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const {}
40
41 template <class F=MFFAB, std::enable_if_t<IsFabArray<F>::value,int> = 0>
42 void operator() (MFFAB& /*mf*/, int /*icomp*/, int /*ncomp*/) const {}
43 };
44
58 template <typename Interp>
59 bool ProperlyNested (const IntVect& ratio, const IntVect& blocking_factor, int ngrow,
60 const IndexType& boxType, Interp* mapper);
61
85 template <typename MF, typename BC>
86 std::enable_if_t<IsFabArray<MF>::value>
87 FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time,
88 const Vector<MF*>& smf, const Vector<Real>& stime,
89 int scomp, int dcomp, int ncomp,
90 const Geometry& geom,
91 BC& physbcf, int bcfcomp);
92
116 template <typename MF, typename BC>
117 std::enable_if_t<IsFabArray<MF>::value>
118 FillPatchSingleLevel (MF& mf, Real time,
119 const Vector<MF*>& smf, const Vector<Real>& stime,
120 int scomp, int dcomp, int ncomp,
121 const Geometry& geom,
122 BC& physbcf, int bcfcomp);
123
162 template <typename MF, typename BC, typename Interp,
163 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
164 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
165 std::enable_if_t<IsFabArray<MF>::value>
166 FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time,
167 const Vector<MF*>& cmf, const Vector<Real>& ct,
168 const Vector<MF*>& fmf, const Vector<Real>& ft,
169 int scomp, int dcomp, int ncomp,
170 const Geometry& cgeom, const Geometry& fgeom,
171 BC& cbc, int cbccomp,
172 BC& fbc, int fbccomp,
173 const IntVect& ratio,
174 Interp* mapper,
175 const Vector<BCRec>& bcs, int bcscomp,
176 const PreInterpHook& pre_interp = {},
177 const PostInterpHook& post_interp = {});
178
216 template <typename MF, typename BC, typename Interp,
217 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
218 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
219 std::enable_if_t<IsFabArray<MF>::value>
220 FillPatchTwoLevels (MF& mf, Real time,
221 const Vector<MF*>& cmf, const Vector<Real>& ct,
222 const Vector<MF*>& fmf, const Vector<Real>& ft,
223 int scomp, int dcomp, int ncomp,
224 const Geometry& cgeom, const Geometry& fgeom,
225 BC& cbc, int cbccomp,
226 BC& fbc, int fbccomp,
227 const IntVect& ratio,
228 Interp* mapper,
229 const Vector<BCRec>& bcs, int bcscomp,
230 const PreInterpHook& pre_interp = {},
231 const PostInterpHook& post_interp = {});
232
274 template <typename MF, typename BC, typename Interp,
275 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
276 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
277 std::enable_if_t<IsFabArray<MF>::value>
278 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
279 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
280 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
281 int scomp, int dcomp, int ncomp,
282 const Geometry& cgeom, const Geometry& fgeom,
283 Array<BC, AMREX_SPACEDIM>& cbc, const Array<int, AMREX_SPACEDIM>& cbccomp,
284 Array<BC, AMREX_SPACEDIM>& fbc, const Array<int, AMREX_SPACEDIM>& fbccomp,
285 const IntVect& ratio,
286 Interp* mapper,
287 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, const Array<int, AMREX_SPACEDIM>& bcscomp,
288 const PreInterpHook& pre_interp = {},
289 const PostInterpHook& post_interp = {});
290
332 template <typename MF, typename BC, typename Interp,
333 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
334 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
335 std::enable_if_t<IsFabArray<MF>::value>
336 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
337 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
338 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
339 int scomp, int dcomp, int ncomp,
340 const Geometry& cgeom, const Geometry& fgeom,
341 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
342 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
343 const IntVect& ratio,
344 Interp* mapper,
345 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
346 const PreInterpHook& pre_interp = {},
347 const PostInterpHook& post_interp = {});
348
389 template <typename MF, typename BC, typename Interp,
390 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
391 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
392 std::enable_if_t<IsFabArray<MF>::value>
393 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, Real time,
394 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
395 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
396 int scomp, int dcomp, int ncomp,
397 const Geometry& cgeom, const Geometry& fgeom,
398 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
399 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
400 const IntVect& ratio,
401 Interp* mapper,
402 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
403 const PreInterpHook& pre_interp = {},
404 const PostInterpHook& post_interp = {});
405
406#ifdef AMREX_USE_EB
446 template <typename MF, typename BC, typename Interp, typename PreInterpHook, typename PostInterpHook>
447 std::enable_if_t<IsFabArray<MF>::value>
448 FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time,
449 const EB2::IndexSpace& index_space,
450 const Vector<MF*>& cmf, const Vector<Real>& ct,
451 const Vector<MF*>& fmf, const Vector<Real>& ft,
452 int scomp, int dcomp, int ncomp,
453 const Geometry& cgeom, const Geometry& fgeom,
454 BC& cbc, int cbccomp,
455 BC& fbc, int fbccomp,
456 const IntVect& ratio,
457 Interp* mapper,
458 const Vector<BCRec>& bcs, int bcscomp,
459 const PreInterpHook& pre_interp,
460 const PostInterpHook& post_interp);
461
500 template <typename MF, typename BC, typename Interp, typename PreInterpHook, typename PostInterpHook>
501 std::enable_if_t<IsFabArray<MF>::value>
502 FillPatchTwoLevels (MF& mf, Real time,
503 const EB2::IndexSpace& index_space,
504 const Vector<MF*>& cmf, const Vector<Real>& ct,
505 const Vector<MF*>& fmf, const Vector<Real>& ft,
506 int scomp, int dcomp, int ncomp,
507 const Geometry& cgeom, const Geometry& fgeom,
508 BC& cbc, int cbccomp,
509 BC& fbc, int fbccomp,
510 const IntVect& ratio,
511 Interp* mapper,
512 const Vector<BCRec>& bcs, int bcscomp,
513 const PreInterpHook& pre_interp,
514 const PostInterpHook& post_interp);
515#endif
516
547 template <typename MF, typename BC, typename Interp,
548 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
549 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
550 std::enable_if_t<IsFabArray<MF>::value>
551 InterpFromCoarseLevel (MF& mf, Real time,
552 const MF& cmf, int scomp, int dcomp, int ncomp,
553 const Geometry& cgeom, const Geometry& fgeom,
554 BC& cbc, int cbccomp,
555 BC& fbc, int fbccomp,
556 const IntVect& ratio,
557 Interp* mapper,
558 const Vector<BCRec>& bcs, int bcscomp,
559 const PreInterpHook& pre_interp = {},
560 const PostInterpHook& post_interp = {});
561
591 template <typename MF, typename BC, typename Interp,
592 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
593 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
594 std::enable_if_t<IsFabArray<MF>::value>
595 InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time,
596 const MF& cmf, int scomp, int dcomp, int ncomp,
597 const Geometry& cgeom, const Geometry& fgeom,
598 BC& cbc, int cbccomp,
599 BC& fbc, int fbccomp,
600 const IntVect& ratio,
601 Interp* mapper,
602 const Vector<BCRec>& bcs, int bcscomp,
603 const PreInterpHook& pre_interp = {},
604 const PostInterpHook& post_interp = {});
605
636 template <typename MF, typename BC, typename Interp,
637 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
638 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
639 std::enable_if_t<IsFabArray<MF>::value>
640 InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time,
641 const EB2::IndexSpace* index_space,
642 const MF& cmf, int scomp, int dcomp, int ncomp,
643 const Geometry& cgeom, const Geometry& fgeom,
644 BC& cbc, int cbccomp,
645 BC& fbc, int fbccomp,
646 const IntVect& ratio,
647 Interp* mapper,
648 const Vector<BCRec>& bcs, int bcscomp,
649 const PreInterpHook& pre_interp = {},
650 const PostInterpHook& post_interp = {});
651
682 template <typename MF, typename BC, typename Interp,
683 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
684 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
685 std::enable_if_t<IsFabArray<MF>::value>
686 InterpFromCoarseLevel (Array<MF*, AMREX_SPACEDIM> const& mf, Real time,
687 const Array<MF*, AMREX_SPACEDIM>& cmf, int scomp, int dcomp, int ncomp,
688 const Geometry& cgeom, const Geometry& fgeom,
689 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
690 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
691 const IntVect& ratio,
692 Interp* mapper,
693 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
694 const PreInterpHook& pre_interp = {},
695 const PostInterpHook& post_interp = {});
696
728 template <typename MF, typename BC, typename Interp,
729 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
730 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
731 std::enable_if_t<IsFabArray<MF>::value>
732 InterpFromCoarseLevel (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
733 const Array<MF*, AMREX_SPACEDIM>& cmf, int scomp, int dcomp, int ncomp,
734 const Geometry& cgeom, const Geometry& fgeom,
735 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
736 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
737 const IntVect& ratio,
738 Interp* mapper,
739 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
740 const PreInterpHook& pre_interp = {},
741 const PostInterpHook& post_interp = {});
742
769 template <typename MF, typename Interp>
770 std::enable_if_t<IsFabArray<MF>::value>
771 InterpFromCoarseLevel (MF& mf, IntVect const& nghost,
772 IntVect const& nghost_outside_domain,
773 const MF& cmf, int scomp, int dcomp, int ncomp,
774 const Geometry& cgeom, const Geometry& fgeom,
775 const IntVect& ratio, Interp* mapper,
776 const Vector<BCRec>& bcs, int bcscomp);
777
800 template <typename MF>
801 std::enable_if_t<IsFabArray<MF>::value>
802 FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time,
803 const Vector<MF*>& smf, IntVect const& snghost,
804 const Vector<Real>& stime, int scomp, int dcomp, int ncomp,
805 const Geometry& geom);
806
837 template <typename MF, typename Interp>
838 std::enable_if_t<IsFabArray<MF>::value>
839 FillPatchTwoLevels (MF& mf, IntVect const& nghost,
840 IntVect const& nghost_outside_domain, Real time,
841 const Vector<MF*>& cmf, const Vector<Real>& ct,
842 const Vector<MF*>& fmf, const Vector<Real>& ft,
843 int scomp, int dcomp, int ncomp,
844 const Geometry& cgeom, const Geometry& fgeom,
845 const IntVect& ratio, Interp* mapper,
846 const Vector<BCRec>& bcs, int bcscomp);
847
848#ifndef BL_NO_FORT
850
851 void InterpCrseFineBndryEMfield (InterpEM_t interp_type,
852 const Array<MultiFab,AMREX_SPACEDIM>& crse,
853 Array<MultiFab,AMREX_SPACEDIM>& fine,
854 const Geometry& cgeom, const Geometry& fgeom,
855 int ref_ratio);
856
857 void InterpCrseFineBndryEMfield (InterpEM_t interp_type,
858 const Array<MultiFab const*,AMREX_SPACEDIM>& crse,
859 const Array<MultiFab*,AMREX_SPACEDIM>& fine,
860 const Geometry& cgeom, const Geometry& fgeom,
861 int ref_ratio);
862#endif
863
902 template <typename MF, typename BC, typename Interp>
903 std::enable_if_t<IsFabArray<MF>::value>
904 FillPatchNLevels (MF& mf, int level, const IntVect& nghost, Real time,
905 const Vector<Vector<MF*>>& smf, const Vector<Vector<Real>>& st,
906 int scomp, int dcomp, int ncomp,
907 const Vector<Geometry>& geom,
908 Vector<BC>& bc, int bccomp,
909 const Vector<IntVect>& ratio,
910 Interp* mapper,
911 const Vector<BCRec>& bcr, int bcrcomp);
912
913}
914
916
917#endif
Array4< Real > fine
Definition AMReX_InterpFaceRegister.cpp:90
Array4< Real const > crse
Definition AMReX_InterpFaceRegister.cpp:92
Definition AMReX_Amr.cpp:49
InterpEM_t
Definition AMReX_FillPatchUtil.H:849
@ InterpB
Definition AMReX_FillPatchUtil.H:849
@ InterpE
Definition AMReX_FillPatchUtil.H:849
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:1342
void InterpCrseFineBndryEMfield(InterpEM_t interp_type, const Array< MultiFab, AMREX_SPACEDIM > &crse, Array< MultiFab, AMREX_SPACEDIM > &fine, const Geometry &cgeom, const Geometry &fgeom, int ref_ratio)
Definition AMReX_FillPatchUtil.cpp:11
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:33
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:73
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:796
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:984
IntVectND< AMREX_SPACEDIM > IntVect
Definition AMReX_BaseFwd.H:30
IndexTypeND< AMREX_SPACEDIM > IndexType
Definition AMReX_BaseFwd.H:33
std::array< T, N > Array
Definition AMReX_Array.H:24
Definition AMReX_FillPatchUtil.H:34
void operator()(MFFAB &, const Box &, int, int) const
Definition AMReX_FillPatchUtil.H:36