From 0460bb60e03d87ed5c65071477c79cc7d2884db3 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 15 Jul 2015 17:05:14 +0300 Subject: [PATCH] Fix regressions caused by improvements --- idl/SMESH_Mesh.idl | 5 ++++- src/SMESH/SMESH_MeshEditor.cxx | 13 ++++++------- src/SMESH_I/SMESH_MeshEditor_i.cxx | 4 ++-- src/SMESH_I/SMESH_Mesh_i.cxx | 11 ++++++++++- src/SMESH_I/SMESH_Mesh_i.hxx | 5 ++++- src/SMESH_SWIG/smeshBuilder.py | 6 +++++- src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx | 11 +++++++---- 7 files changed, 38 insertions(+), 17 deletions(-) diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index 0805ce235..fc8a2c6a5 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -776,7 +776,10 @@ module SMESH long NbBiQuadQuadrangles() raises (SALOME::SALOME_Exception); - long NbPolygons(in ElementOrder order) + long NbPolygons() + raises (SALOME::SALOME_Exception); + + long NbPolygonsOfOrder(in ElementOrder order) raises (SALOME::SALOME_Exception); long NbVolumes() diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 8ca7653e0..3094dd2f3 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -5356,8 +5356,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes, SMDS_MeshCell::interlacedSmdsOrder( elem->GetEntityType(), nbn ); SMDS_MeshCell::applyInterlaceRev( interlace, nodeVec ); - if ( const SMDS_MeshElement* face = AddElement( nodeVec, anyFace.Init( elem ))) - myLastCreatedElems.Append( face ); + AddElement( nodeVec, anyFace.Init( elem )); while ( srcElements.Length() < myLastCreatedElems.Length() ) srcElements.Append( elem ); @@ -12531,7 +12530,7 @@ int SMESH_MeshEditor::MakeBoundaryMesh(const TIDSortedElemSet& elements, typedef vector TConnectivity; TConnectivity tgtNodes; - ElemFeatures elemKind( missType ); + ElemFeatures elemKind( missType ), elemToCopy; SMDS_ElemIteratorPtr eIt; if (elements.empty()) eIt = aMesh->elementsIterator(elemType); @@ -12566,9 +12565,9 @@ int SMESH_MeshEditor::MakeBoundaryMesh(const TIDSortedElemSet& elements, for ( int i = 0; i < nbFaceNodes; i += 1+iQuad) { for ( int j = 0; j < nodes.size(); ++j ) - nodes[j] =nn[i+j]; + nodes[j] = nn[ i+j ]; if ( const SMDS_MeshElement* edge = - aMesh->FindElement(nodes,SMDSAbs_Edge,/*noMedium=*/false)) + aMesh->FindElement( nodes, SMDSAbs_Edge, /*noMedium=*/false )) presentBndElems.push_back( edge ); else missingBndElems.push_back( nodes ); @@ -12703,7 +12702,7 @@ int SMESH_MeshEditor::MakeBoundaryMesh(const TIDSortedElemSet& elements, tgtNodes.resize( e->NbNodes() ); for ( inode = 0; inode < nodes.size(); ++inode ) tgtNodes[inode] = getNodeWithSameID( tgtMeshDS, e->GetNode(inode) ); - presentEditor->AddElement( tgtNodes, elemKind.Init( e )); + presentEditor->AddElement( tgtNodes, elemToCopy.Init( e )); } else // store present elements to add them to a group for ( int i = 0 ; i < presentBndElems.size(); ++i ) @@ -12738,7 +12737,7 @@ int SMESH_MeshEditor::MakeBoundaryMesh(const TIDSortedElemSet& elements, tgtNodes.resize( elem->NbNodes() ); for ( inode = 0; inode < tgtNodes.size(); ++inode ) tgtNodes[inode] = getNodeWithSameID( tgtMeshDS, elem->GetNode(inode) ); - tgtEditor.AddElement( tgtNodes, elemKind.Init( elem )); + tgtEditor.AddElement( tgtNodes, elemToCopy.Init( elem )); tgtEditor.myLastCreatedElems.Clear(); } diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 1c6f60200..a3fe510c7 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -6441,9 +6441,9 @@ CORBA::Long SMESH_MeshEditor_i::MakeBoundaryElements(SMESH::Bnd_Dimension dim, THROW_SALOME_CORBA_EXCEPTION("Invalid boundary dimension", SALOME::BAD_PARAM); // separate groups belonging to this and other mesh - SMESH::ListOfIDSources_var groupsOfThisMesh = new SMESH::ListOfIDSources; + SMESH::ListOfIDSources_var groupsOfThisMesh = new SMESH::ListOfIDSources; SMESH::ListOfIDSources_var groupsOfOtherMesh = new SMESH::ListOfIDSources; - groupsOfThisMesh->length( groups.length() ); + groupsOfThisMesh ->length( groups.length() ); groupsOfOtherMesh->length( groups.length() ); int nbGroups = 0, nbGroupsOfOtherMesh = 0; for ( int i = 0; i < groups.length(); ++i ) diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 060329f4c..fed66cd85 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -3765,7 +3765,16 @@ CORBA::Long SMESH_Mesh_i::NbBiQuadQuadrangles()throw(SALOME::SALOME_Exception) return _impl->NbBiQuadQuadrangles(); } -CORBA::Long SMESH_Mesh_i::NbPolygons(SMESH::ElementOrder order) throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPolygons() throw(SALOME::SALOME_Exception) +{ + Unexpect aCatch(SALOME_SalomeException); + if ( _preMeshInfo ) + return _preMeshInfo->NbPolygons(); + + return _impl->NbPolygons(); +} + +CORBA::Long SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 24874a03a..2a67fd8a7 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -315,7 +315,10 @@ public: CORBA::Long NbBiQuadQuadrangles() throw (SALOME::SALOME_Exception); - CORBA::Long NbPolygons(SMESH::ElementOrder order=SMESH::ORDER_ANY) + CORBA::Long NbPolygons() + throw (SALOME::SALOME_Exception); + + CORBA::Long NbPolygonsOfOrder(SMESH::ElementOrder order=SMESH::ORDER_ANY) throw (SALOME::SALOME_Exception); CORBA::Long NbVolumes() diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 63fb499c7..78495e6cc 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -2359,7 +2359,7 @@ class Mesh: # @return an integer value # @ingroup l1_meshinfo def NbPolygons(self, elementOrder = SMESH.ORDER_ANY): - return self.mesh.NbPolygons(elementOrder) + return self.mesh.NbPolygonsOfOrder(elementOrder) ## Returns the number of volumes in the mesh # @return an integer value @@ -4940,6 +4940,10 @@ class meshEditor(SMESH._objref_SMESH_MeshEditor): if len( args ) == 1: return SMESH._objref_SMESH_MeshEditor.FindCoincidentNodes( self, args[0], False ) return SMESH._objref_SMESH_MeshEditor.FindCoincidentNodes( self, *args ) + def FindCoincidentNodesOnPart(self,*args): # a 3d arg added (SeparateCornerAndMediumNodes) + if len( args ) == 2: + args += False, + return SMESH._objref_SMESH_MeshEditor.FindCoincidentNodesOnPart( self, *args ) def MergeNodes(self,*args): # a 2nd arg added (NodesToKeep) if len( args ) == 1: return SMESH._objref_SMESH_MeshEditor.MergeNodes( self, args[0], [] ) diff --git a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx index 4c5269eb6..f3b76232c 100644 --- a/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx @@ -369,7 +369,7 @@ namespace */ //================================================================================ - void getInternalEdges( SMESH_Mesh& mesh, + bool getInternalEdges( SMESH_Mesh& mesh, const TopoDS_Shape& shape, const TopTools_MapOfShape& cornerVV, TopTools_MapOfShape& internEE) @@ -436,11 +436,13 @@ namespace ridgeE = TopoDS::Edge( nextRidgeE ); V0 = V1; + if ( ridgeE.IsNull() ) + return false; } // check EDGEs around the last VERTEX of ridgeE } // loop on ridge EDGEs around a corner VERTEX } // loop on on corner VERTEXes - return; + return true; } // getInternalEdges() } // namespace @@ -463,9 +465,10 @@ bool StdMeshers_CompositeHexa_3D::findBoxFaces( const TopoDS_Shape& shape, TopTools_MapOfShape cornerVertices; getBlockCorners( mesh, shape, cornerVertices ); if ( cornerVertices.Extent() != 8 ) - return false; + return error( COMPERR_BAD_INPUT_MESH, "Can't find 8 corners of a block" ); TopTools_MapOfShape internalEdges; - getInternalEdges( mesh, shape, cornerVertices, internalEdges ); + if ( !getInternalEdges( mesh, shape, cornerVertices, internalEdges )) + return error( COMPERR_BAD_INPUT_MESH, "2D mesh is not suitable for i,j,k hexa meshing" ); list< _QuadFaceGrid >::iterator boxFace; TopExp_Explorer exp; -- 2.39.2