• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BL_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BL_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ BL_ASSERT函数的具体用法?C++ BL_ASSERT怎么用?C++ BL_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: BL_ASSERT

void
BaseFab<Real>::performSetVal (Real       val,
                              const Box& bx,
                              int        comp,
                              int        ncomp)
{
    BL_ASSERT(domain.contains(bx));
    BL_ASSERT(comp >= 0 && comp + ncomp <= nvar);

    Real* data = dataPtr(comp);

    if (bx == domain)
    {
        for (long i = 0, N = ncomp*numpts; i < N; i++)
        {
            *data++ = val;
        }
    }
    else
    {
        const int* _box_lo = bx.loVect(); 
        const int* _box_hi = bx.hiVect(); 
        const int* _th_plo = loVect(); 
        const int* _th_phi = hiVect(); 

        FORT_FASTSETVAL(&val,
                        _box_lo,
                        _box_hi,
                        data,
                        ARLIM(_th_plo),
                        ARLIM(_th_phi),
                        &ncomp);
    }
}
开发者ID:memmett,项目名称:BoxLib,代码行数:34,代码来源:BaseFab.cpp


示例2: average_face_to_cellcenter

    void average_face_to_cellcenter (MultiFab& cc, const PArray<MultiFab>& fc, const Geometry& geom)
    {
	BL_ASSERT(cc.nComp() >= BL_SPACEDIM);
	BL_ASSERT(fc.size() == BL_SPACEDIM);
	BL_ASSERT(fc[0].nComp() == 1); // We only expect fc to have the gradient perpendicular to the face

	const Real* dx     = geom.CellSize();
	const Real* problo = geom.ProbLo();
	int coord_type = Geometry::Coord();

#ifdef _OPENMP
#pragma omp parallel
#endif
	for (MFIter mfi(cc,true); mfi.isValid(); ++mfi) 
	{
	    const Box& bx = mfi.tilebox();

	    BL_FORT_PROC_CALL(BL_AVG_FC_TO_CC,bl_avg_fc_to_cc)
		(bx.loVect(), bx.hiVect(),
		 BL_TO_FORTRAN(cc[mfi]),
		 D_DECL(BL_TO_FORTRAN(fc[0][mfi]),
			BL_TO_FORTRAN(fc[1][mfi]),
			BL_TO_FORTRAN(fc[2][mfi])),
		 dx, problo, coord_type);
	}
    }
开发者ID:BoxLib-Codes,项目名称:BoxLib,代码行数:26,代码来源:MultiFabUtil.cpp


示例3: BL_ASSERT

Real
FMultiGrid::solve (PArray<MultiFab>& phi,
		   PArray<MultiFab>& rhs,
		   Real rel_tol, Real abs_tol,
		   int always_use_bnorm ,
		   int need_grad_phi,
		   int verbose)
{
    BL_ASSERT(  m_bc.initilized || m_bndry != 0);
    BL_ASSERT(!(m_bc.initilized && m_bndry != 0));
    BL_ASSERT(m_coeff.eq_type != invalid_eq);
    BL_ASSERT(m_mgt_solver == 0);

    MultiFab* phi_p[m_nlevels];
    MultiFab* rhs_p[m_nlevels];
    for (int ilev=0; ilev < m_nlevels; ++ilev) 
    {
	phi_p[ilev] = &phi[ilev];
	rhs_p[ilev] = &rhs[ilev];
    }    

    init_mgt_solver(phi);

    Real final_resnorm;
    m_mgt_solver->solve(phi_p, rhs_p, *m_bndry, rel_tol, abs_tol, 
			always_use_bnorm, final_resnorm, need_grad_phi);
    return final_resnorm;
}
开发者ID:BoxLib-Codes,项目名称:BoxLib,代码行数:28,代码来源:FMultiGrid.cpp


示例4: BL_ASSERT

void
BoxList::catenate (BoxList& blist)
{
    BL_ASSERT(ixType() == blist.ixType());
    lbox.splice(lbox.end(), blist.lbox);
    BL_ASSERT(blist.isEmpty());
}
开发者ID:huahbo,项目名称:BoxLib,代码行数:7,代码来源:BoxList.cpp


