本文整理汇总了C++中MultiFab::box方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiFab::box方法的具体用法?C++ MultiFab::box怎么用?C++ MultiFab::box使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiFab
的用法示例。
在下文中一共展示了MultiFab::box方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: numLevels
void
LinOp::applyBC (MultiFab& inout,
int src_comp,
int num_comp,
int level,
LinOp::BC_Mode bc_mode,
bool local,
int bndry_comp)
{
BL_PROFILE("LinOp::applyBC()");
//
// The inout MultiFab needs at least LinOp_grow ghost cells for applyBC.
//
BL_ASSERT(inout.nGrow() >= LinOp_grow);
//
// No coarsened boundary values, cannot apply inhomog at lev>0.
//
BL_ASSERT(level < numLevels());
BL_ASSERT(!(level > 0 && bc_mode == Inhomogeneous_BC));
int flagden = 1; // Fill in undrrelxr.
int flagbc = 1; // Fill boundary data.
if (bc_mode == LinOp::Homogeneous_BC)
//
// No data if homogeneous.
//
flagbc = 0;
const bool cross = true;
inout.FillBoundary(src_comp,num_comp,local,cross);
prepareForLevel(level);
//
// Do periodic fixup.
//
BL_ASSERT(level<geomarray.size());
geomarray[level].FillPeriodicBoundary(inout,src_comp,num_comp,false,local);
//
// Fill boundary cells.
//
// OMP over boxes
#ifdef _OPENMP
#pragma omp parallel
#endif
for (MFIter mfi(inout); mfi.isValid(); ++mfi)
{
const int gn = mfi.index();
BL_ASSERT(gbox[level][gn] == inout.box(gn));
BL_ASSERT(level<maskvals.size() && maskvals[level].local_index(gn)>=0);
BL_ASSERT(level<lmaskvals.size() && lmaskvals[level].local_index(gn)>=0);
BL_ASSERT(level<undrrelxr.size());
const MaskTuple& ma = maskvals[level][gn];
const MaskTuple& lma = lmaskvals[level][gn];
const BndryData::RealTuple& bdl = bgb->bndryLocs(gn);
const Array< Array<BoundCond> >& bdc = bgb->bndryConds(gn);
for (OrientationIter oitr; oitr; ++oitr)
{
const Orientation o = oitr();
FabSet& f = (*undrrelxr[level])[o];
int cdr = o;
const FabSet& fs = bgb->bndryValues(o);
const Mask& m = local ? (*lma[o]) : (*ma[o]);
Real bcl = bdl[o];
BL_ASSERT(bdc[o].size()>bndry_comp);
int bct = bdc[o][bndry_comp];
const Box& vbx = inout.box(gn);
FArrayBox& iofab = inout[mfi];
BL_ASSERT(f.size()>gn);
BL_ASSERT(fs.size()>gn);
FArrayBox& ffab = f[mfi];
const FArrayBox& fsfab = fs[mfi];
FORT_APPLYBC(&flagden, &flagbc, &maxorder,
iofab.dataPtr(src_comp),
ARLIM(iofab.loVect()), ARLIM(iofab.hiVect()),
&cdr, &bct, &bcl,
fsfab.dataPtr(bndry_comp),
ARLIM(fsfab.loVect()), ARLIM(fsfab.hiVect()),
m.dataPtr(),
ARLIM(m.loVect()), ARLIM(m.hiVect()),
ffab.dataPtr(),
ARLIM(ffab.loVect()), ARLIM(ffab.hiVect()),
vbx.loVect(),
vbx.hiVect(), &num_comp, h[level]);
}
}
}
示例2: cdr
void
MCLinOp::applyBC (MultiFab& inout,
int level,
MCBC_Mode bc_mode)
{
//
// The inout MultiFab must have at least MCLinOp_grow ghost cells
// for applyBC()
//
BL_ASSERT(inout.nGrow() >= MCLinOp_grow);
//
// The inout MultiFab must have at least Periodic_BC_grow cells for the
// algorithms taking care of periodic boundary conditions.
//
BL_ASSERT(inout.nGrow() >= MCLinOp_grow);
//
// No coarsened boundary values, cannot apply inhomog at lev>0.
//
BL_ASSERT(!(level>0 && bc_mode == MCInhomogeneous_BC));
int flagden = 1; // fill in the bndry data and undrrelxr
int flagbc = 1; // with values
if (bc_mode == MCHomogeneous_BC)
flagbc = 0; // nodata if homog
int nc = inout.nComp();
BL_ASSERT(nc == numcomp );
inout.setBndry(-1.e30);
inout.FillBoundary();
prepareForLevel(level);
geomarray[level].FillPeriodicBoundary(inout,0,nc);
//
// Fill boundary cells.
//
#ifdef _OPENMP
#pragma omp parallel
#endif
for (MFIter mfi(inout); mfi.isValid(); ++mfi)
{
const int gn = mfi.index();
BL_ASSERT(gbox[level][gn] == inout.box(gn));
const BndryData::RealTuple& bdl = bgb.bndryLocs(gn);
const Array< Array<BoundCond> >& bdc = bgb.bndryConds(gn);
const MaskTuple& msk = maskvals[level][gn];
for (OrientationIter oitr; oitr; ++oitr)
{
const Orientation face = oitr();
FabSet& f = (*undrrelxr[level])[face];
FabSet& td = (*tangderiv[level])[face];
int cdr(face);
const FabSet& fs = bgb.bndryValues(face);
Real bcl = bdl[face];
const Array<BoundCond>& bc = bdc[face];
const int *bct = (const int*) bc.dataPtr();
const FArrayBox& fsfab = fs[gn];
const Real* bcvalptr = fsfab.dataPtr();
//
// Way external derivs stored.
//
const Real* exttdptr = fsfab.dataPtr(numcomp);
const int* fslo = fsfab.loVect();
const int* fshi = fsfab.hiVect();
FArrayBox& inoutfab = inout[gn];
FArrayBox& denfab = f[gn];
FArrayBox& tdfab = td[gn];
#if BL_SPACEDIM==2
int cdir = face.coordDir(), perpdir = -1;
if (cdir == 0)
perpdir = 1;
else if (cdir == 1)
perpdir = 0;
else
BoxLib::Abort("MCLinOp::applyBC(): bad logic");
const Mask& m = *msk[face];
const Mask& mphi = *msk[Orientation(perpdir,Orientation::high)];
const Mask& mplo = *msk[Orientation(perpdir,Orientation::low)];
FORT_APPLYBC(
&flagden, &flagbc, &maxorder,
inoutfab.dataPtr(),
ARLIM(inoutfab.loVect()), ARLIM(inoutfab.hiVect()),
&cdr, bct, &bcl,
bcvalptr, ARLIM(fslo), ARLIM(fshi),
m.dataPtr(), ARLIM(m.loVect()), ARLIM(m.hiVect()),
mphi.dataPtr(), ARLIM(mphi.loVect()), ARLIM(mphi.hiVect()),
mplo.dataPtr(), ARLIM(mplo.loVect()), ARLIM(mplo.hiVect()),
denfab.dataPtr(),
ARLIM(denfab.loVect()), ARLIM(denfab.hiVect()),
exttdptr, ARLIM(fslo), ARLIM(fshi),
tdfab.dataPtr(),ARLIM(tdfab.loVect()),ARLIM(tdfab.hiVect()),
inout.box(gn).loVect(), inout.box(gn).hiVect(),
&nc, h[level]);
#elif BL_SPACEDIM==3
const Mask& mn = *msk[Orientation(1,Orientation::high)];
const Mask& me = *msk[Orientation(0,Orientation::high)];
const Mask& mw = *msk[Orientation(0,Orientation::low)];
//.........这里部分代码省略.........
示例3: NumGrow
void
ABec4::applyBC (MultiFab& inout,
int src_comp,
int num_comp,
int level,
LinOp::BC_Mode bc_mode,
bool local,
int bndry_comp)
{
//
// The inout MultiFab needs enough ghost cells for applyBC.
//
BL_ASSERT(inout.nGrow() >= NumGrow(level));
//
// No coarsened boundary values, cannot apply inhomog at lev>0.
//
BL_ASSERT(level < numLevelsHO());
BL_ASSERT(!(level > 0 && bc_mode == Inhomogeneous_BC));
int flagden = 1; // Fill in undrrelxr.
int flagbc = 1; // Fill boundary data.
if (bc_mode == LinOp::Homogeneous_BC)
//
// No data if homogeneous.
//
flagbc = 0;
prepareForLevel(level);
const bool cross = false;
inout.FillBoundary(src_comp,num_comp,geomarray[level].periodicity(),cross);
#ifdef _OPENMP
#pragma omp parallel
#endif
for (MFIter mfi(inout); mfi.isValid(); ++mfi)
{
const int gn = mfi.index();
BL_ASSERT(gbox[level][gn] == inout.box(gn));
BL_ASSERT(level<undrrelxr.size());
const BndryData::RealTuple& bdl = bgb->bndryLocs(gn);
const Array< Array<BoundCond> >& bdc = bgb->bndryConds(gn);
for (OrientationIter oitr; oitr; ++oitr)
{
const Orientation o = oitr();
FabSet& f = (*undrrelxr[level])[o];
int cdr = o;
const FabSet& fs = bgb->bndryValues(o);
const Mask& m = local ? lmaskvals[level][o][mfi] : maskvals[level][o][mfi];
Real bcl = bdl[o];
BL_ASSERT(bdc[o].size()>bndry_comp);
int bct = bdc[o][bndry_comp];
const Box& vbx = inout.box(gn);
FArrayBox& iofab = inout[gn];
BL_ASSERT(f.size()>gn);
BL_ASSERT(fs.size()>gn);
FArrayBox& ffab = f[gn];
const FArrayBox& fsfab = fs[gn];
FORT_APPLYBC4(&flagden, &flagbc, &maxorder,
iofab.dataPtr(src_comp),
ARLIM(iofab.loVect()), ARLIM(iofab.hiVect()),
&cdr, &bct, &bcl,
fsfab.dataPtr(bndry_comp),
ARLIM(fsfab.loVect()), ARLIM(fsfab.hiVect()),
m.dataPtr(),
ARLIM(m.loVect()), ARLIM(m.hiVect()),
ffab.dataPtr(),
ARLIM(ffab.loVect()), ARLIM(ffab.hiVect()),
vbx.loVect(),
vbx.hiVect(), &num_comp, h[level]);
}
}
// Clean up corners:
// The problem here is that APPLYBC fills only grow cells normal to the boundary.
// As a result, any corner cell on the boundary (either coarse-fine or fine-fine)
// is not filled. For coarse-fine, the operator adjusts itself, sliding away from
// the box edge to avoid referencing that corner point. On the physical boundary
// though, the corner point is needed. Particularly if a fine-fine boundary intersects
// the physical boundary, since we want the stencil to be independent of the box
// blocking.
inout.EnforcePeriodicity(geomarray[level].periodicity());
#ifdef _OPENMP
#pragma omp parallel
#endif
for (MFIter mfi(inout); mfi.isValid(); ++mfi) {
const int gn = mfi.index();
BL_ASSERT(gbox[level][gn] == inout.box(gn));
//.........这里部分代码省略.........