本文整理汇总了C++中Box2D::multiply方法的典型用法代码示例。如果您正苦于以下问题:C++ Box2D::multiply方法的具体用法?C++ Box2D::multiply怎么用?C++ Box2D::multiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2D
的用法示例。
在下文中一共展示了Box2D::multiply方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fineDomain
void MultiGridManagement2D::coarsen(plint fineLevel, Box2D coarseDomain){
// The coarsest multi-block, at level 0, cannot be further coarsened.
PLB_PRECONDITION( fineLevel>=1 && fineLevel<(plint)bulks.size() );
plint coarseLevel = fineLevel-1;
// First, trim the domain coarseDomain in case it exceeds the extent of the
// multi-block, and determine whether coarseDomain touches one of the boundaries
// of the multi-block. This information is needed, because the coarse domain
// fully replaces the fine domain on boundaries of the multi-block, and there
// is therefore no need to create a coarse-fine coupling.
bool touchLeft=false, touchRight=false, touchBottom=false, touchTop=false;
trimDomain(coarseLevel, coarseDomain, touchLeft, touchRight, touchBottom, touchTop);
// Convert the coarse domain to fine units.
Box2D fineDomain(coarseDomain.multiply(2));
// The reduced fine domain is the one which is going to be excluded from
// the original fine lattice.
Box2D intermediateFineDomain(fineDomain.enlarge(-1));
// The extended coarse domain it the one which is going to be added
// to the original coarse lattice.
Box2D extendedCoarseDomain(coarseDomain.enlarge(1));
// If the domain in question touches a boundary of the multi-block,
// both the reduced fine domain and the extended coarse domain are
// identified with the boundary location.
if (touchLeft) {
intermediateFineDomain.x0 -= 1;
extendedCoarseDomain.x0 += 1;
}
if (touchRight) {
intermediateFineDomain.x1 += 1;
extendedCoarseDomain.x1 -= 1;
}
if (touchBottom) {
intermediateFineDomain.y0 -= 1;
extendedCoarseDomain.y0 += 1;
}
if (touchTop) {
intermediateFineDomain.y1 += 1;
extendedCoarseDomain.y1 -= 1;
}
// Extract reduced fine domain from the original fine multi-block.
std::vector<Box2D> exceptedBlocks;
for (pluint iBlock=0; iBlock<bulks[fineLevel].size(); ++iBlock) {
except(bulks[fineLevel][iBlock], intermediateFineDomain, exceptedBlocks);
}
exceptedBlocks.swap(bulks[fineLevel]);
// Add extended coarse domain to the original coarse multi-block.
bulks[coarseLevel].push_back(extendedCoarseDomain);
// Define coupling interfaces for all four sides of the refined domain, unless they
// touch a boundary of the multi-block.
if (!touchLeft) {
coarseGridInterfaces[coarseLevel].push_back( Box2D( extendedCoarseDomain.x0, extendedCoarseDomain.x0,
extendedCoarseDomain.y0, extendedCoarseDomain.y1 ) );
fineGridInterfaces[fineLevel].push_back( Box2D( coarseDomain.x0, coarseDomain.x0,
coarseDomain.y0, coarseDomain.y1 ) );
// it is a left border in the coarse case
coarseInterfaceOrientations[coarseLevel].push_back(Array<plint,2>(0,-1));
// it is an right border in the fine case
fineInterfaceOrientations[fineLevel].push_back(Array<plint,2>(0,1));
}
if (!touchRight) {
coarseGridInterfaces[coarseLevel].push_back( Box2D( extendedCoarseDomain.x1, extendedCoarseDomain.x1,
extendedCoarseDomain.y0, extendedCoarseDomain.y1 ) );
fineGridInterfaces[fineLevel].push_back( Box2D( coarseDomain.x1, coarseDomain.x1,
coarseDomain.y0, coarseDomain.y1 ) );
// it is a right border in the coarse case
coarseInterfaceOrientations[coarseLevel].push_back(Array<plint,2>(0,1));
// it is a left border in the fine case
fineInterfaceOrientations[fineLevel].push_back(Array<plint,2>(0,-1));
}
if (!touchBottom) {
coarseGridInterfaces[coarseLevel].push_back( Box2D( extendedCoarseDomain.x0, extendedCoarseDomain.x1,
extendedCoarseDomain.y0, extendedCoarseDomain.y0 ) );
fineGridInterfaces[fineLevel].push_back( Box2D( coarseDomain.x0, coarseDomain.x1,
coarseDomain.y0, coarseDomain.y0 ) );
// it is a bottom border in the coarse case
coarseInterfaceOrientations[coarseLevel].push_back(Array<plint,2>(1,-1)); //TODO check this!!!
// it is a top border in the fine case
fineInterfaceOrientations[fineLevel].push_back(Array<plint,2>(1,1));
}
if (!touchTop) {
coarseGridInterfaces[coarseLevel].push_back( Box2D( extendedCoarseDomain.x0, extendedCoarseDomain.x1,
extendedCoarseDomain.y1, extendedCoarseDomain.y1 ) );
fineGridInterfaces[fineLevel].push_back( Box2D( coarseDomain.x0, coarseDomain.x1,
coarseDomain.y1, coarseDomain.y1 ) );
// it is a top border in the coarse case
coarseInterfaceOrientations[coarseLevel].push_back(Array<plint,2>(1,1));
// it is an bottom border in the fine case
fineInterfaceOrientations[fineLevel].push_back(Array<plint,2>(1,-1));
}
}