示例5: sm

Box
Box::chop (int dir,
           int chop_pnt)
{
    //
    // Define new high end Box including chop_pnt.
    //
    IntVect sm(smallend);
    IntVect bg(bigend);
    sm.setVal(dir,chop_pnt);
    if (btype[dir])
    {
        //
        // NODE centered Box.
        //
        BL_ASSERT(chop_pnt > smallend[dir] && chop_pnt < bigend[dir]);
        //
        // Shrink original Box to just contain chop_pnt.
        //
        bigend.setVal(dir,chop_pnt);
    }
    else
    {
        //
        // CELL centered Box.
        //
        BL_ASSERT(chop_pnt > smallend[dir] && chop_pnt <= bigend[dir]);
        //
        // Shrink origional Box to one below chop_pnt.
        //
        bigend.setVal(dir,chop_pnt-1);
    }
    return Box(sm,bg,btype);
}
开发者ID:kunal-puri,项目名称:BoxLib,代码行数:34,代码来源:Box.cpp


示例6: BL_ASSERT

void
StateData::copyNew (const StateData& state)
{

  BL_ASSERT(state.hasNewData());
  BL_ASSERT(new_data != 0);

  const MultiFab& MF = state.newData();

  int nc = MF.nComp();
  int ng = MF.nGrow();

  BL_ASSERT(nc == (*new_data).nComp());
  BL_ASSERT(ng == (*new_data).nGrow());

  MultiFab::Copy(*new_data, state.newData(), 0, 0, nc, ng);

  StateDescriptor::TimeCenter t_typ(desc->timeType());

  if (t_typ == StateDescriptor::Point)
    {
      new_time.start = new_time.stop = state.curTime();
    }
  else
    {
      Real dt = state.curTime() - state.prevTime();

      new_time.start = state.curTime() - dt/2.0;
      new_time.stop  = state.curTime() + dt/2.0;
    }

}
开发者ID:dwillcox,项目名称:BoxLib,代码行数:32,代码来源:StateData.cpp


示例7: BL_ASSERT

void
ABec4::aCoefficients (const MultiFab& _a)
{
    BL_ASSERT(_a.ok());
    BL_ASSERT(_a.boxArray() == (acoefs[0])->boxArray());
    invalidate_a_to_level(0);
    MultiFab::Copy(*acoefs[0],_a,0,0,acoefs[0]->nComp(),acoefs[0]->nGrow());
}
开发者ID:BoxLib-Codes,项目名称:BoxLib,代码行数:8,代码来源:ABec4.cpp


示例8: StoreObject

//----------------------------------------------------------------------------
// like C-style
void StoreObject(int i, int maxCntObject, std::string nameClass, void* pThis)
{
  static TMapStrInt mMapClassCnt;// для нахождения по имени класса макс. кол-ва объектов
  static TMapPtrStr mMapPtrName; //                по указателю на объект имя класса
  int cntMake = 0;
  bool res = false;

  LockThread(nsLockThread::eLock);// блокировка
  switch(i)
  {
    case nsStoreObject::ePush:
    {
      //-------------------------------
      TMapStrInt::iterator fit = mMapClassCnt.find(nameClass);
      if(fit==mMapClassCnt.end())
      {
        // не нашли - добавить
        mMapClassCnt.insert(TMapStrInt::value_type(nameClass,1));
        fit = mMapClassCnt.find(nameClass);

        // что бы потом найти в деструкторе
        mMapPtrName.insert(TMapPtrStr::value_type(pThis,nameClass));
      }
      else
        fit->second++;

      cntMake = fit->second;
    }
    break;
    case nsStoreObject::ePop:
    {
      //-------------------------------
      TMapPtrStr::iterator fit_name = mMapPtrName.find(pThis);
      if(fit_name!=mMapPtrName.end())
      {
        TMapStrInt::iterator fit = mMapClassCnt.find(fit_name->second);
        if(fit!=mMapClassCnt.end())
        {
          fit->second--;
          cntMake = fit->second;
          res = true;
        }
      }
    }
    break;
  }
  LockThread(nsLockThread::eUnlock);// разблокировать
  // проверка результатов
  switch(i)
  {
    case nsStoreObject::ePush:
      BL_ASSERT(cntMake <= maxCntObject);
      break;
    case nsStoreObject::ePop:
      BL_ASSERT(cntMake >= 0 && res);
      break;
  }
}
开发者ID:2asoft,项目名称:MMO-Framework,代码行数:60,代码来源:Only_N_Object.cpp


