本文整理汇总了C++中Box2D::nCells方法的典型用法代码示例。如果您正苦于以下问题:C++ Box2D::nCells方法的具体用法?C++ Box2D::nCells怎么用?C++ Box2D::nCells使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2D
的用法示例。
在下文中一共展示了Box2D::nCells方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveFull
void saveFull( MultiBlock2D& multiBlock, FileName fName, IndexOrdering::OrderingT ordering )
{
global::profiler().start("io");
SparseBlockStructure2D blockStructure(multiBlock.getBoundingBox());
Box2D bbox = multiBlock.getBoundingBox();
if (ordering==IndexOrdering::forward) {
plint nBlocks = std::min(bbox.getNx(), (plint)global::mpi().getSize());
std::vector<std::pair<plint,plint> > ranges;
util::linearRepartition(bbox.x0, bbox.x1, nBlocks, ranges);
for (pluint iRange=0; iRange<ranges.size(); ++iRange) {
blockStructure.addBlock (
Box2D( ranges[iRange].first, ranges[iRange].second,
bbox.y0, bbox.y1 ),
iRange );
}
}
else if (ordering==IndexOrdering::backward) {
plint nBlocks = std::min(bbox.getNy(), (plint)global::mpi().getSize());
std::vector<std::pair<plint,plint> > ranges;
util::linearRepartition(bbox.y0, bbox.y1, nBlocks, ranges);
for (pluint iRange=0; iRange<ranges.size(); ++iRange) {
blockStructure.addBlock (
Box2D( bbox.x0, bbox.x1, ranges[iRange].first, ranges[iRange].second ),
iRange );
}
}
else {
// Sparse ordering not defined.
PLB_ASSERT( false );
}
plint envelopeWidth=1;
MultiBlockManagement2D adjacentMultiBlockManagement (
blockStructure, new OneToOneThreadAttribution, envelopeWidth );
MultiBlock2D* multiAdjacentBlock = multiBlock.clone(adjacentMultiBlockManagement);
std::vector<plint> offset;
std::vector<plint> myBlockIds;
std::vector<std::vector<char> > data;
bool dynamicContent = false;
dumpData(*multiAdjacentBlock, dynamicContent, offset, myBlockIds, data);
if (ordering==IndexOrdering::backward && myBlockIds.size()==1) {
PLB_ASSERT( data.size()==1 );
Box2D domain;
blockStructure.getBulk(myBlockIds[0], domain);
plint sizeOfCell = multiAdjacentBlock->sizeOfCell();
PLB_ASSERT( domain.nCells()*sizeOfCell == (plint)data[0].size() );
transposeToBackward( sizeOfCell, domain, data[0] );
}
plint totalSize = offset[offset.size()-1];
writeOneBlockXmlSpec(*multiAdjacentBlock, fName, totalSize, ordering);
writeRawData(fName, myBlockIds, offset, data);
delete multiAdjacentBlock;
global::profiler().stop("io");
}