void EBLevelGrid:: defineCoveringIVS() { CH_assert(m_isDefined); if (!m_isCoveringIVSDefined) { m_isCoveringIVSDefined = true; //define the covering ivs by first assembling its complement const Box& domBox = m_domain.domainBox(); IntVectSet complementIVS(domBox); for (LayoutIterator lit = m_grids.layoutIterator(); lit.ok(); ++lit) { complementIVS -= m_grids.get(lit()); } m_coveringIVS = IntVectSet(domBox); m_coveringIVS -= complementIVS; } }
void EBLevelTransport:: define(const DisjointBoxLayout& a_thisDBL, const DisjointBoxLayout& a_coarDBL, const EBISLayout& a_thisEBISL, const EBISLayout& a_coarEBISL, const ProblemDomain& a_domain, const int& a_nRefine, const RealVect& a_dx, const bool& a_hasCoarser, const bool& a_hasFiner, RefCountedPtr<EBPatchTransport>& a_patchGodunov, const EBIndexSpace* const a_eb) { CH_TIME("EBLevelTransport::define"); CH_assert(a_dx[0] > 0.0); CH_assert(a_nRefine > 0); m_ebPatchGodunov = a_patchGodunov; m_isDefined = true; m_thisGrids = a_thisDBL; m_thisEBISL = a_thisEBISL; m_refRatCrse = a_nRefine; m_dx = a_dx; m_domain = a_domain; m_hasCoarser = a_hasCoarser; m_hasFiner = a_hasFiner; if (m_hasCoarser) { m_coarGrids = a_coarDBL; m_coarEBISL = a_coarEBISL; } m_nVar = m_ebPatchGodunov->numPrimitives(); m_nPrim = m_ebPatchGodunov->numPrimitives(); m_nCons = m_ebPatchGodunov->numConserved(); m_nFlux = m_ebPatchGodunov->numFluxes(); m_irregSetsSmall.define(m_thisGrids); for(DataIterator dit = m_thisGrids.dataIterator(); dit.ok(); ++dit) { const EBISBox& ebisBox = m_thisEBISL[dit()]; if(!ebisBox.isAllCovered()) { const Box& thisBox = m_thisGrids.get(dit()); m_irregSetsSmall[dit()] = ebisBox.getIrregIVS(thisBox); } } m_cfIVS.define(m_thisGrids); for(DataIterator ditOuter = m_thisGrids.dataIterator(); ditOuter.ok(); ++ditOuter) { const EBISBox& ebisBox = m_thisEBISL[ditOuter()]; if(!ebisBox.isAllCovered()) { // make a grown box of the grid and then subtract off each grid in the //domain to make the coarse-fine IVS // CFIVS = grow(b, 1) - sum(bi) Box grownBox = grow(m_thisGrids.get(ditOuter()), 1); grownBox &= m_domain; IntVectSet complementIVS(grownBox); for(LayoutIterator litInner = m_thisGrids.layoutIterator(); litInner.ok(); ++litInner) { Box innerBox = m_thisGrids.get(litInner()); complementIVS -= innerBox; } m_cfIVS[ditOuter()] = complementIVS; } } m_nGhost = a_thisEBISL.getGhost(); if (m_hasCoarser) { CH_TIME("EBLevelTransport::define::fillPatchDefine"); ProblemDomain domainCrse = coarsen(m_domain, m_refRatCrse); //patcher is defined with the number of conserved vars. m_fillPatch.define(m_thisGrids, m_coarGrids, m_thisEBISL, m_coarEBISL, domainCrse, m_refRatCrse, m_nVar, m_nGhost, a_eb); m_fillPatchVel.define(m_thisGrids, m_coarGrids, m_thisEBISL, m_coarEBISL, domainCrse, m_refRatCrse, SpaceDim, m_nGhost, a_eb); } m_irregSetsSmall.define(m_thisGrids); for(DataIterator dit = m_thisGrids.dataIterator(); dit.ok(); ++dit) { const EBISBox& ebisBox = m_thisEBISL[dit()]; if(!ebisBox.isAllCovered()) { const Box& thisBox = m_thisGrids.get(dit()); m_irregSetsSmall[dit()] = ebisBox.getIrregIVS(thisBox); } } for(int faceDir = 0; faceDir < SpaceDim; faceDir++) { EBArith::defineFluxInterpolant(m_fluxInterpolants[faceDir], m_irregSetsGrown [faceDir], m_thisGrids, m_thisEBISL, m_domain, m_nFlux, faceDir); } BaseIVFactory<Real> cellFactorySmall(m_thisEBISL, m_irregSetsSmall); m_nonConsDivergence.define(m_thisGrids, m_nCons, IntVect::Zero, cellFactorySmall); m_ebIrregFaceFlux.define(m_thisGrids, m_nFlux, IntVect::Zero, cellFactorySmall); //create temp data with the correct number of ghost cells IntVect ivGhost = m_nGhost*IntVect::Unit; EBCellFactory factory(m_thisEBISL); IntVect flatGhostIV = 3*IntVect::Unit; m_flattening.define(m_thisGrids, 1, flatGhostIV, factory); }