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


C++ CHF_BOX函数代码示例

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


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

示例1: CH_assert

// Set boundary slopes:
//   The boundary slopes in a_dW are already set to one sided difference
//   approximations.  If this function doesn't change them they will be
//   used for the slopes at the boundaries.
void ExplosionIBC::setBdrySlopes(FArrayBox&       a_dW,
                                 const FArrayBox& a_W,
                                 const int&       a_dir,
                                 const Real&      a_time)
{
  CH_assert(m_isFortranCommonSet == true);
  CH_assert(m_isDefined == true);

  // In periodic case, this doesn't do anything
  if (!m_domain.isPeriodic(a_dir))
  {
    Box loBox,hiBox,centerBox,domain;
    int hasLo,hasHi;
    Box slopeBox = a_dW.box();
    slopeBox.grow(a_dir,1);

    // Generate the domain boundary boxes, loBox and hiBox, if there are
    // domain boundarys there
    loHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,domain,
               slopeBox,m_domain,a_dir);

    // Set the boundary slopes if necessary
    if ((hasLo != 0) || (hasHi != 0))
    {
      FORT_SLOPEBCSF(CHF_FRA(a_dW),
                     CHF_CONST_FRA(a_W),
                     CHF_CONST_INT(a_dir),
                     CHF_BOX(loBox),
                     CHF_CONST_INT(hasLo),
                     CHF_BOX(hiBox),
                     CHF_CONST_INT(hasHi));
    }
  }
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:38,代码来源:ExplosionIBC.cpp

示例2: hiVect

