]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx
Salome HOME
Control names of homogen groups
[modules/smesh.git] / src / DriverUNV / DriverUNV_R_SMDS_Mesh.cxx
index e635874ffd5439446b6b2819e980b7ff2a3bb536..9037ddf066a89467c1ddbe837637f6e59527bb42 100644 (file)
@@ -74,14 +74,13 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
        const TElementLab& aLabel = anIter->first;
        const TRecord& aRec = anIter->second;
        if(IsBeam(aRec.fe_descriptor_id)) {
-          if(aRec.fe_descriptor_id == 11) {
-            // edge with two nodes
+          switch ( aRec.node_labels.size() ) {
+          case 2: // edge with two nodes
             anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
                                               aRec.node_labels[1],
                                               aLabel);
-          }
-          else {
-            // quadratic edge (with 3 nodes)
+            break;
+          case 3: // quadratic edge (with 3 nodes)
             anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
                                               aRec.node_labels[2],
                                               aRec.node_labels[1],
@@ -278,10 +277,12 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
          //myGroupId.insert(TGroupIdMap::value_type(aNewGroup, aLabel));
 
          int aNodesNb = aRec.NodeList.size();
+         int aElementsNb = aRec.ElementList.size();
+         bool useSuffix = ((aNodesNb > 0) && (aElementsNb > 0));
          int i;
          if (aNodesNb > 0) {
            SMDS_MeshGroup* aNodesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Node);
-           std::string aGrName = aRec.GroupName + "_Nodes";
+           std::string aGrName = (useSuffix) ? aRec.GroupName + "_Nodes" : aRec.GroupName;
            myGroupNames.insert(TGroupNamesMap::value_type(aNodesGroup, aGrName));
            myGroupId.insert(TGroupIdMap::value_type(aNodesGroup, aLabel));
 
@@ -291,7 +292,6 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
                aNodesGroup->Add(aNode);
            }
          }
-         int aElementsNb = aRec.ElementList.size();
          if (aElementsNb > 0){
            SMDS_MeshGroup* aEdgesGroup = 0;
            SMDS_MeshGroup* aFacesGroup = 0;
@@ -303,7 +303,7 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
                case SMDSAbs_Edge:
                  if (!aEdgesGroup) {
                    aEdgesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Edge);
-                   std::string aEdgesGrName = aRec.GroupName + "_Edges";
+                   std::string aEdgesGrName = (useSuffix) ? aRec.GroupName + "_Edges" : aRec.GroupName;
                    myGroupNames.insert(TGroupNamesMap::value_type(aEdgesGroup, aEdgesGrName));
                    myGroupId.insert(TGroupIdMap::value_type(aEdgesGroup, aLabel));
                  }
@@ -312,7 +312,7 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
                case SMDSAbs_Face:
                  if (!aFacesGroup) {
                    aFacesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Face);
-                   std::string aFacesGrName = aRec.GroupName + "_Faces";
+                   std::string aFacesGrName = (useSuffix) ? aRec.GroupName + "_Faces" : aRec.GroupName;
                    myGroupNames.insert(TGroupNamesMap::value_type(aFacesGroup, aFacesGrName));
                    myGroupId.insert(TGroupIdMap::value_type(aFacesGroup, aLabel));
                  }