示例9: BL_PROFILE

void
BoxLib::WriteMultiLevelPlotfile (const std::string& plotfilename, int nlevels,
				 const Array<const MultiFab*>& mf,
				 const Array<std::string>& varnames,
				 const Array<Geometry>& geom, Real time, const Array<int>& level_steps,
				 const Array<IntVect>& ref_ratio)
{
    BL_PROFILE("WriteMultiLevelPlotfile()");

    BL_ASSERT(nlevels <= mf.size());
    BL_ASSERT(nlevels <= geom.size());
    BL_ASSERT(nlevels <= ref_ratio.size()+1);
    BL_ASSERT(nlevels <= level_steps.size());
    BL_ASSERT(mf[0]->nComp() == varnames.size());

    int finest_level = nlevels-1;

    //
    // Only let 64 CPUs be writing at any one time.
    //
    int saveNFiles(VisMF::GetNOutFiles());
    VisMF::SetNOutFiles(64);

    const std::string versionName("HyperCLaw-V1.1");
    const std::string levelPrefix("Level_");
    const std::string mfPrefix("Cell");

    bool callBarrier(true);
    BoxLib::PreBuildDirectorHierarchy(plotfilename, levelPrefix, nlevels, callBarrier);

    if (ParallelDescriptor::IOProcessor()) {
      std::string HeaderFileName(plotfilename + "/Header");
      std::ofstream HeaderFile(HeaderFileName.c_str(), std::ofstream::out   |
	                                               std::ofstream::trunc |
						       std::ofstream::binary);
      if( ! HeaderFile.good()) {
        BoxLib::FileOpenFailed(HeaderFileName);
      }

      Array<BoxArray> boxArrays(nlevels);
      for(int level(0); level < boxArrays.size(); ++level) {
	boxArrays[level] = mf[level]->boxArray();
      }

      BoxLib::WriteGenericPlotfileHeader(HeaderFile, nlevels, boxArrays, varnames,
                                         geom, time, level_steps, ref_ratio);
    }


    for (int level = 0; level <= finest_level; ++level)
    {
	VisMF::Write(*mf[level], MultiFabFileFullPrefix(level, plotfilename, levelPrefix, mfPrefix));
    }

    VisMF::SetNOutFiles(saveNFiles);
}
开发者ID:BoxLib-Codes,项目名称:BoxLib,代码行数:56,代码来源:PlotFileUtil.cpp


示例10: BL_ASSERT

CArena::CArena (size_t hunk_size)
{
    //
    // Force alignment of hunksize.
    //
    m_hunk = Arena::align(hunk_size == 0 ? DefaultHunkSize : hunk_size);
    m_used = 0;

    BL_ASSERT(m_hunk >= hunk_size);
    BL_ASSERT(m_hunk%Arena::align_size == 0);
}
开发者ID:dwillcox,项目名称:BoxLib,代码行数:11,代码来源:CArena.cpp


示例11: BL_ASSERT

void
BndryRegister::setBoxes (const BoxArray& _grids)
{
    BL_ASSERT(grids.size() == 0);
    BL_ASSERT(_grids.size() > 0);
    BL_ASSERT(_grids[0].cellCentered());

    grids.define(_grids);
    //
    // Check that bndry regions are not allocated.
    //
    for (int k = 0; k < 2*BL_SPACEDIM; k++)
        BL_ASSERT(bndry[k].size() == 0);
}
开发者ID:memmett,项目名称:BoxLib,代码行数:14,代码来源:BndryRegister.cpp


