本文整理汇总了C++中BoxArray::coarsen方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxArray::coarsen方法的具体用法?C++ BoxArray::coarsen怎么用?C++ BoxArray::coarsen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxArray
的用法示例。
在下文中一共展示了BoxArray::coarsen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: face
MCMultiGrid::MCMultiGrid (MCLinOp &_lp)
:
initialsolution(0),
Lp(_lp)
{
Initialize();
maxiter = def_maxiter;
numiter = def_numiter;
nu_0 = def_nu_0;
nu_1 = def_nu_1;
nu_2 = def_nu_2;
nu_f = def_nu_f;
usecg = def_usecg;
verbose = def_verbose;
rtol_b = def_rtol_b;
atol_b = def_atol_b;
nu_b = def_nu_b;
numLevelsMAX = def_numLevelsMAX;
numlevels = numLevels();
numcomps = _lp.numberComponents();
if ( ParallelDescriptor::IOProcessor() && (verbose > 2) )
{
BoxArray tmp = Lp.boxArray();
std::cout << "MCMultiGrid: numlevels = " << numlevels
<< ": ngrid = " << tmp.size() << ", npts = [";
for ( int i = 0; i < numlevels; ++i )
{
if ( i > 0 ) tmp.coarsen(2);
std::cout << tmp.d_numPts() << " ";
}
std::cout << "]" << '\n';
std::cout << "MCMultiGrid: " << numlevels
<< " multigrid levels created for this solve" << '\n';
}
if ( ParallelDescriptor::IOProcessor() && (verbose > 4) )
{
std::cout << "Grids: " << '\n';
BoxArray tmp = Lp.boxArray();
for (int i = 0; i < numlevels; ++i)
{
Orientation face(0, Orientation::low);
const DistributionMapping& map = Lp.bndryData().bndryValues(face).DistributionMap();
if (i > 0)
tmp.coarsen(2);
std::cout << " Level: " << i << '\n';
for (int k = 0; k < tmp.size(); k++)
{
const Box& b = tmp[k];
std::cout << " [" << k << "]: " << b << " ";
for (int j = 0; j < BL_SPACEDIM; j++)
std::cout << b.length(j) << ' ';
std::cout << ":: " << map[k] << '\n';
}
}
}
}
示例2: MultiFab
MultiFab*
Nyx::build_fine_mask()
{
BL_ASSERT(level > 0); // because we are building a mask for the coarser level
if (fine_mask != 0) return fine_mask;
BoxArray baf = parent->boxArray(level);
baf.coarsen(crse_ratio);
const BoxArray& bac = parent->boxArray(level-1);
fine_mask = new MultiFab(bac,parent->DistributionMap(level-1), 1,0);
fine_mask->setVal(1.0);
#ifdef _OPENMP
#pragma omp parallel
#endif
for (MFIter mfi(*fine_mask); mfi.isValid(); ++mfi)
{
FArrayBox& fab = (*fine_mask)[mfi];
std::vector< std::pair<int,Box> > isects = baf.intersections(fab.box());
for (int ii = 0; ii < isects.size(); ii++)
{
fab.setVal(0.0,isects[ii].second,0);
}
}
return fine_mask;
}