本文整理匯總了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");
}