示例12: BL_ASSERT

void
AuxBoundaryData::copy (const AuxBoundaryData& src,
                       int                    src_comp,
                       int                    dst_comp,
                       int                    num_comp)
{
    if (m_empty || src.m_empty) return;

    BL_ASSERT(m_initialized);
    BL_ASSERT(src_comp + num_comp <= src.m_fabs.nComp());
    BL_ASSERT(dst_comp + num_comp <= m_fabs.nComp());

    m_fabs.copy(src.m_fabs,src_comp,dst_comp,num_comp);
}
开发者ID:huahbo,项目名称:BoxLib,代码行数:14,代码来源:AuxBoundaryData.cpp


示例13: BL_ASSERT

bool
StateDescriptor::identicalInterps (int scomp,
                                   int ncomp) const
{
    BL_ASSERT(scomp >= 0);
    BL_ASSERT(ncomp >= 1);

    Interpolater* map = interp(scomp);

    for (int i = scomp+1; i < scomp+ncomp; i++)
        if (!(map == interp(i)))
            return false;

    return true;
}
开发者ID:huahbo,项目名称:BoxLib,代码行数:15,代码来源:StateDescriptor.cpp


示例14: average_down

    void average_down (MultiFab& S_fine, MultiFab& S_crse, 
                       int scomp, int ncomp, const IntVect& ratio)
    {
        BL_ASSERT(S_crse.nComp() == S_fine.nComp());

        //
        // Coarsen() the fine stuff on processors owning the fine data.
        //
        BoxArray crse_S_fine_BA = S_fine.boxArray(); crse_S_fine_BA.coarsen(ratio);

        MultiFab crse_S_fine(crse_S_fine_BA,ncomp,0);

#ifdef _OPENMP
#pragma omp parallel
#endif
        for (MFIter mfi(crse_S_fine,true); mfi.isValid(); ++mfi)
        {
            //  NOTE: The tilebox is defined at the coarse level.
            const Box& tbx = mfi.tilebox();

            //  NOTE: We copy from component scomp of the fine fab into component 0 of the crse fab
            //        because the crse fab is a temporary which was made starting at comp 0, it is
            //        not part of the actual crse multifab which came in.

            BL_FORT_PROC_CALL(BL_AVGDOWN,bl_avgdown)
                (tbx.loVect(), tbx.hiVect(),
                 BL_TO_FORTRAN_N(S_fine[mfi],scomp),
                 BL_TO_FORTRAN_N(crse_S_fine[mfi],0),
                 ratio.getVect(),&ncomp);
        }

        S_crse.copy(crse_S_fine,0,scomp,ncomp);
   }
开发者ID:BoxLib-Codes,项目名称:BoxLib,代码行数:33,代码来源:MultiFabUtil.cpp


示例15: BL_ASSERT

void
Box::next (IntVect&   p,
           const int* shv) const
{
    BL_ASSERT(contains(p));

#if   BL_SPACEDIM==1
    p.shift(0,shv[0]);
#elif BL_SPACEDIM==2
    p.shift(0,shv[0]);
    if (!(p <= bigend))
    {
        //
        // Reset 1 coord is on edge, and 2 coord is incremented.
        //
        p.setVal(0,smallend[0]);
        p.shift(1,shv[1]);
    }
#elif BL_SPACEDIM==3
    p.shift(0,shv[0]);
    if (!(p <= bigend))
    {
        //
        // Reset 1 coord is on edge, and 2 coord is incremented.
        //
        p.setVal(0,smallend[0]);
        p.shift(1,shv[1]);
        if(!(p <= bigend))
        {
            p.setVal(1,smallend[1]);
            p.shift(2,shv[2]);
        }
    }
#endif
}
开发者ID:kunal-puri,项目名称:BoxLib,代码行数:35,代码来源:Box.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BMM_BUFFER_POINTER函数代码示例发布时间:2022-05-30
下一篇:
C++ BLUE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap