void EBMGInterp::define(const DisjointBoxLayout& a_dblFine, const DisjointBoxLayout& a_dblCoar, const EBISLayout& a_ebislFine, const EBISLayout& a_ebislCoar, const ProblemDomain& a_domainCoar, const int& a_nref, const int& a_nvar, const EBIndexSpace* ebisPtr, const IntVect& a_ghostCellsPhi, const bool& a_layoutChanged, const bool& a_doLinear) { CH_TIMERS("EBMGInterp::define"); CH_TIMER("fillEBISLayout", t1); m_isDefined = true; m_doLinear = a_doLinear; m_ghost = a_ghostCellsPhi; m_nComp = a_nvar; m_coarGrids = a_dblCoar; m_fineGrids = a_dblFine; m_coarEBISL = a_ebislCoar; m_fineEBISL = a_ebislFine; m_coarDomain = a_domainCoar; m_refRat = a_nref; m_fineDomain = refine(m_coarDomain, m_refRat); m_layoutChanged = a_layoutChanged; m_coarsenable = a_dblFine.coarsenable(m_refRat); //only define ebislbuf and gridbuf if we are changing layouts if (m_layoutChanged) { ProblemDomain domebisl; if (m_coarsenable) { coarsen(m_buffGrids, m_fineGrids, m_refRat); domebisl = m_coarDomain; } else { refine(m_buffGrids, m_coarGrids, m_refRat); m_copierRCtoF.define(m_buffGrids, m_fineGrids, a_ghostCellsPhi); m_copierFtoRC.define(m_fineGrids, m_buffGrids, a_ghostCellsPhi); domebisl = m_fineDomain; } CH_START(t1); int nghost = 4; ebisPtr->fillEBISLayout(m_buffEBISL, m_buffGrids, domebisl, nghost); if (m_refRat > 2) { if (m_coarsenable) { m_buffEBISL.setMaxRefinementRatio(m_refRat, ebisPtr); } else { m_buffEBISL.setMaxCoarseningRatio(m_refRat, ebisPtr); } } CH_STOP(t1); } defineStencils(); }
EBPoissonOp:: EBPoissonOp( const EBLevelGrid & a_eblg, const EBLevelGrid & a_eblgCoarMG, const RefCountedPtr<BaseDomainBC>& a_domainBC, const RefCountedPtr<BaseEBBC>& a_ebBC, const RealVect& a_dx, const RealVect& a_origin, const bool& a_hasMGObjects, const int& a_numPreCondIters, const int& a_relaxType, const int& a_orderEB, const Real& a_alpha, const Real& a_beta, const IntVect& a_ghostCellsPhi, const IntVect& a_ghostCellsRHS) : m_ghostCellsPhi( a_ghostCellsPhi ), m_ghostCellsRHS( a_ghostCellsRHS ) { EBArith::getMultiColors(m_colors); m_numPreCondIters= a_numPreCondIters; m_relaxType = a_relaxType; m_orderEB = a_orderEB; m_eblg = a_eblg; m_domainBC = a_domainBC; m_ebBC = a_ebBC; m_dx = a_dx; m_origin = a_origin; m_alpha = a_alpha; m_beta = a_beta; m_time = 0.0; //pre-compute 1/dx and 1/(dx^2) m_invDx = 1.0/m_dx; for (int idir = 0; idir < SpaceDim; idir++) { m_invDx2[idir] = m_invDx[idir]*m_invDx[idir]; } //dxScale is used for unscaling the boundary area (see GeometryShop) // (it would be better if we could just use m_dx[0]) Real maxDx = 0.0; Real dv = 1.0; for (int idir = 0; idir < SpaceDim; idir++) { dv *= m_dx[idir]; if ( m_dx[idir] > maxDx ) { maxDx = m_dx[idir]; } } m_dxScale = pow(maxDx,SpaceDim-1)/dv; //special mg objects for when we do not have //a coarser level or when the refinement to coarse //is greater than two //flag for when we need special MG objects //in this case, we have no coarser levels because this is a single //level operator m_hasMGObjects = a_hasMGObjects; if (m_hasMGObjects) { int mgRef = 2; m_eblgCoarMG = a_eblgCoarMG; int ncomp = 1; m_ebInterpMG.define( m_eblg.getDBL(), m_eblgCoarMG.getDBL(), m_eblg.getEBISL(), m_eblgCoarMG.getEBISL(), m_eblgCoarMG.getDomain(), mgRef, ncomp, m_eblg.getEBIS(), m_ghostCellsPhi); m_ebAverageMG.define(m_eblg.getDBL(), m_eblgCoarMG.getDBL(), m_eblg.getEBISL(), m_eblgCoarMG.getEBISL(), m_eblgCoarMG.getDomain() , mgRef, ncomp, m_eblg.getEBIS(), m_ghostCellsRHS); } //define stencils for the operator defineStencils(); }