本文整理汇总了C++中FArrayBox::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ FArrayBox::resize方法的具体用法?C++ FArrayBox::resize怎么用?C++ FArrayBox::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArrayBox
的用法示例。
在下文中一共展示了FArrayBox::resize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: faceTestBox
void VCAMRPoissonOp2::getFlux(FArrayBox& a_flux,
const FArrayBox& a_data,
const FluxBox& a_bCoef,
const Box& a_facebox,
int a_dir,
int a_ref) const
{
CH_TIME("VCAMRPoissonOp2::getFlux");
CH_assert(a_dir >= 0);
CH_assert(a_dir < SpaceDim);
CH_assert(!a_data.box().isEmpty());
CH_assert(!a_facebox.isEmpty());
// probably the simplest way to test centering
// a_box needs to be face-centered in the a_dir
Box faceTestBox(IntVect::Zero, IntVect::Unit);
faceTestBox.surroundingNodes(a_dir);
CH_assert(a_facebox.type() == faceTestBox.type());
const FArrayBox& bCoefDir = a_bCoef[a_dir];
// reality check for bCoef
CH_assert(bCoefDir.box().contains(a_facebox));
a_flux.resize(a_facebox, a_data.nComp());
BoxIterator bit(a_facebox);
Real scale = m_beta * a_ref / m_dx;
for ( bit.begin(); bit.ok(); bit.next())
{
IntVect iv = bit();
IntVect shiftiv = BASISV(a_dir);
IntVect ivlo = iv - shiftiv;
IntVect ivhi = iv;
CH_assert(a_data.box().contains(ivlo));
CH_assert(a_data.box().contains(ivhi));
for (int ivar = 0; ivar < a_data.nComp(); ivar++)
{
Real phihi = a_data(ivhi,ivar);
Real philo = a_data(ivlo,ivar);
Real gradphi = (phihi - philo ) * scale;
a_flux(iv,ivar) = -bCoefDir(iv, ivar) * gradphi;
}
}
}