[Mod] clean FemMesh.cpp

Removed dead code
This commit is contained in:
mosfet80
2024-09-13 14:58:25 +02:00
committed by Yorik van Havre
parent 27115e98e4
commit a5f6846e7f

View File

@@ -139,9 +139,6 @@ void FemMesh::copyMeshData(const FemMesh& mesh)
{
_Mtrx = mesh._Mtrx;
// See file SMESH_I/SMESH_Gen_i.cxx in the git repo of smesh at
// https://git.salome-platform.org
#if 1
// 1. Get source mesh
SMESHDS_Mesh* srcMeshDS = mesh.myMesh->GetMeshDS();
@@ -263,247 +260,6 @@ void FemMesh::copyMeshData(const FemMesh& mesh)
}
newMeshDS->Modified();
#else
SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS();
// Some further information is still not copied:
// https://forum.freecad.org/viewtopic.php?f=18&t=18982#p148114
SMDS_NodeIteratorPtr aNodeIter = mesh.myMesh->GetMeshDS()->nodesIterator();
for (; aNodeIter->more();) {
const SMDS_MeshNode* aNode = aNodeIter->next();
double temp[3];
aNode->GetXYZ(temp);
meshds->AddNodeWithID(temp[0], temp[1], temp[2], aNode->GetID());
}
SMDS_EdgeIteratorPtr aEdgeIter = mesh.myMesh->GetMeshDS()->edgesIterator();
for (; aEdgeIter->more();) {
const SMDS_MeshEdge* aEdge = aEdgeIter->next();
meshds->AddEdgeWithID(aEdge->GetNode(0), aEdge->GetNode(1), aEdge->GetID());
}
SMDS_FaceIteratorPtr aFaceIter = mesh.myMesh->GetMeshDS()->facesIterator();
for (; aFaceIter->more();) {
const SMDS_MeshFace* aFace = aFaceIter->next();
switch (aFace->NbNodes()) {
case 3:
meshds->AddFaceWithID(aFace->GetNode(0),
aFace->GetNode(1),
aFace->GetNode(2),
aFace->GetID());
break;
case 4:
meshds->AddFaceWithID(aFace->GetNode(0),
aFace->GetNode(1),
aFace->GetNode(2),
aFace->GetNode(3),
aFace->GetID());
break;
case 6:
meshds->AddFaceWithID(aFace->GetNode(0),
aFace->GetNode(1),
aFace->GetNode(2),
aFace->GetNode(3),
aFace->GetNode(4),
aFace->GetNode(5),
aFace->GetID());
break;
case 8:
meshds->AddFaceWithID(aFace->GetNode(0),
aFace->GetNode(1),
aFace->GetNode(2),
aFace->GetNode(3),
aFace->GetNode(4),
aFace->GetNode(5),
aFace->GetNode(6),
aFace->GetNode(7),
aFace->GetID());
break;
default: {
std::vector<const SMDS_MeshNode*> aNodes;
for (int i = 0; aFace->NbNodes(); i++) {
aNodes.push_back(aFace->GetNode(0));
}
meshds->AddPolygonalFaceWithID(aNodes, aFace->GetID());
} break;
}
}
SMDS_VolumeIteratorPtr aVolIter = mesh.myMesh->GetMeshDS()->volumesIterator();
for (; aVolIter->more();) {
const SMDS_MeshVolume* aVol = aVolIter->next();
switch (aVol->NbNodes()) {
case 4:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetID());
break;
case 5:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetNode(4),
aVol->GetID());
break;
case 6:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetNode(4),
aVol->GetNode(5),
aVol->GetID());
break;
case 8:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetNode(4),
aVol->GetNode(5),
aVol->GetNode(6),
aVol->GetNode(7),
aVol->GetID());
break;
case 10:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetNode(4),
aVol->GetNode(5),
aVol->GetNode(6),
aVol->GetNode(7),
aVol->GetNode(8),
aVol->GetNode(9),
aVol->GetID());
break;
case 13:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetNode(4),
aVol->GetNode(5),
aVol->GetNode(6),
aVol->GetNode(7),
aVol->GetNode(8),
aVol->GetNode(9),
aVol->GetNode(10),
aVol->GetNode(11),
aVol->GetNode(12),
aVol->GetID());
break;
case 15:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetNode(4),
aVol->GetNode(5),
aVol->GetNode(6),
aVol->GetNode(7),
aVol->GetNode(8),
aVol->GetNode(9),
aVol->GetNode(10),
aVol->GetNode(11),
aVol->GetNode(12),
aVol->GetNode(13),
aVol->GetNode(14),
aVol->GetID());
break;
case 20:
meshds->AddVolumeWithID(aVol->GetNode(0),
aVol->GetNode(1),
aVol->GetNode(2),
aVol->GetNode(3),
aVol->GetNode(4),
aVol->GetNode(5),
aVol->GetNode(6),
aVol->GetNode(7),
aVol->GetNode(8),
aVol->GetNode(9),
aVol->GetNode(10),
aVol->GetNode(11),
aVol->GetNode(12),
aVol->GetNode(13),
aVol->GetNode(14),
aVol->GetNode(15),
aVol->GetNode(16),
aVol->GetNode(17),
aVol->GetNode(18),
aVol->GetNode(19),
aVol->GetID());
break;
default: {
if (aVol->IsPoly()) {
const SMDS_PolyhedralVolumeOfNodes* aPolyVol =
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>(aVol);
if (!aPolyVol) {
break;
}
std::vector<const SMDS_MeshNode*> aNodes;
for (int i = 0; i < aPolyVol->NbNodes(); i++) {
aNodes.push_back(aPolyVol->GetNode(i));
}
meshds->AddPolyhedralVolumeWithID(aNodes,
aPolyVol->GetQuanities(),
aPolyVol->GetID());
}
} break;
}
}
// Copy groups
std::list<int> grpIds = mesh.myMesh->GetGroupIds();
for (auto it : grpIds) {
// group of source mesh
SMESH_Group* sourceGroup = mesh.myMesh->GetGroup(it);
SMESHDS_GroupBase* sourceGroupDS = sourceGroup->GetGroupDS();
int aId;
if (sourceGroupDS->GetType() == SMDSAbs_Node) {
SMESH_Group* targetGroup =
this->myMesh->AddGroup(SMDSAbs_Node, sourceGroupDS->GetStoreName(), aId);
if (targetGroup) {
SMESHDS_Group* targetGroupDS =
dynamic_cast<SMESHDS_Group*>(targetGroup->GetGroupDS());
if (targetGroupDS) {
SMDS_ElemIteratorPtr aIter = sourceGroupDS->GetElements();
while (aIter->more()) {
const SMDS_MeshElement* aElem = aIter->next();
const SMDS_MeshNode* aNode = meshds->FindNode(aElem->GetID());
if (aNode) {
targetGroupDS->SMDSGroup().Add(aNode);
}
}
}
}
}
else {
SMESH_Group* targetGroup = this->myMesh->AddGroup(sourceGroupDS->GetType(),
sourceGroupDS->GetStoreName(),
aId);
if (targetGroup) {
SMESHDS_Group* targetGroupDS =
dynamic_cast<SMESHDS_Group*>(targetGroup->GetGroupDS());
if (targetGroupDS) {
SMDS_ElemIteratorPtr aIter = sourceGroupDS->GetElements();
while (aIter->more()) {
const SMDS_MeshElement* aElem = aIter->next();
const SMDS_MeshElement* aElement = meshds->FindElement(aElem->GetID());
if (aElement) {
targetGroupDS->SMDSGroup().Add(aElement);
}
}
}
}
}
}
#endif
}
const SMESH_Mesh* FemMesh::getSMesh() const