本文整理汇总了C++中EBISBox::centroid方法的典型用法代码示例。如果您正苦于以下问题:C++ EBISBox::centroid方法的具体用法?C++ EBISBox::centroid怎么用?C++ EBISBox::centroid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EBISBox
的用法示例。
在下文中一共展示了EBISBox::centroid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ivsregion
void
setToExactFlux(EBFluxFAB& a_flux,
const EBISBox& a_ebisBox,
const Box& a_region,
const Real& a_dx)
{
IntVectSet ivsregion(a_region);
for (int faceDir = 0; faceDir < SpaceDim; faceDir++)
{
for (FaceIterator faceit(ivsregion, a_ebisBox.getEBGraph(), faceDir, FaceStop::SurroundingWithBoundary); faceit.ok(); ++faceit)
{
RealVect xval;
IntVect iv = faceit().gridIndex(Side::Hi);
RealVect centroid = a_ebisBox.centroid(faceit());
for (int idir = 0; idir < SpaceDim; idir++)
{
if (idir == faceDir)
{
xval[idir] = (Real(iv[idir]))*a_dx;
}
else
{
xval[idir] = (Real(iv[idir]) + 0.5 + centroid[idir])*a_dx;
}
}
Real fluxDir = exactFlux(xval, faceDir);
a_flux[faceDir](faceit(), 0) = fluxDir;
}
} //end loop over face directions
}
示例2: if
void EBPoissonOp::
getOpFaceStencil(VoFStencil& a_stencil,
const Vector<VolIndex>& a_allMonotoneVoFs,
const EBISBox& a_ebisbox,
const VolIndex& a_VoF,
int a_dir,
const Side::LoHiSide& a_side,
const FaceIndex& a_face,
const bool& a_lowOrder)
{
a_stencil.clear();
const RealVect& faceCentroid = a_ebisbox.centroid(a_face);
const IntVect& origin = a_VoF.gridIndex();
IntVect dirs = IntVect::Zero;
for (int idir = 0; idir < SpaceDim; idir++)
{
if (idir != a_dir)
{
IntVect ivPlus = origin;
ivPlus[idir] += 1;
if (faceCentroid[idir] < 0.0)
{
dirs[idir] = -1;
}
else if (faceCentroid[idir] > 0.0)
{
dirs[idir] = 1;
}
else if (m_eblg.getDomain().contains(ivPlus))
{
dirs[idir] = 1;
}
else
{
dirs[idir] = -1;
}
}
}
bool orderOne = true;
if (m_orderEB == 0 || a_lowOrder)
{
orderOne = false;
}
else
{
IntVect loVect = dirs;
loVect.min(IntVect::Zero);
IntVect hiVect = dirs;
hiVect.max(IntVect::Zero);
Box fluxBox(loVect,hiVect);
IntVectSet fluxIVS(fluxBox);
IVSIterator ivsit(fluxIVS);
for (ivsit.begin(); ivsit.ok(); ++ivsit)
{
bool curOkay;
IntVect ivDelta = ivsit();
IntVect iv1 = ivDelta;
iv1 += origin;
VolIndex VoF1;
curOkay = EBArith::isVoFHere(VoF1,a_allMonotoneVoFs,iv1);
IntVect iv2 = iv1;
iv2[a_dir] += sign(a_side);
VolIndex VoF2;
curOkay = curOkay && EBArith::isVoFHere(VoF2,a_allMonotoneVoFs,iv2);
orderOne = orderOne && curOkay;
if (curOkay)
{
VoFStencil curPair;
curPair.add(VoF1,-m_invDx2[a_dir]);
curPair.add(VoF2, m_invDx2[a_dir]);
for (int idir = 0; idir < SpaceDim; idir++)
{
if (idir != a_dir)
{
if (ivDelta[idir] == 0)
{
curPair *= 1 - abs(faceCentroid[idir]);
}
else
{
curPair *= abs(faceCentroid[idir]);
}
//.........这里部分代码省略.........