1 #ifndef INTEGRATOR_BASEFIELD_H
2 #define INTEGRATOR_BASEFIELD_H
4 #include "AMReX_FillPatchUtil.H"
18 const amrex::BoxArray& cgrids,
19 const amrex::DistributionMapping& dm) = 0;
22 const amrex::BoxArray& cgrids,
23 const amrex::DistributionMapping& dm) = 0;
26 const amrex::BoxArray& cgrids,
27 const amrex::DistributionMapping& dm) = 0;
31 virtual void AverageDown(
const int lev, amrex::IntVect refRatio) = 0;
33 virtual int NComp() = 0;
34 virtual void Copy(
int , amrex::MultiFab &,
int ,
int ) = 0;
36 virtual std::string
Name(
int) = 0;
37 virtual void setName(std::string a_name) = 0;
39 virtual void setBC(
void * a_bc) = 0;
40 virtual void *
getBC() = 0;
51 virtual void operator () (amrex::FabArray<amrex::BaseFab<T>> & ,
52 int ,
int , amrex::IntVect
const& ,
55 amrex::BCRec
GetBCRec() {
return amrex::BCRec();}
59 const amrex::Vector<amrex::Geometry> &a_geom,
60 const amrex::Vector<amrex::IntVect> &a_refRatio,
61 int a_ncomp,
int a_nghost) :
68 amrex::Vector<std::unique_ptr<amrex::FabArray<amrex::BaseFab<T>>>> &source_mf,
69 amrex::FabArray<amrex::BaseFab<T>> &destination_mf,
75 amrex::Vector<amrex::FabArray<amrex::BaseFab<T>>*> smf;
76 smf.push_back(source_mf[lev].get());
77 amrex::Vector<amrex::Real> stime;
78 stime.push_back(time);
83 amrex::FillPatchSingleLevel(destination_mf, time, smf, stime,
84 0, icomp, destination_mf.nComp(),
m_geom[lev],
89 amrex::FillPatchSingleLevel(destination_mf, time, smf, stime,
90 0, icomp, destination_mf.nComp(),
m_geom[lev],
96 amrex::Vector<amrex::FabArray<amrex::BaseFab<T>>*> cmf, fmf;
97 cmf.push_back(source_mf[lev-1].get());
98 fmf.push_back(source_mf[lev].get());
99 amrex::Vector<amrex::Real> ctime, ftime;
100 ctime.push_back(time);
101 ftime.push_back(time);
103 amrex::Vector<amrex::BCRec> bcs(destination_mf.nComp(), physbc.
GetBCRec());
105 if (destination_mf.boxArray().ixType() == amrex::IndexType::TheNodeType())
110 amrex::FillPatchTwoLevels(destination_mf, time, cmf, ctime, fmf, ftime,
111 0, icomp, destination_mf.nComp(),
m_geom[lev-1],
m_geom[lev],
147 BL_PROFILE(
"Integrator::FillCoarsePatch");
148 AMREX_ASSERT(lev > 0);
154 amrex::Vector<amrex::FabArray<amrex::BaseFab<T>> *> cmf;
155 cmf.push_back(
m_field[lev-1].get());
156 amrex::Vector<amrex::Real> ctime;
157 ctime.push_back(time);
159 amrex::Vector<amrex::BCRec> bcs(ncomp, physbc.
GetBCRec());
160 amrex::InterpFromCoarseLevel(*
m_field[lev], time, *cmf[0], 0, icomp, ncomp,
193 const amrex::BoxArray& cgrids,
194 const amrex::DistributionMapping& dm)
override
199 amrex::BoxArray ngrids = cgrids;
200 ngrids.convert(amrex::IntVect::TheNodeVector());
201 amrex::FabArray<amrex::BaseFab<T>> new_state(ngrids, dm,
m_ncomp,
m_nghost);
203 std::swap(new_state, *
m_field[lev]);
207 amrex::FabArray<amrex::BaseFab<T>> new_state(cgrids, dm,
m_ncomp,
m_nghost);
209 std::swap(new_state, *
m_field[lev]);
217 const amrex::BoxArray& cgrids,
218 const amrex::DistributionMapping& dm)
override
222 amrex::BoxArray ngrids = cgrids;
223 ngrids.convert(amrex::IntVect::TheNodeVector());
238 const amrex::BoxArray& cgrids,
239 const amrex::DistributionMapping& dm)
override
243 amrex::BoxArray ngrids = cgrids;
244 ngrids.convert(amrex::IntVect::TheNodeVector());
246 m_field[lev]->setVal(T::Zero());
251 m_field[lev]->setVal(T::Zero());
259 m_field.finest_level = a_finestlevel;
268 for (amrex::MFIter mfi(*
m_field[lev],
true); mfi.isValid(); ++mfi)
270 const amrex::Box& box = mfi.tilebox();
271 amrex::BaseFab<T> &patch = (*(
m_field[lev]))[mfi];
278 virtual void AverageDown(
const int lev, amrex::IntVect refRatio)
override
281 amrex::average_down_nodal(*
m_field[lev+1],*
m_field[lev],refRatio);
293 const amrex::Vector<amrex::Geometry> &
m_geom;
302 virtual void Copy(
int a_lev, amrex::MultiFab &a_dst,
int a_dstcomp,
int a_nghost)
override
304 m_field.Copy(a_lev,a_dst,a_dstcomp,a_nghost);
306 virtual void setName(std::string a_name)
override {
309 virtual std::string
Name(
int i)
override {
312 virtual void setBC(
void * a_bc)
override {