本文整理汇总了C++中MeshType::createEmptyMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshType::createEmptyMesh方法的具体用法?C++ MeshType::createEmptyMesh怎么用?C++ MeshType::createEmptyMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshType
的用法示例。
在下文中一共展示了MeshType::createEmptyMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAssignments
Array<Mesh> SerialPartitionerBase::makeMeshParts(const Mesh& mesh, int np,
Array<Sundance::Map<int, int> >& oldElemLIDToNewLIDMaps,
Array<Sundance::Map<int, int> >& oldVertLIDToNewLIDMaps) const
{
int dim = mesh.spatialDim();
Array<int> elemAssignments;
Array<int> nodeAssignments;
Array<int> nodeOwnerElems;
Array<int> nodesPerProc;
getAssignments(mesh, np, elemAssignments);
getNodeAssignments(np, elemAssignments, nodeAssignments, nodeOwnerElems,
nodesPerProc);
Array<Array<int> > offProcNodes(np);
Array<Array<int> > offProcElems(np);
Array<Set<int> > offProcNodeSet(np);
Array<Set<int> > offProcElemSet(np);
Array<Array<int> > procNodes(np);
Array<Array<int> > procElems(np);
for (int p=0; p<np; p++)
{
getOffProcData(p, elemAssignments, nodeAssignments,
offProcNodeSet[p], offProcElemSet[p]);
offProcNodes[p] = offProcNodeSet[p].elements();
offProcElems[p] = offProcElemSet[p].elements();
procElems[p].reserve(elemAssignments.size()/np);
procNodes[p].reserve(nodeAssignments.size()/np);
}
Array<int> remappedElems;
Array<int> remappedNodes;
remapEntities(elemAssignments, np, remappedElems);
remapEntities(nodeAssignments, np, remappedNodes);
for (int e=0; e<elemAssignments.size(); e++)
{
procElems[elemAssignments[e]].append(e);
}
for (int n=0; n<nodeAssignments.size(); n++)
{
procNodes[nodeAssignments[n]].append(n);
}
/* Now we make NP submeshes */
Array<Mesh> rtn(np);
oldVertLIDToNewLIDMaps.resize(np);
oldElemLIDToNewLIDMaps.resize(np);
for (int p=0; p<np; p++)
{
Sundance::Map<int, int>& oldVertLIDToNewLIDMap
= oldVertLIDToNewLIDMaps[p];
Sundance::Map<int, int>& oldElemLIDToNewLIDMap
= oldElemLIDToNewLIDMaps[p];
MeshType type = new BasicSimplicialMeshType();
rtn[p] = type.createEmptyMesh(mesh.spatialDim(), MPIComm::world());
Set<int> unusedVertGID;
/* add the on-processor nodes */
for (int n=0; n<procNodes[p].size(); n++)
{
int oldLID = procNodes[p][n];
int newGID = remappedNodes[oldLID];
unusedVertGID.put(newGID);
int newLID = rtn[p].addVertex(newGID, mesh.nodePosition(oldLID), p, 0);
oldVertLIDToNewLIDMap.put(oldLID, newLID);
}
/* add the off-processor nodes */
for (int n=0; n<offProcNodes[p].size(); n++)
{
int oldLID = offProcNodes[p][n];
int nodeOwnerProc = nodeAssignments[oldLID];
int newGID = remappedNodes[oldLID];
unusedVertGID.put(newGID);
int newLID = rtn[p].addVertex(newGID, mesh.nodePosition(oldLID), nodeOwnerProc, 0);
oldVertLIDToNewLIDMap.put(oldLID, newLID);
}
/* add the on-processor elements */
for (int e=0; e<procElems[p].size(); e++)
{
int oldLID = procElems[p][e];
int newGID = remappedElems[oldLID];
Array<int> vertGIDs;
Array<int> orientations;
mesh.getFacetArray(dim, oldLID, 0, vertGIDs, orientations);
for (int v=0; v<vertGIDs.size(); v++)
{
vertGIDs[v] = remappedNodes[vertGIDs[v]];
if (unusedVertGID.contains(vertGIDs[v])) unusedVertGID.erase(newGID);
}
//.........这里部分代码省略.........