本文整理汇总了C++中DisjointBoxLayout::coarsenable方法的典型用法代码示例。如果您正苦于以下问题:C++ DisjointBoxLayout::coarsenable方法的具体用法?C++ DisjointBoxLayout::coarsenable怎么用?C++ DisjointBoxLayout::coarsenable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DisjointBoxLayout
的用法示例。
在下文中一共展示了DisjointBoxLayout::coarsenable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refine
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();
}
示例2: computeAMRError
//.........这里部分代码省略.........
for (ditFine.begin(); ditFine.ok(); ++ditFine)
{
FArrayBox& thisFineSoln = exactSolnRef[ditFine()];
const Box& fineBox = exactSolnRef.getBoxes()[ditFine()];
exactBC.applyInhomogeneousBCs(thisFineSoln, fineBox, a_exactDx);
}
exactSolnRef.exchange(exactComps);
// outer loop is over levels
for (int level = 0; level < numLevels; level++)
{
LevelData<FArrayBox>& thisLevelError = *a_error[level];
LevelData<FArrayBox>& thisLevelComputed = *a_computedSoln[level];
// compute refinement ratio between solution at this level
// and exact solution
Real nRefTemp = (dxLevel / a_exactDx);
int nRefExact = (int) nRefTemp;
// this is to do rounding properly if necessary
if (nRefTemp - nRefExact > 0.5) nRefExact += 1;
// make sure it's not zero
if (nRefExact == 0) nRefExact =1;
const DisjointBoxLayout levelGrids = a_error[level]->getBoxes();
const DisjointBoxLayout fineGrids = a_exactSoln[0]->getBoxes();
DisjointBoxLayout coarsenedFineGrids;
// petermc, 14 Jan 2014: Replace this because fineGrids might
// not be coarsenable by nRefExact.
// coarsen(coarsenedFineGrids, fineGrids, nRefExact);
int nCoarsenExact = nRefExact;
while ( !fineGrids.coarsenable(nCoarsenExact) && (nCoarsenExact > 0) )
{
// Divide nCoarsenExact by 2 until fineGrids is coarsenable by it.
nCoarsenExact /= 2;
}
if (nCoarsenExact == 0)
{
nCoarsenExact = 1;
}
coarsen(coarsenedFineGrids, fineGrids, nCoarsenExact);
int numExact = a_exactVars.size();
LevelData<FArrayBox> averagedExact(coarsenedFineGrids, numExact);
Box fineRefBox(IntVect::Zero, (nCoarsenExact-1)*IntVect::Unit);
// average fine solution down to coarsened-fine level
// loop over grids and do HO averaging down
//DataIterator crseExactDit = coarsenedFineGrids.dataIterator();
for (ditFine.reset(); ditFine.ok(); ++ditFine)
{
const Box fineBox = exactSolnRef.getBoxes()[ditFine()];
FArrayBox fineTemp(fineBox, 1);
Box coarsenedFineBox(fineBox);
coarsenedFineBox.coarsen(nCoarsenExact);
if (a_exactDx < a_computedDx)
{
// loop over components
for (int comp = 0; comp < numExact; comp++)
{
Box coarseBox(coarsenedFineGrids.get(ditFine()));
coarseBox &= coarsenedFineBox;
示例3: dblBufFine
void
EBCoarseAverage::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)
{
CH_TIME("EBCoarseAverage::define");
CH_assert(ebisPtr->isDefined());
ProblemDomain domainFine = a_domainCoar;
domainFine.refine(a_nref);
EBLevelGrid eblgFine;
EBLevelGrid eblgCoar = EBLevelGrid(a_dblCoar, a_ebislCoar, a_domainCoar);
EBLevelGrid eblgCoFi;
//check to see if the input layout is coarsenable.
//if so, proceed with ordinary drill
//otherwise, see if the layout covers the domain.
//if it does, we can use domainsplit
if (a_dblFine.coarsenable(a_nref))
{
eblgFine = EBLevelGrid(a_dblFine, a_ebislFine, domainFine);
m_useFineBuffer = false;
}
else
{
Box fineDomBox = refine(a_domainCoar.domainBox(), a_nref);
int numPtsDom = fineDomBox.numPts();
//no need for gathers here because the meta data is global
int numPtsLayout = 0;
for (LayoutIterator lit = a_dblFine.layoutIterator(); lit.ok(); ++lit)
{
numPtsLayout += a_dblFine.get(lit()).numPts();
}
bool coveringDomain = (numPtsDom == numPtsLayout);
if (coveringDomain)
{
m_useFineBuffer = true;
int maxBoxSize = 4*a_nref;
Vector<Box> boxes;
Vector<int> procs;
domainSplit(fineDomBox, boxes, maxBoxSize);
mortonOrdering(boxes);
LoadBalance(procs, boxes);
DisjointBoxLayout dblBufFine(boxes, procs);
eblgFine = EBLevelGrid(dblBufFine, domainFine, 2, eblgCoar.getEBIS());
}
else
{
pout() << "EBCoarseAverage::input layout is not coarsenable and does not cover the domain--bailing out" << endl;
MayDay::Error();
}
}
coarsen(eblgCoFi, eblgFine, a_nref);
define(eblgFine, eblgCoar, eblgCoFi, a_nref, a_nvar);
}