本文整理汇总了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);
}
}
}