Salome HOME
PR: double nodes and flat elements for ASTER calculations in progress
[modules/smesh.git] / src / SMESHDS / SMESHDS_Mesh.cxx
index 57274da28b252131526dd9acaa354599d1304b2c..7d2986ffefbd513e7c02a9c33782d3616e84dcf2 100644 (file)
@@ -714,35 +714,23 @@ static void removeFromContainers (map<int,SMESHDS_SubMesh*>&     theSubMeshes,
 
   // Rm from sub-meshes
   // Element should belong to only one sub-mesh
-  map<int,SMESHDS_SubMesh*>::iterator SubIt = theSubMeshes.begin();
-  for ( ; SubIt != theSubMeshes.end(); SubIt++ )
+  if ( !theSubMeshes.empty() )
   {
-    int size = isNode ? (*SubIt).second->NbNodes() : (*SubIt).second->NbElements();
-    if ( size == 0 ) continue;
-
+    SMESHDS_Mesh* mesh = theSubMeshes.begin()->second->getParent();
     list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
-    while ( elIt != theElems.end() )
-    {
-      bool removed = false;
-      if ( isNode )
-        removed = (*SubIt).second->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted );
-      else
-        removed = (*SubIt).second->RemoveElement( *elIt, deleted );
-
-      if (removed)
-      {
-        elIt = theElems.erase( elIt );
-        if ( theElems.empty() )
-          return; // all elements are found and removed
-      }
-      else
-      {
-        elIt++ ;
-      }
+    if ( isNode ) {
+      for ( ; elIt != theElems.end(); ++elIt )
+        if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
+          sm->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt), deleted );
+    }
+    else {
+      for ( ; elIt != theElems.end(); ++elIt )
+        if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() ))
+          sm->RemoveElement( *elIt, deleted );
     }
   }
 }
-  
+
 //=======================================================================
 //function : RemoveNode
 //purpose  : 
@@ -1987,27 +1975,3 @@ bool SMESHDS_Mesh::ModifyCellNodes(int vtkVolId, std::map<int,int> localClonedNo
   myGrid->ModifyCellNodes(vtkVolId, localClonedNodeIds);
   return true;
 }
-
-/*! Create a volume (prism or hexahedron) by duplication of a face.
- * the nodes of the new face are already created.
- * @param vtkVolId vtk id of a volume containing the face, to get an orientation for the face.
- * @param localClonedNodeIds map old node id to new node id. The old nodes define the face in the volume.
- * @return ok if success.
- */
-bool SMESHDS_Mesh::extrudeVolumeFromFace(int vtkVolId, std::map<int,int>& localClonedNodeIds)
-{
-  //MESSAGE("extrudeVolumeFromFace " << vtkVolId);
-  vector<vtkIdType> orderedNodes;
-  orderedNodes.clear();
-  map<int, int>::const_iterator it = localClonedNodeIds.begin();
-  for (; it != localClonedNodeIds.end(); ++it)
-    orderedNodes.push_back(it->first);
-
-  int nbNodes = myGrid->getOrderedNodesOfFace(vtkVolId, orderedNodes);
-  for (int i=0; i<nbNodes; i++)
-    orderedNodes.push_back(localClonedNodeIds[orderedNodes[i]]);
-  SMDS_MeshVolume *vol = this->AddVolumeFromVtkIds(orderedNodes);
-
-  // TODO update subshape list of elements and nodes
-  return vol;
-}