当前位置: 首页>>代码示例>>C++>>正文


C++ MultiFab::EnforcePeriodicity方法代码示例

本文整理汇总了C++中MultiFab::EnforcePeriodicity方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiFab::EnforcePeriodicity方法的具体用法?C++ MultiFab::EnforcePeriodicity怎么用?C++ MultiFab::EnforcePeriodicity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MultiFab的用法示例。


在下文中一共展示了MultiFab::EnforcePeriodicity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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));
//.........这里部分代码省略.........
开发者ID:BoxLib-Codes,项目名称:BoxLib,代码行数:101,代码来源:ABec4.cpp


注:本文中的MultiFab::EnforcePeriodicity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。