// ----------------------------------------------------------
void
CoarseAverageEdge::averageGridData(FluxBox& a_coarsenedFine,
                                   const FluxBox& a_fine) const
{
  for (int dir=0; dir<SpaceDim; dir++)
    {
      FArrayBox& coarseFab = a_coarsenedFine[dir];
      const FArrayBox& fineFab = a_fine[dir];

      const Box& coarseBox = coarseFab.box();

      // set up refinement box
      int boxHi = m_nRef-1;
      IntVect hiVect(D_DECL(boxHi,boxHi,boxHi));
      // don't want to index at all in dir direction --
      // instead, want to just march along edge.
      hiVect.setVal(dir,0);
      IntVect loVect(D_DECL(0,0,0));
      Box refBox(loVect, hiVect);

      FORT_AVERAGEEDGE( CHF_FRA(coarseFab),
                        CHF_CONST_FRA(fineFab),
                        CHF_BOX(coarseBox),
                        CHF_CONST_INT(dir),
                        CHF_CONST_INT(m_nRef),
                        CHF_BOX(refBox));
    }
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:29,代码来源:CoarseAverageEdge.cpp

示例3: FORT_LINELASTSETFAB

/// Set up initial conditions
void SWIBC::initializeBdry(LevelData<FArrayBox>& a_B)
{
    const Real tmpVal  =  0.0;
    const Real tmpVal2 = 100;
    for (DataIterator dit = a_B.dataIterator(); dit.ok(); ++dit)
    {
        // Storage for current grid
        FArrayBox& B = a_B[dit()];

        // Box of current grid
        Box bBox = B.box();
        bBox &= m_domain;

        // Set up initial condition in this grid
        FORT_LINELASTSETFAB(CHF_FRA1(B,4),
            CHF_BOX(bBox),
            CHF_CONST_REAL(tmpVal));
        FORT_LINELASTSETFAB(CHF_FRA1(B,5),
            CHF_BOX(bBox),
            CHF_CONST_REAL(tmpVal));
        FORT_LINELASTSETFAB(CHF_FRA1(B,6),
            CHF_BOX(bBox),
            CHF_CONST_REAL(tmpVal2));
    }
}
开发者ID:jkozdon,项目名称:tetemoko,代码行数:26,代码来源:SWIBC.cpp

示例4: CH_TIMERS

void
EBMGAverage::averageFAB(EBCellFAB&       a_coar,
                        const Box&       a_boxCoar,
                        const EBCellFAB& a_refCoar,
                        const DataIndex& a_datInd,
                        const Interval&  a_variables) const
{
  CH_TIMERS("EBMGAverage::average");
  CH_TIMER("regular_average", t1);
  CH_TIMER("irregular_average", t2);
  CH_assert(isDefined());

  const Box& coarBox = a_boxCoar;

  //do all cells as if they were regular
  Box refBox(IntVect::Zero, IntVect::Zero);
  refBox.refine(m_refRat);
  int numFinePerCoar = refBox.numPts();

  BaseFab<Real>& coarRegFAB =             a_coar.getSingleValuedFAB();
  const BaseFab<Real>& refCoarRegFAB = a_refCoar.getSingleValuedFAB();

  //set to zero because the fortran is a bit simpleminded
  //and does stuff additively
  a_coar.setVal(0.);
  CH_START(t1);
  for (int comp = a_variables.begin();  comp <= a_variables.end(); comp++)
    {
      FORT_REGAVERAGE(CHF_FRA1(coarRegFAB,comp),
                      CHF_CONST_FRA1(refCoarRegFAB,comp),
                      CHF_BOX(coarBox),
                      CHF_BOX(refBox),
                      CHF_CONST_INT(numFinePerCoar),
                      CHF_CONST_INT(m_refRat));
    }
  CH_STOP(t1);

  //this is really volume-weighted averaging even though it does
  //not look that way.

  //so (in the traditional sense) we want to preserve
  //rhoc * volc = sum(rhof * volf)
  //this translates to
  //volfrac_C * rhoC = (1/numFinePerCoar)(sum(volFrac_F * rhoF))
  //but the data input to this routine is all kappa weigthed so
  //the volumefractions have already been multiplied
  //which means
  // rhoC = (1/numFinePerCoar)(sum(rhoF))
  //which is what this does

  CH_START(t2);
  for (int comp = a_variables.begin();  comp <= a_variables.end(); comp++)
    {
      m_averageEBStencil[a_datInd]->apply(a_coar, a_refCoar, false, comp);
    }
  CH_STOP(t2);

}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:58,代码来源:EBMGAverage.cpp

示例5: CellToEdge

// ------------------------------------------------------------
void CellToEdge(const FArrayBox& a_cellData, FArrayBox& a_edgeData,
                const int a_dir)

{

  Box edgeBox = surroundingNodes(a_cellData.box(), a_dir);
  edgeBox.grow(a_dir,-1);
  edgeBox &= a_edgeData.box();

  int cellComp;
  for (int comp = 0; comp < a_edgeData.nComp(); comp++)
    {
      if (a_cellData.nComp() == a_edgeData.nComp())
        {
          // straightforward cell->edge averaging
          cellComp = comp;
        }
      else
        {
          // each cell comp represents a different spatial direction
          cellComp = SpaceDim*comp + a_dir;
        }

      FORT_CELLTOEDGE(CHF_CONST_FRA1(a_cellData, cellComp),
                      CHF_FRA1(a_edgeData, comp),
                      CHF_BOX(edgeBox),
                      CHF_CONST_INT(a_dir));
    }

}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:31,代码来源:CellToEdge.cpp

示例6: Box

// ---------------------------------------------------------
void
NodeMGInterp::define(const DisjointBoxLayout& a_grids,
                     int a_numcomps,
                     int a_refRatio,
                     const ProblemDomain& a_domain)
{
  m_refRatio = a_refRatio;
  m_domain = a_domain;
  m_grids = a_grids;

  m_boxRef = Box(IntVect::Zero, (m_refRatio-1)*IntVect::Unit);
  Box corners(IntVect::Zero, IntVect::Unit);
  m_weights.define(corners, m_boxRef.numPts());
  FORT_NODEINTERPMG_GETWEIGHTS(CHF_CONST_INT(m_refRatio),
                               CHF_BOX(m_boxRef),
                               CHF_FRA(m_weights));

  // create the work array
  DisjointBoxLayout coarsenedGrids;
  coarsen(coarsenedGrids, a_grids, m_refRatio);

  m_coarsenedFine.define(coarsenedGrids, a_numcomps);

  is_defined = true;
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:26,代码来源:NodeMGInterp.cpp

示例7: m_bc

void NewPoissonOp::restrictResidual(FArrayBox& a_resCoarse,
                                    FArrayBox& a_phiFine,
                                    const FArrayBox& a_rhsFine)
{

  Real dx = m_dx[0];

  FArrayBox& phi = a_phiFine;
  m_bc(phi,  m_domain.domainBox(), m_domain,  dx, true);

  const FArrayBox& rhs = a_rhsFine;
  FArrayBox& res = a_resCoarse;

  Box region = rhs.box();

  res.setVal(0.0);
  Real alpha = 0;
  Real beta = 1.0;
  FORT_RESTRICTRES(CHF_FRA(res),
                   CHF_CONST_FRA(phi),
                   CHF_CONST_FRA(rhs),
                   CHF_CONST_REAL(alpha),
                   CHF_CONST_REAL(beta),
                   CHF_BOX(region),
                   CHF_CONST_REAL(dx));

}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:27,代码来源:NewPoissonOp.cpp

示例8: levelGSRB

void NewPoissonOp::
levelGSRB(FArrayBox&       a_phi,
          const FArrayBox& a_rhs)
{
  CH_assert(a_phi.nComp() == a_rhs.nComp());

  Real dx = m_dx[0];

  // do first red, then black passes
  for (int whichPass =0; whichPass <= 1; whichPass++)
    {

      m_bc(a_phi,  m_domain.domainBox(), m_domain,  dx, true);

      // now step through grids...
      //fill in intersection of ghostcells and a_phi's boxes
      // dfm -- for a 5 point stencil, this should not be necessary
      //a_phi.exchange(a_phi.interval(), m_exchangeCopier);

      // invoke physical BC's where necessary
      //m_bc(a_phi,  m_domain,  dx, true); //new approach to help with checker
#ifndef NDEBUG

#endif

      FORT_GSRBLAPLACIAN(CHF_FRA(a_phi),
                         CHF_CONST_FRA(a_rhs),
                         CHF_BOX(a_rhs.box()),
                         CHF_CONST_REAL(dx),
                         CHF_CONST_INT(whichPass));

    } // end loop through red-black
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:33,代码来源:NewPoissonOp.cpp

示例9: CH_assert

EBCellFAB&
EBCellFAB::divide(const EBCellFAB& a_src,
                  int a_srccomp,
                  int a_destcomp,
                  int a_numcomp)
{

  CH_assert(isDefined());
  CH_assert(a_src.isDefined());
  // Dan G. feels strongly that the assert below should NOT be commented out
  // Brian feels that a weaker version of the CH_assert (if possible) is needed
  // Terry is just trying to get his code to work
  //CH_assert(m_ebisBox == a_src.m_ebisBox);

  CH_assert(a_srccomp + a_numcomp <= a_src.m_nComp);
  CH_assert(a_destcomp + a_numcomp <= m_nComp);
  bool sameRegBox = (a_src.m_regFAB.box() == m_regFAB.box());

  Box locRegion = a_src.m_region & m_region;
  if (!locRegion.isEmpty())
    {
      FORT_DIVIDETWOFAB(CHF_FRA(m_regFAB),
                        CHF_CONST_FRA(a_src.m_regFAB),
                        CHF_BOX(locRegion),
                        CHF_INT(a_srccomp),
                        CHF_INT(a_destcomp),
                        CHF_INT(a_numcomp));
      if (sameRegBox && (locRegion == m_region && locRegion == a_src.m_region))
        {
          Real* l = m_irrFAB.dataPtr(a_destcomp);
          const Real* r = a_src.m_irrFAB.dataPtr(a_srccomp);
          int nvof = m_irrFAB.numVoFs();
          CH_assert(nvof == a_src.m_irrFAB.numVoFs());
          for (int i=0; i<a_numcomp*nvof; i++)
            l[i]/=r[i];
        }
      else
        {
          IntVectSet ivsMulti = a_src.getMultiCells();
          ivsMulti &= getMultiCells();
          ivsMulti &= locRegion;
          IVSIterator ivsit(ivsMulti);
          for (ivsit.reset(); ivsit.ok(); ++ivsit)
            {
              const IntVect& iv = ivsit();
              Vector<VolIndex> vofs = m_ebisBox.getVoFs(iv);
              for (int ivof = 0; ivof < vofs.size(); ivof++)
                {
                  const VolIndex& vof = vofs[ivof];
                  for (int icomp = 0; icomp < a_numcomp; ++icomp)
                    {
                      m_irrFAB(vof, a_destcomp+icomp) /=
                        a_src.m_irrFAB(vof, a_srccomp+icomp);
                    }
                }
            }
        }
    }
  return *this;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:60,代码来源:EBCellFAB.cpp

示例10: applyOpRegularAllDirs

void
EBPoissonOp::
applyOpRegularAllDirs(Box * a_loBox,
                      Box * a_hiBox,
                      int * a_hasLo,
                      int * a_hasHi,
                      Box & a_curDblBox,
                      Box & a_curPhiBox,
                      int a_nComps,
                      BaseFab<Real> & a_curOpPhiFAB,
                      const BaseFab<Real> & a_curPhiFAB,
                      bool a_homogeneousPhysBC,
                      const DataIndex& a_dit,
                      const Real& a_beta)
{
  CH_TIME("EBPoissonOp::applyOpRegularAllDirs");
  CH_assert(m_domainBC != NULL);

  //need to monkey with the ghost cells to account for boundary conditions
  BaseFab<Real>& phiFAB = (BaseFab<Real>&) a_curPhiFAB;
  applyDomainFlux(a_loBox, a_hiBox, a_hasLo, a_hasHi,
                  a_curDblBox, a_nComps, phiFAB,
                  a_homogeneousPhysBC, a_dit,m_beta);

  for (int comp = 0; comp<a_nComps; comp++)
    {

      FORT_REGGET1DLAPLACIAN_INPLACE(CHF_FRA1(a_curOpPhiFAB,comp),
                                     CHF_CONST_FRA1(a_curPhiFAB,comp),
                                     CHF_CONST_REAL(a_beta),
                                     CHF_CONST_REALVECT(m_dx),
                                     CHF_BOX(a_curDblBox));
    }
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:34,代码来源:EBPoissonOp.cpp

示例11: CH_assert

// Set boundary fluxes
void RampIBC::primBC(FArrayBox&            a_WGdnv,
                     const FArrayBox&      a_Wextrap,
                     const FArrayBox&      a_W,
                     const int&            a_dir,
                     const Side::LoHiSide& a_side,
                     const Real&           a_time)
{
  CH_assert(m_isFortranCommonSet == true);
  CH_assert(m_isDefined == true);

  // Neither the x or y direction can be periodic
  if ((a_dir == 0 || a_dir == 1) && m_domain.isPeriodic(a_dir))
    {
      MayDay::Error("RampIBC::primBC: Neither the x or y boundaries can be periodic");
    }

  Box boundaryBox;
  getBoundaryFaces(boundaryBox, a_WGdnv.box(), a_dir, a_side);

  if (! boundaryBox.isEmpty() )
    {
      // Set the boundary fluxes
      int lohisign = sign(a_side);
      FORT_RAMPBCF(CHF_FRA(a_WGdnv),
                   CHF_CONST_FRA(a_Wextrap),
                   CHF_CONST_FRA(a_W),
                   CHF_CONST_REAL(a_time),
                   CHF_CONST_INT(lohisign),
                   CHF_CONST_REAL(m_dx),
                   CHF_CONST_INT(a_dir),
                   CHF_BOX(boundaryBox));
    }
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:34,代码来源:RampIBC.cpp

示例12: levelDivergenceMAC

// ---------------------------------------------------------
void levelDivergenceMAC(LevelData<FArrayBox>& a_div,
                        const LevelData<FluxBox>& a_uEdge,
                        const Real a_dx)
{

  // silly way to do this until i figure out a better
  // way to make this dimensionally-independent
  CH_assert (a_uEdge.nComp() >= a_div.nComp());


  DataIterator dit = a_div.dataIterator();
  for (dit.reset(); dit.ok(); ++dit)
  {
    a_div[dit()].setVal(0.0);

    const FluxBox& thisFluxBox = a_uEdge[dit()];
    Box cellBox(thisFluxBox.box());
    // just to be sure we don't accidentally trash memory...
    cellBox &= a_div[dit()].box();

    // now loop over coordinate directions and add to divergence
    for (int dir=0; dir<SpaceDim; dir++)
    {
      const FArrayBox& uEdgeDir = thisFluxBox[dir];

      FORT_DIVERGENCE(CHF_CONST_FRA(uEdgeDir),
                      CHF_FRA(a_div[dit()]),
                      CHF_BOX(cellBox),
                      CHF_CONST_REAL(a_dx),
                      CHF_INT(dir));
    }

  }

}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:36,代码来源:Divergence.cpp

示例13: CH_assert

/**
  Given input left and right states in a direction, a_dir, compute a
  Riemann problem and generate fluxes at the faces within a_box.
  */
void LinElastPhysics::riemann(/// face-centered solution to Riemann problem
    FArrayBox&       a_WStar,
    /// left state, on cells to left of each face
    const FArrayBox& a_WLeft,
    /// right state, on cells to right of each face
    const FArrayBox& a_WRight,
    /// state on cells, used to set boundary conditions
    const FArrayBox& a_W,
    /// current time
    const Real&      a_time,
    /// direction of faces
    const int&       a_dir,
    /// face-centered box on which to set a_WStar
    const Box&       a_box)
{
    //JK pout() << "LinElastPhysics::riemann" << endl;
    CH_assert(isDefined());

    CH_assert(a_WStar.box().contains(a_box));

    // Get the numbers of relevant variables
    int numPrim = numPrimitives();

    CH_assert(a_WStar .nComp() == numPrim);
    CH_assert(a_WLeft .nComp() == numPrim);
    CH_assert(a_WRight.nComp() == numPrim);

    // Cast away "const" inputs so their boxes can be shifted left or right
    // 1/2 cell and then back again (no net change is made!)
    FArrayBox& shiftWLeft  = (FArrayBox&)a_WLeft;
    FArrayBox& shiftWRight = (FArrayBox&)a_WRight;

    // Solution to the Riemann problem

    // Shift the left and right primitive variable boxes 1/2 cell so they are
    // face centered
    shiftWLeft .shiftHalf(a_dir, 1);
    shiftWRight.shiftHalf(a_dir,-1);

    CH_assert(shiftWLeft .box().contains(a_box));
    CH_assert(shiftWRight.box().contains(a_box));

    // Riemann solver computes Wgdnv all edges that are not on the physical
    // boundary.
    FORT_RIEMANNF(CHF_FRA(a_WStar),
        CHF_CONST_FRA(shiftWLeft),
        CHF_CONST_FRA(shiftWRight),
        CHF_CONST_INT(a_dir),
        CHF_BOX(a_box));

    // Call boundary Riemann solver (note: periodic BC's are handled there).
    m_bc->primBC(a_WStar,shiftWLeft ,a_W,a_dir,Side::Hi,a_time);
    m_bc->primBC(a_WStar,shiftWRight,a_W,a_dir,Side::Lo,a_time);

    // Shift the left and right primitive variable boxes back to their original
    // position.
    shiftWLeft .shiftHalf(a_dir,-1);
    shiftWRight.shiftHalf(a_dir, 1);
}
开发者ID:jkozdon,项目名称:tetemoko,代码行数:63,代码来源:LinElastPhysics.cpp

示例14: CH_TIME

void VCAMRPoissonOp2::residualI(LevelData<FArrayBox>&       a_lhs,
                               const LevelData<FArrayBox>& a_phi,
                               const LevelData<FArrayBox>& a_rhs,
                               bool                        a_homogeneous)
{
  CH_TIME("VCAMRPoissonOp2::residualI");

  LevelData<FArrayBox>& phi = (LevelData<FArrayBox>&)a_phi;
  Real dx = m_dx;
  const DisjointBoxLayout& dbl = a_lhs.disjointBoxLayout();
  DataIterator dit = phi.dataIterator();
  {
    CH_TIME("VCAMRPoissonOp2::residualIBC");

    for (dit.begin(); dit.ok(); ++dit)
    {
      m_bc(phi[dit], dbl[dit()],m_domain, dx, a_homogeneous);
    }
  }

  phi.exchange(phi.interval(), m_exchangeCopier);

  for (dit.begin(); dit.ok(); ++dit)
    {
      const Box& region = dbl[dit()];
      const FluxBox& thisBCoef = (*m_bCoef)[dit];

#if CH_SPACEDIM == 1
      FORT_VCCOMPUTERES1D
#elif CH_SPACEDIM == 2
      FORT_VCCOMPUTERES2D
#elif CH_SPACEDIM == 3
      FORT_VCCOMPUTERES3D
#else
      This_will_not_compile!
#endif
                         (CHF_FRA(a_lhs[dit]),
                          CHF_CONST_FRA(phi[dit]),
                          CHF_CONST_FRA(a_rhs[dit]),
                          CHF_CONST_REAL(m_alpha),
                          CHF_CONST_FRA((*m_aCoef)[dit]),
                          CHF_CONST_REAL(m_beta),
#if CH_SPACEDIM >= 1
                          CHF_CONST_FRA(thisBCoef[0]),
#endif
#if CH_SPACEDIM >= 2
                          CHF_CONST_FRA(thisBCoef[1]),
#endif
#if CH_SPACEDIM >= 3
                          CHF_CONST_FRA(thisBCoef[2]),
#endif
#if CH_SPACEDIM >= 4
                          This_will_not_compile!
#endif
                          CHF_BOX(region),
                          CHF_CONST_REAL(m_dx));
    } // end loop over boxes
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:58,代码来源:VCAMRPoissonOp2.cpp

示例15: EdgeToCell

void EdgeToCell(const FluxBox& a_edgeData, const int a_edgeComp,
                FArrayBox& a_cellData, const int a_cellComp,
                const Box& a_cellBox, const int a_dir)
{

  FORT_EDGETOCELL(CHF_CONST_FRA1(a_edgeData[a_dir],a_edgeComp),
                  CHF_FRA1(a_cellData, a_cellComp),
                  CHF_BOX(a_cellBox),
                  CHF_CONST_INT(a_dir));
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:10,代码来源:EdgeToCell.cpp


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