27 const EBCellFAB& a_cellData,
28 const DataIndex& a_din)
const noexcept
30 CH_TIME(
"CellCentroidInterpolation::interpolate<T>)");
32 CH_assert(m_isDefined);
33 CH_assert(a_centroidData.isDefined());
34 CH_assert(a_cellData.isDefined());
35 CH_assert(a_centroidData.nComp() == a_cellData.nComp());
37 const DisjointBoxLayout& dbl = m_eblg.getDBL();
38 const ProblemDomain& domain = m_eblg.getDomain();
39 const EBISLayout& ebisl = m_eblg.getEBISL();
40 const Box& domainBox = domain.domainBox();
42 const EBISBox& ebisBox = ebisl[a_din];
43 const Box& cellBox = dbl[a_din];
44 const BaseIVFAB<VoFStencil>& stencils = m_interpStencils[a_din];
46 const int nComp = a_cellData.nComp();
48 for (
int comp = 0; comp < nComp; comp++) {
51 auto stencilKernel = [&](
const VolIndex& vof) ->
void {
52 a_centroidData(vof, comp) = 0.0;
54 const VoFStencil& stencil = stencils(vof, 0);
55 for (
int i = 0; i < stencil.size(); i++) {
56 const VolIndex& ivof = stencil.vof(i);
57 const Real& iweight = stencil.weight(i);
59 a_centroidData(vof, comp) += iweight * a_cellData(ivof, comp);
64 auto slopeKernel = [&](
const VolIndex& vof) ->
void {
65 const IntVect iv = vof.gridIndex();
67 a_centroidData(vof, comp) = a_cellData(vof, comp);
69 for (
int dir = 0; dir < SpaceDim; dir++) {
72 const bool onLoSide = (iv[dir] == domainBox.smallEnd(dir));
73 const bool onHiSide = (iv[dir] == domainBox.bigEnd(dir));
75 const bool hasFacesLeft = (ebisBox.numFaces(vof, dir, Side::Lo) == 1) && !onLoSide;
76 const bool hasFacesRight = (ebisBox.numFaces(vof, dir, Side::Hi) == 1) && !onHiSide;
78 Vector<FaceIndex> facesLeft;
79 Vector<FaceIndex> facesRight;
89 facesLeft = ebisBox.getFaces(vof, dir, Side::Lo);
90 vofLeft = facesLeft[0].getVoF(Side::Lo);
91 dwl = a_cellData(vof, comp) - a_cellData(vofLeft, comp);
94 facesRight = ebisBox.getFaces(vof, dir, Side::Hi);
95 vofRight = facesRight[0].getVoF(Side::Hi);
96 dwr = a_cellData(vofRight, comp) - a_cellData(vof, comp);
99 if (!hasFacesLeft && hasFacesRight) {
102 else if (hasFacesLeft && !hasFacesRight) {
107 switch (m_interpolationType) {
109 slope = this->MinMod(dwl, dwr);
113 case Type::MonotonizedCentral: {
114 slope = this->MonotonizedCentral(dwl, dwr);
118 case Type::Superbee: {
119 slope = this->Superbee(dwl, dwr);
124 MayDay::Abort(
"CD_CellCentroidInterpolation::interpolate(BaseIVFAB) - logic bust");
130 const Real dx = ebisBox.centroid(vof)[dir];
132 a_centroidData(vof, comp) += slope * dx;
136 switch (m_interpolationType) {
142 case Type::MonotonizedCentral: {
147 case Type::Superbee: {