本文整理汇总了C++中ProblemDomain::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ ProblemDomain::isEmpty方法的具体用法?C++ ProblemDomain::isEmpty怎么用?C++ ProblemDomain::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProblemDomain
的用法示例。
在下文中一共展示了ProblemDomain::isEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: periodicTestBox
void
CFStencil::define(
const ProblemDomain& a_fineDomain,
const Box& a_grid,
const DisjointBoxLayout& a_fineBoxes,
const DisjointBoxLayout& a_coarBoxes,
int a_refRatio,
int a_direction,
Side::LoHiSide a_hiorlo)
{
m_isDefined = true;
CH_assert(a_refRatio >= 1);
CH_assert(a_direction >= 0);
CH_assert(a_direction < SpaceDim);
CH_assert((a_hiorlo == Side::Lo) ||
(a_hiorlo == Side::Hi));
CH_assert(!a_fineDomain.isEmpty());
//set internal vars. most of these are kept around
//just to keep the class from having an identity crisis.
m_direction = a_direction;
m_hiorlo = a_hiorlo;
Box finebox = a_grid;
//compute intvectset of all points on fine grid that
//need to be interpolated
//shift direction
int hilo = sign(a_hiorlo);
//create fine stencil
Box edgebox;
CH_assert((hilo ==1) || (hilo == -1));
if (hilo == -1)
{
edgebox = adjCellLo(finebox,m_direction,1);
}
else
{
edgebox = adjCellHi(finebox,m_direction,1);
}
edgebox = a_fineDomain & edgebox;
if (!edgebox.isEmpty())
{
Box periodicTestBox(a_fineDomain.domainBox());
if (a_fineDomain.isPeriodic())
{
for (int idir=0; idir<SpaceDim; idir++)
{
if (a_fineDomain.isPeriodic(idir))
{
periodicTestBox.grow(idir,-1);
}
}
}
m_fineIVS.define(edgebox);
LayoutIterator lit = a_fineBoxes.layoutIterator();
for (lit.reset(); lit.ok(); ++lit)
{
m_fineIVS -= a_fineBoxes[lit()];
// if periodic, also need to subtract periodic images
// only do this IF we're periodic _and_ both boxes
// adjoin the domain box boundary somewhere
if (a_fineDomain.isPeriodic() && !periodicTestBox.contains(edgebox)
&& !periodicTestBox.contains(a_fineBoxes[lit()]))
{
ShiftIterator shiftIt = a_fineDomain.shiftIterator();
IntVect shiftMult(a_fineDomain.domainBox().size());
Box shiftedBox(a_fineBoxes[lit()]);
for (shiftIt.begin(); shiftIt.ok(); ++shiftIt)
{
IntVect shiftVect = shiftMult*shiftIt();
shiftedBox.shift(shiftVect);
m_fineIVS -= shiftedBox;
shiftedBox.shift(-shiftVect);
} // end loop over periodic shift directions
} // end if periodic
}
}
//ivs where all coarse slopes are defined
//== coarsened fine ivs
m_coarIVS.define(m_fineIVS);
m_coarIVS.coarsen(a_refRatio);
// this is a trick to get around the lack of a IntVectSet intersection
// operator which works with a ProblemDomain
ProblemDomain coardom= coarsen(a_fineDomain, a_refRatio);
Box domainIntersectBox = m_coarIVS.minBox();
domainIntersectBox = coardom & domainIntersectBox;
m_coarIVS &= domainIntersectBox;
m_packedBox = m_fineIVS.minBox();
if (m_fineIVS.numPts() == m_packedBox.numPts())
{
m_isPacked = true;
}
else
//.........这里部分代码省略.........
示例2: sign
void
CFStencil::define(
const ProblemDomain& a_fineDomain,
const Box& a_grid,
const Vector<Box>& a_periodicVector,
int a_refRatio,
int a_direction,
Side::LoHiSide a_hiorlo)
{
m_isDefined = true;
CH_assert(a_refRatio >= 1);
CH_assert(a_direction >= 0);
CH_assert(a_direction < SpaceDim);
CH_assert((a_hiorlo == Side::Lo) ||
(a_hiorlo == Side::Hi));
CH_assert(!a_fineDomain.isEmpty());
//set internal vars. most of these are kept around
//just to keep the class from having an identity crisis.
m_direction = a_direction;
m_hiorlo = a_hiorlo;
Box finebox = a_grid;
//compute intvectset of all points on fine grid that
//need to be interpolated
//shift direction
int hilo = sign(a_hiorlo);
//create fine stencil
Box edgebox;
CH_assert((hilo ==1) || (hilo == -1));
if (hilo == -1)
{
edgebox = adjCellLo(finebox,m_direction,1);
}
else
{
edgebox = adjCellHi(finebox,m_direction,1);
}
edgebox = a_fineDomain & edgebox;
if (edgebox.isEmpty()) return;
int w1 = edgebox.smallEnd()[0];
int w2 = edgebox.bigEnd()[0];
m_fineIVS.define(edgebox);
// moving window loop in i-direction (bvs)
for (int i=0; i<a_periodicVector.size(); ++i)
{
const Box& b = a_periodicVector[i];
if (b.bigEnd()[0] >= w1)
{
m_fineIVS -= b;
if (b.smallEnd()[0] > w2)
{
i=a_periodicVector.size();
}
}
}
//ivs where all coarse slopes are defined
//== coarsened fine ivs
m_coarIVS.define(m_fineIVS);
m_coarIVS.coarsen(a_refRatio);
// this is a trick to get around the lack of a IntVectSet intersection
// operator which works with a ProblemDomain
ProblemDomain coardom= coarsen(a_fineDomain, a_refRatio);
Box domainIntersectBox = m_coarIVS.minBox();
domainIntersectBox = coardom & domainIntersectBox;
m_coarIVS &= domainIntersectBox;
m_packedBox = m_fineIVS.minBox();
if (m_fineIVS.numPts() == m_packedBox.numPts())
{
m_isPacked = true;
}
else
{
m_isPacked = false;
m_packedBox = Box();
}
}
示例3: testBox
// new define
void
LevelFluxRegisterEdge::define(
const DisjointBoxLayout& a_dbl,
const DisjointBoxLayout& a_dblCoarse,
const ProblemDomain& a_dProblem,
int a_nRefine,
int a_nComp)
{
m_isDefined = true;
CH_assert(a_nRefine > 0);
CH_assert(a_nComp > 0);
CH_assert(!a_dProblem.isEmpty());
m_nComp = a_nComp;
m_nRefine = a_nRefine;
m_domainCoarse = coarsen(a_dProblem, a_nRefine);
CH_assert (a_dblCoarse.checkPeriodic(m_domainCoarse));
// allocate copiers
m_crseCopiers.resize(SpaceDim*2);
SideIterator side;
// create a Vector<Box> of the fine boxes which also includes periodic images,
// since we don't really care about the processor layouts, etc
Vector<Box> periodicFineBoxes;
CFStencil::buildPeriodicVector(periodicFineBoxes, a_dProblem, a_dbl);
// now coarsen these boxes...
for (int i=0; i<periodicFineBoxes.size(); i++)
{
periodicFineBoxes[i].coarsen(m_nRefine);
}
for (int idir=0 ; idir<SpaceDim; ++idir)
{
for (side.begin(); side.ok(); ++side)
{
// step one, build fineBoxes, flux register boxes
// indexed by the fine level but in the coarse index
// space
DisjointBoxLayout fineBoxes,tmp;
// first create coarsened dbl, then compute flux register boxes
// adjacent to coarsened fine boxes
coarsen(tmp, a_dbl, m_nRefine);
if (side() == Side::Lo)
{
adjCellLo(fineBoxes, tmp, idir,1);
}
else
{
adjCellHi(fineBoxes, tmp, idir,1);
}
// now define the FluxBoxes of fabFine on this DisjointBoxLayout
m_fabFine[index(idir, side())].define(fineBoxes, a_nComp);
LayoutData<Vector<Vector<IntVectSet> > >& ivsetsVect
= m_refluxLocations[index(idir, side())];
ivsetsVect.define(a_dblCoarse);
LayoutData<Vector<DataIndex> >& mapsV =
m_coarToCoarMap[index(idir, side())];
mapsV.define(a_dblCoarse);
DisjointBoxLayout coarseBoxes = a_dblCoarse;
DataIterator dit = a_dblCoarse.dataIterator();
for (dit.begin(); dit.ok(); ++dit)
{
unsigned int thisproc = a_dblCoarse.procID(dit());
if (thisproc == procID())
{
ivsetsVect[DataIndex(dit())].resize(SpaceDim);
}
const Box& coarseBox = a_dblCoarse[dit()];
int count = 0;
for (int i=0; i<periodicFineBoxes.size(); i++)
{
Box regBox;
if (side() == Side::Lo)
{
regBox = adjCellLo(periodicFineBoxes[i], idir, 1);
}
else
{
regBox = adjCellHi(periodicFineBoxes[i], idir, 1);
}
// do this little dance in order to ensure that
// we catch corner cells which might be in different
// boxes.
Box testBox(regBox);
testBox.grow(1);
testBox.grow(idir,-1);
if (testBox.intersectsNotEmpty(coarseBox))
{
testBox &= coarseBox;
++count;
unsigned int proc = a_dblCoarse.procID(dit());
//.........这里部分代码省略.........