X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_Mesh.cxx;h=7d2986ffefbd513e7c02a9c33782d3616e84dcf2;hb=bdfc51bda9296408c0908cf01a6acc23c539dadb;hp=2b6fde92fd2235a4cbd726170b8d5f4495e6cf76;hpb=2e16ca1281e91b049388105e138619bfdb5d571f;p=modules%2Fsmesh.git diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 2b6fde92f..7d2986ffe 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -216,7 +216,7 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem, const SMDS_MeshNode * nodes[], const int nbnodes) { - MESSAGE("SMESHDS_Mesh::ChangeElementNodes"); + //MESSAGE("SMESHDS_Mesh::ChangeElementNodes"); if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes )) return false; @@ -714,35 +714,23 @@ static void removeFromContainers (map& theSubMeshes, // Rm from sub-meshes // Element should belong to only one sub-mesh - map::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::iterator elIt = theElems.begin(); - while ( elIt != theElems.end() ) - { - bool removed = false; - if ( isNode ) - removed = (*SubIt).second->RemoveNode( static_cast (*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 (*elIt), deleted ); + } + else { + for ( ; elIt != theElems.end(); ++elIt ) + if ( SMESHDS_SubMesh* sm = mesh->MeshElements( (*elIt)->getshapeId() )) + sm->RemoveElement( *elIt, deleted ); } } } - + //======================================================================= //function : RemoveNode //purpose : @@ -1117,7 +1105,7 @@ SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) const /////////////////////////////////////////////////////////////////////////////// /// Return the sub mesh by Id of shape it is linked to /////////////////////////////////////////////////////////////////////////////// -SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index) +SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index) const { TShapeIndexToSubMesh::const_iterator anIter = myShapeIndexToSubMesh.find(Index); if (anIter != myShapeIndexToSubMesh.end()) @@ -1130,10 +1118,10 @@ SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index) //function : SubMeshIndices //purpose : //======================================================================= -list SMESHDS_Mesh::SubMeshIndices() +list SMESHDS_Mesh::SubMeshIndices() const { list anIndices; - std::map::iterator anIter = myShapeIndexToSubMesh.begin(); + std::map::const_iterator anIter = myShapeIndexToSubMesh.begin(); for (; anIter != myShapeIndexToSubMesh.end(); anIter++) { anIndices.push_back((*anIter).first); } @@ -1177,7 +1165,7 @@ void SMESHDS_Mesh::ClearScript() //function : HasMeshElements //purpose : //======================================================================= -bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) +bool SMESHDS_Mesh::HasMeshElements(const TopoDS_Shape & S) const { if (myShape.IsNull()) MESSAGE("myShape is NULL"); int Index = myIndexToShape.FindIndex(S); @@ -1987,27 +1975,3 @@ bool SMESHDS_Mesh::ModifyCellNodes(int vtkVolId, std::map 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& localClonedNodeIds) -{ - //MESSAGE("extrudeVolumeFromFace " << vtkVolId); - vector orderedNodes; - orderedNodes.clear(); - map::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; iAddVolumeFromVtkIds(orderedNodes); - - // TODO update subshape list of elements and nodes - return vol; -}