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#include <AMReX_Concepts.H>
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 void operator()(MFFAB& /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const
41 requires (BaseFabType<MFFAB>)
42 {}
43
44 void operator()(Array<MFFAB*, AMREX_SPACEDIM> /*fab*/, const Box& /*bx*/, int /*icomp*/, int /*ncomp*/) const
45 requires (BaseFabType<MFFAB>)
46 {}
47
48 void operator()(MFFAB& /*mf*/, int /*icomp*/, int /*ncomp*/) const
49 requires (FabArrayType<MFFAB>)
50 {}
51 };
52
66 template <typename Interp>
67 bool ProperlyNested (const IntVect& ratio, const IntVect& blocking_factor, int ngrow,
68 const IndexType& boxType, Interp* mapper);
69
93 template <FabArrayType MF, typename BC>
94 void
95 FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time,
96 const Vector<MF*>& smf, const Vector<Real>& stime,
97 int scomp, int dcomp, int ncomp,
98 const Geometry& geom,
99 BC& physbcf, int bcfcomp);
100
124 template <FabArrayType MF, typename BC>
125 void
126 FillPatchSingleLevel (MF& mf, Real time,
127 const Vector<MF*>& smf, const Vector<Real>& stime,
128 int scomp, int dcomp, int ncomp,
129 const Geometry& geom,
130 BC& physbcf, int bcfcomp);
131
170 template <FabArrayType MF, typename BC, typename Interp,
171 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
172 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
173 void
174 FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time,
175 const Vector<MF*>& cmf, const Vector<Real>& ct,
176 const Vector<MF*>& fmf, const Vector<Real>& ft,
177 int scomp, int dcomp, int ncomp,
178 const Geometry& cgeom, const Geometry& fgeom,
179 BC& cbc, int cbccomp,
180 BC& fbc, int fbccomp,
181 const IntVect& ratio,
182 Interp* mapper,
183 const Vector<BCRec>& bcs, int bcscomp,
184 const PreInterpHook& pre_interp = {},
185 const PostInterpHook& post_interp = {});
186
224 template <FabArrayType MF, typename BC, typename Interp,
225 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
226 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
227 void
228 FillPatchTwoLevels (MF& mf, Real time,
229 const Vector<MF*>& cmf, const Vector<Real>& ct,
230 const Vector<MF*>& fmf, const Vector<Real>& ft,
231 int scomp, int dcomp, int ncomp,
232 const Geometry& cgeom, const Geometry& fgeom,
233 BC& cbc, int cbccomp,
234 BC& fbc, int fbccomp,
235 const IntVect& ratio,
236 Interp* mapper,
237 const Vector<BCRec>& bcs, int bcscomp,
238 const PreInterpHook& pre_interp = {},
239 const PostInterpHook& post_interp = {});
240
282 template <FabArrayType MF, typename BC, typename Interp,
283 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
284 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
285 void
286 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
287 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
288 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
289 int scomp, int dcomp, int ncomp,
290 const Geometry& cgeom, const Geometry& fgeom,
291 Array<BC, AMREX_SPACEDIM>& cbc, const Array<int, AMREX_SPACEDIM>& cbccomp,
292 Array<BC, AMREX_SPACEDIM>& fbc, const Array<int, AMREX_SPACEDIM>& fbccomp,
293 const IntVect& ratio,
294 Interp* mapper,
295 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, const Array<int, AMREX_SPACEDIM>& bcscomp,
296 const PreInterpHook& pre_interp = {},
297 const PostInterpHook& post_interp = {});
298
340 template <FabArrayType MF, typename BC, typename Interp,
341 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
342 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
343 void
344 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
345 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
346 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
347 int scomp, int dcomp, int ncomp,
348 const Geometry& cgeom, const Geometry& fgeom,
349 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
350 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
351 const IntVect& ratio,
352 Interp* mapper,
353 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
354 const PreInterpHook& pre_interp = {},
355 const PostInterpHook& post_interp = {});
356
397 template <FabArrayType MF, typename BC, typename Interp,
398 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
399 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
400 void
401 FillPatchTwoLevels (Array<MF*, AMREX_SPACEDIM> const& mf, Real time,
402 const Vector<Array<MF*, AMREX_SPACEDIM> >& cmf, const Vector<Real>& ct,
403 const Vector<Array<MF*, AMREX_SPACEDIM> >& fmf, const Vector<Real>& ft,
404 int scomp, int dcomp, int ncomp,
405 const Geometry& cgeom, const Geometry& fgeom,
406 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
407 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
408 const IntVect& ratio,
409 Interp* mapper,
410 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
411 const PreInterpHook& pre_interp = {},
412 const PostInterpHook& post_interp = {});
413
414#ifdef AMREX_USE_EB
454 template <FabArrayType MF, typename BC, typename Interp, typename PreInterpHook, typename PostInterpHook>
455 void
456 FillPatchTwoLevels (MF& mf, IntVect const& nghost, Real time,
457 const EB2::IndexSpace& index_space,
458 const Vector<MF*>& cmf, const Vector<Real>& ct,
459 const Vector<MF*>& fmf, const Vector<Real>& ft,
460 int scomp, int dcomp, int ncomp,
461 const Geometry& cgeom, const Geometry& fgeom,
462 BC& cbc, int cbccomp,
463 BC& fbc, int fbccomp,
464 const IntVect& ratio,
465 Interp* mapper,
466 const Vector<BCRec>& bcs, int bcscomp,
467 const PreInterpHook& pre_interp,
468 const PostInterpHook& post_interp);
469
508 template <FabArrayType MF, typename BC, typename Interp, typename PreInterpHook, typename PostInterpHook>
509 void
510 FillPatchTwoLevels (MF& mf, Real time,
511 const EB2::IndexSpace& index_space,
512 const Vector<MF*>& cmf, const Vector<Real>& ct,
513 const Vector<MF*>& fmf, const Vector<Real>& ft,
514 int scomp, int dcomp, int ncomp,
515 const Geometry& cgeom, const Geometry& fgeom,
516 BC& cbc, int cbccomp,
517 BC& fbc, int fbccomp,
518 const IntVect& ratio,
519 Interp* mapper,
520 const Vector<BCRec>& bcs, int bcscomp,
521 const PreInterpHook& pre_interp,
522 const PostInterpHook& post_interp);
523#endif
524
555 template <FabArrayType MF, typename BC, typename Interp,
556 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
557 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
558 void
559 InterpFromCoarseLevel (MF& mf, Real time,
560 const MF& cmf, int scomp, int dcomp, int ncomp,
561 const Geometry& cgeom, const Geometry& fgeom,
562 BC& cbc, int cbccomp,
563 BC& fbc, int fbccomp,
564 const IntVect& ratio,
565 Interp* mapper,
566 const Vector<BCRec>& bcs, int bcscomp,
567 const PreInterpHook& pre_interp = {},
568 const PostInterpHook& post_interp = {});
569
599 template <FabArrayType MF, typename BC, typename Interp,
600 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
601 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
602 void
603 InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time,
604 const MF& cmf, int scomp, int dcomp, int ncomp,
605 const Geometry& cgeom, const Geometry& fgeom,
606 BC& cbc, int cbccomp,
607 BC& fbc, int fbccomp,
608 const IntVect& ratio,
609 Interp* mapper,
610 const Vector<BCRec>& bcs, int bcscomp,
611 const PreInterpHook& pre_interp = {},
612 const PostInterpHook& post_interp = {});
613
644 template <FabArrayType MF, typename BC, typename Interp,
645 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
646 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
647 void
648 InterpFromCoarseLevel (MF& mf, IntVect const& nghost, Real time,
649 const EB2::IndexSpace* index_space,
650 const MF& cmf, int scomp, int dcomp, int ncomp,
651 const Geometry& cgeom, const Geometry& fgeom,
652 BC& cbc, int cbccomp,
653 BC& fbc, int fbccomp,
654 const IntVect& ratio,
655 Interp* mapper,
656 const Vector<BCRec>& bcs, int bcscomp,
657 const PreInterpHook& pre_interp = {},
658 const PostInterpHook& post_interp = {});
659
690 template <FabArrayType MF, typename BC, typename Interp,
691 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
692 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
693 void
694 InterpFromCoarseLevel (Array<MF*, AMREX_SPACEDIM> const& mf, Real time,
695 const Array<MF*, AMREX_SPACEDIM>& cmf, int scomp, int dcomp, int ncomp,
696 const Geometry& cgeom, const Geometry& fgeom,
697 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
698 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
699 const IntVect& ratio,
700 Interp* mapper,
701 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
702 const PreInterpHook& pre_interp = {},
703 const PostInterpHook& post_interp = {});
704
736 template <FabArrayType MF, typename BC, typename Interp,
737 typename PreInterpHook=NullInterpHook<typename MF::FABType::value_type>,
738 typename PostInterpHook=NullInterpHook<typename MF::FABType::value_type> >
739 void
740 InterpFromCoarseLevel (Array<MF*, AMREX_SPACEDIM> const& mf, IntVect const& nghost, Real time,
741 const Array<MF*, AMREX_SPACEDIM>& cmf, int scomp, int dcomp, int ncomp,
742 const Geometry& cgeom, const Geometry& fgeom,
743 Array<BC, AMREX_SPACEDIM>& cbc, int cbccomp,
744 Array<BC, AMREX_SPACEDIM>& fbc, int fbccomp,
745 const IntVect& ratio,
746 Interp* mapper,
747 const Array<Vector<BCRec>, AMREX_SPACEDIM>& bcs, int bcscomp,
748 const PreInterpHook& pre_interp = {},
749 const PostInterpHook& post_interp = {});
750
777 template <FabArrayType MF, typename Interp>
778 void
779 InterpFromCoarseLevel (MF& mf, IntVect const& nghost,
780 IntVect const& nghost_outside_domain,
781 const MF& cmf, int scomp, int dcomp, int ncomp,
782 const Geometry& cgeom, const Geometry& fgeom,
783 const IntVect& ratio, Interp* mapper,
784 const Vector<BCRec>& bcs, int bcscomp);
785
808 template <FabArrayType MF>
809 void
810 FillPatchSingleLevel (MF& mf, IntVect const& nghost, Real time,
811 const Vector<MF*>& smf, IntVect const& snghost,
812 const Vector<Real>& stime, int scomp, int dcomp, int ncomp,
813 const Geometry& geom);
814
845 template <FabArrayType MF, typename Interp>
846 void
847 FillPatchTwoLevels (MF& mf, IntVect const& nghost,
848 IntVect const& nghost_outside_domain, Real time,
849 const Vector<MF*>& cmf, const Vector<Real>& ct,
850 const Vector<MF*>& fmf, const Vector<Real>& ft,
851 int scomp, int dcomp, int ncomp,
852 const Geometry& cgeom, const Geometry& fgeom,
853 const IntVect& ratio, Interp* mapper,
854 const Vector<BCRec>& bcs, int bcscomp);
855
856#ifndef BL_NO_FORT
858
859 void InterpCrseFineBndryEMfield (InterpEM_t interp_type,
860 const Array<MultiFab,AMREX_SPACEDIM>& crse,
861 Array<MultiFab,AMREX_SPACEDIM>& fine,
862 const Geometry& cgeom, const Geometry& fgeom,
863 int ref_ratio);
864
865 void InterpCrseFineBndryEMfield (InterpEM_t interp_type,
866 const Array<MultiFab const*,AMREX_SPACEDIM>& crse,
867 const Array<MultiFab*,AMREX_SPACEDIM>& fine,
868 const Geometry& cgeom, const Geometry& fgeom,
869 int ref_ratio);
870#endif
871
910 template <FabArrayType MF, typename BC, typename Interp>
911 void
912 FillPatchNLevels (MF& mf, int level, const IntVect& nghost, Real time,
913 const Vector<Vector<MF*>>& smf, const Vector<Vector<Real>>& st,
914 int scomp, int dcomp, int ncomp,
915 const Vector<Geometry>& geom,
916 Vector<BC>& bc, int bccomp,
917 const Vector<IntVect>& ratio,
918 Interp* mapper,
919 const Vector<BCRec>& bcr, int bcrcomp);
920
921}
922
924
925#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).
Checks if a type is derived from amrex::BaseFab.
Definition AMReX_Concepts.H:13
Checks if a type is an amrex::FabArray.
Definition AMReX_Concepts.H:19
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:50
InterpEM_t
Definition AMReX_FillPatchUtil.H:857
@ InterpB
Definition AMReX_FillPatchUtil.H:857
@ InterpE
Definition AMReX_FillPatchUtil.H:857
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
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
void FillPatchSingleLevel(MF &mf, IntVect const &nghost, Real time, const Vector< MF * > &smf, const Vector< Real > &stime, int scomp, int dcomp, int ncomp, const Geometry &geom, BC &physbcf, int bcfcomp)
FillPatch with data from the current level.
Definition AMReX_FillPatchUtil_I.H:75
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:33
void 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:979
void 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:791
void 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:1337
Definition AMReX_FillPatchUtil.H:39
void operator()(MFFAB &, const Box &, int, int) const
Definition AMReX_FillPatchUtil.H:40
void operator()(Array< MFFAB *, 3 >, const Box &, int, int) const
Definition AMReX_FillPatchUtil.H:44
void operator()(MFFAB &, int, int) const
Definition AMReX_FillPatchUtil.H:48