本文整理汇总了C++中Area::_size方法的典型用法代码示例。如果您正苦于以下问题:C++ Area::_size方法的具体用法?C++ Area::_size怎么用?C++ Area::_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Area
的用法示例。
在下文中一共展示了Area::_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: areaUpperBound
peanoclaw::Area peanoclaw::Area::mapCellToPatch(
const tarch::la::Vector<DIMENSIONS, double>& finePosition,
const tarch::la::Vector<DIMENSIONS, double>& fineSubcellSize,
const tarch::la::Vector<DIMENSIONS, double>& coarseSubcellSize,
const tarch::la::Vector<DIMENSIONS, int>& coarseSubcellIndex,
const tarch::la::Vector<DIMENSIONS, double>& coarseSubcellPosition,
const double& epsilon
) const {
Area cellArea;
//cellArea._offset = ((coarseSubcellPosition - finePosition + epsilon) / fineSubcellSize).convertScalar<int>();
tarch::la::Vector<DIMENSIONS, double> offsetTemp = (coarseSubcellPosition - finePosition + epsilon);
for (int d=0; d < DIMENSIONS; d++) {
offsetTemp[d] /= fineSubcellSize[d];
}
cellArea._offset = offsetTemp.convertScalar<int>();
//cellArea._size = ((coarseSubcellPosition + coarseSubcellSize - finePosition - epsilon) / fineSubcellSize - cellArea._offset.convertScalar<double>() + 1.0).convertScalar<int>();
tarch::la::Vector<DIMENSIONS, double> sizeTemp = coarseSubcellPosition + coarseSubcellSize - finePosition - epsilon;
for (int d=0; d < DIMENSIONS; d++) {
sizeTemp[d] /= fineSubcellSize[d];
}
sizeTemp -= offsetTemp;
sizeTemp += 1.0;
cellArea._size = sizeTemp.convertScalar<int>();
tarch::la::Vector<DIMENSIONS, int> cellAreaUpperBound = cellArea._offset + cellArea._size;
tarch::la::Vector<DIMENSIONS, int> areaUpperBound = _offset + _size;
for(int d = 0; d < DIMENSIONS; d++) {
cellArea._offset(d) = std::max(cellArea._offset(d), _offset(d));
cellArea._size(d) = std::min(cellAreaUpperBound(d), areaUpperBound(d));
}
cellArea._size -= cellArea._offset;
return cellArea;
}