本文整理汇总了C++中MeshPtr::cellIDsInPartition方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::cellIDsInPartition方法的具体用法?C++ MeshPtr::cellIDsInPartition怎么用?C++ MeshPtr::cellIDsInPartition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::cellIDsInPartition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkConstraintConsistency
bool MeshTestUtility::checkConstraintConsistency(MeshPtr meshMinimumRule)
{
MeshTopologyViewPtr meshTopo = meshMinimumRule->getTopology();
GDAMinimumRule* minRule = dynamic_cast<GDAMinimumRule*>(meshMinimumRule->globalDofAssignment().get());
bool consistent = true;
for (IndexType cellID : meshMinimumRule->cellIDsInPartition())
{
CellConstraints constraints = minRule->getCellConstraints(cellID);
CellPtr cell = meshTopo->getCell(cellID);
CellTopoPtr cellTopo = cell->topology();
for (int d=0; d<cellTopo->getDimension(); d++)
{
int scCount = cellTopo->getSubcellCount(d);
for (int scord=0; scord<scCount; scord++)
{
IndexType entityIndex = cell->entityIndex(d, scord);
AnnotatedEntity constrainingEntity = constraints.subcellConstraints[d][scord];
bool isConsistent = constraintIsConsistent(meshTopo, constrainingEntity, d, entityIndex, true);
if (!isConsistent)
{
cout << "Failed consistency test for standard constraints on cell " << cellID << ", " << CamelliaCellTools::entityTypeString(d) << " " << scord << endl;
consistent = false;
break;
}
// now, check space-only constraints (for space-time meshes), if these are defined for this subcell
if (constraints.spatialSliceConstraints != Teuchos::null)
{
AnnotatedEntity constrainingEntityForSpatialSlice = constraints.spatialSliceConstraints->subcellConstraints[d][scord];
if (constrainingEntityForSpatialSlice.cellID != -1) {
isConsistent = constraintIsConsistent(meshTopo, constrainingEntityForSpatialSlice, d, entityIndex, true);
}
if (!isConsistent)
{
cout << "Failed consistency test for spatial slice on cell " << cellID << ", " << CamelliaCellTools::entityTypeString(d) << " " << scord << endl;
consistent = false;
break;
}
}
}
if (!consistent) break;
}
if (!consistent) break;
}
return consistent;
}
示例2: inducedPartitionPolicyFromRefinedMesh
MeshPartitionPolicyPtr MeshPartitionPolicy::inducedPartitionPolicyFromRefinedMesh(MeshTopologyViewPtr inducedMeshTopo, MeshPtr inducingRefinedMesh)
{
// generate using the inducing mesh
vector<GlobalIndexTypeToCast> myEntries;
auto myCellIDs = &inducingRefinedMesh->cellIDsInPartition();
bool rotateChildOrdinalThatOwns = false; // the 6-27-16 modification -- I don't think this actually helps with load balance, the way things are presently implemented, and it may introduce additional communication costs
if (rotateChildOrdinalThatOwns)
{
/*
Modification 6-27-16: instead of assigning parent to owner of first child,
assign parent to owner of child with ordinal equal to the level of the
parent, modulo the number of children. This should result in better load
balancing for multigrid.
*/
for (GlobalIndexType myCellID : *myCellIDs)
{
IndexType ancestralCellIndex = myCellID;
bool hasMatchingChild = true;
while (inducingRefinedMesh->getTopology()->isValidCellIndex(ancestralCellIndex)
&& !inducedMeshTopo->isValidCellIndex(ancestralCellIndex))
{
CellPtr myCell = inducingRefinedMesh->getTopology()->getCell(ancestralCellIndex);
CellPtr parent = myCell->getParent();
TEUCHOS_TEST_FOR_EXCEPTION(parent == Teuchos::null, std::invalid_argument, "ancestor not found in inducedMeshTopo");
int childOrdinal = parent->findChildOrdinal(myCell->cellIndex());
int numChildren = parent->numChildren();
hasMatchingChild = ((parent->level() % numChildren) == childOrdinal);
ancestralCellIndex = parent->cellIndex();
}
if (hasMatchingChild)
{
myEntries.push_back(ancestralCellIndex);
myEntries.push_back(myCellID);
}
}
}
else
{
// first child is always owner
for (GlobalIndexType myCellID : *myCellIDs)
{
IndexType ancestralCellIndex = myCellID;
bool isFirstChild = true;
while (isFirstChild && !inducedMeshTopo->isValidCellIndex(ancestralCellIndex))
{
CellPtr myCell = inducingRefinedMesh->getTopology()->getCell(ancestralCellIndex);
CellPtr parent = myCell->getParent();
TEUCHOS_TEST_FOR_EXCEPTION(parent == Teuchos::null, std::invalid_argument, "ancestor not found in inducedMeshTopo");
int childOrdinal = parent->findChildOrdinal(myCell->cellIndex());
isFirstChild = (childOrdinal == 0);
ancestralCellIndex = parent->cellIndex();
}
if (isFirstChild)
{
myEntries.push_back(ancestralCellIndex);
myEntries.push_back(myCellID);
}
}
}
// all-gather the entries
vector<GlobalIndexTypeToCast> allEntries;
vector<int> offsets;
MPIWrapper::allGatherVariable(*inducingRefinedMesh->Comm(), allEntries, myEntries, offsets);
map<GlobalIndexType,GlobalIndexType> cellIDMap;
for (int i=0; i<allEntries.size()/2; i++)
{
GlobalIndexType ancestralCellIndex = allEntries[2*i+0];
GlobalIndexType inducingMeshCellID = allEntries[2*i+1];
cellIDMap[ancestralCellIndex] = inducingMeshCellID;
}
return Teuchos::rcp( new InducedMeshPartitionPolicy(inducingRefinedMesh, cellIDMap) );
}