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


C++ Patch::getAge方法代码示例

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


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

示例1: virtualSubgrid

void peanoclaw::interSubgridCommunication::GridLevelTransfer::restrictToOverlappingVirtualSubgrids(
  Patch&           subgrid,
  ParallelSubgrid& parallelSubgrid
) {
  tarch::multicore::Lock lock(_virtualPatchListSemaphore);

  //Restrict to all
  //for(int i = 0;  i < (int)_virtualPatchDescriptionIndices.size(); i++) {
  for(VirtualSubgridMap::iterator i = _virtualPatchDescriptionIndices.begin();
      i != _virtualPatchDescriptionIndices.end();
      i++) {
    int virtualSubgridDescriptionIndex = i->second;
    CellDescription& virtualSubgridDescription = CellDescriptionHeap::getInstance().getData(virtualSubgridDescriptionIndex).at(0);
    Patch virtualSubgrid(virtualSubgridDescription);
    ParallelSubgrid virtualParallelSubgrid(virtualSubgridDescription);

    // Restrict only if coarse patches can advance in time
    bool areAllCoarseSubgridsBlocked
    = tarch::la::smaller(
        subgrid.getTimeIntervals().getCurrentTime() + subgrid.getTimeIntervals().getTimestepSize(),
        virtualSubgrid.getTimeIntervals().getMinimalLeafNeighborTimeConstraint()
      );
    // Restrict only if this patch is overlapped by neighboring ghostlayers
    bool isOverlappedByCoarseGhostlayers
      = tarch::la::oneGreater(virtualSubgrid.getUpperNeighboringGhostlayerBounds(), subgrid.getPosition())
        || tarch::la::oneGreater(subgrid.getPosition() + subgrid.getSize(), virtualSubgrid.getLowerNeighboringGhostlayerBounds());

    bool subgridOverlapsVirtualSubgrid = !tarch::la::oneGreater(virtualSubgrid.getPosition(), subgrid.getPosition())
                                      && !tarch::la::oneGreater(subgrid.getPosition() + subgrid.getSize(), virtualSubgrid.getPosition() + virtualSubgrid.getSize());

    //TODO unterweg debug
//    if(tarch::la::equals(subgrid.getPosition()(0), 10.0*2.0/3.0)
//      &&tarch::la::equals(subgrid.getPosition()(1), 10.0*2.0/3.0)) {
//      std::cout << "Restricting from " << subgrid
//          << ", isOverlapped=" << isOverlappedByCoarseGhostlayers
//          << ", areAllCoarseSubgridsBlocked=" << areAllCoarseSubgridsBlocked
//          << ", willCoarsen=" << virtualSubgrid.willCoarsen()
//          << std::endl << subgrid.toStringUNew() << std::endl
//          << " to " << virtualSubgrid << std::endl << virtualSubgrid.toStringUNew() << std::endl;
//    }

    if(
      subgridOverlapsVirtualSubgrid &&
      (
        // Restrict if virtual subgrid is coarsening or if the data on the virtual subgrid is required for timestepping
        virtualSubgrid.willCoarsen()
        || (!areAllCoarseSubgridsBlocked && isOverlappedByCoarseGhostlayers)
        //TODO unterweg dissertation: Es kann sein, dass ein Nachbarsubgitter vom groben Subgitter noch nicht angekommen ist, wenn
        //das Gitter gerade verteilt wurde.
        || subgrid.getAge() < 2
        //|| true
      )
    ) {
      assertion2(virtualSubgrid.isVirtual(), subgrid.toString(), virtualSubgrid.toString());
      assertion2(!tarch::la::oneGreater(virtualSubgrid.getPosition(), subgrid.getPosition())
          && !tarch::la::oneGreater(subgrid.getPosition() + subgrid.getSize(), virtualSubgrid.getPosition() + virtualSubgrid.getSize()),
          subgrid.toString(), virtualSubgrid.toString());

      int numberOfRestrictedCells
       = _numerics.restrictSolution(subgrid, virtualSubgrid, !virtualSubgrid.willCoarsen());
      _subgridStatistics.addRestrictedCells(numberOfRestrictedCells, subgrid.getLevel());

      virtualSubgrid.getTimeIntervals().setEstimatedNextTimestepSize(
        subgrid.getTimeIntervals().getEstimatedNextTimestepSize()
      );
    }

    if(!parallelSubgrid.wasCurrentStateSent()) {
      //virtualParallelSubgrid.markCurrentStateAsSent(virtualParallelSubgrid.wasCurrentStateSent() || parallelSubgrid.wasCurrentStateSent());
      virtualParallelSubgrid.markCurrentStateAsSent(false);
    }
  }
}
开发者ID:unterweg,项目名称:peanoclaw,代码行数:73,代码来源:GridLevelTransfer.cpp


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