]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
BUG: Mesh Failed dialog shows negative shape ID if nb shapes > SHORT_MAX
authoreap <eap@opencascade.com>
Thu, 5 Aug 2021 16:03:34 +0000 (19:03 +0300)
committereap <eap@opencascade.com>
Thu, 5 Aug 2021 16:03:34 +0000 (19:03 +0300)
+ minor changes:
1) fix 2 typos
2) improve SMESH_Delaunay::ToPython()

idl/SMESH_Gen.idl
src/SMESHUtils/SMESH_Delaunay.cxx
src/SMESHUtils/SMESH_TryCatch.hxx

index eeb8f0c7128e989c2f592c70c9f4cc84ee145745..d5772802b186847fded1423cb3b9fcc29cb1ec33 100644 (file)
@@ -114,7 +114,7 @@ module SMESH
     short   code;       // ComputeErrorName or, if negative, algo specific code
     string  comment;    // textual problem description
     string  algoName;
-    short   subShapeID; // id of sub-shape of a shape to mesh
+    long    subShapeID; // id of sub-shape of a shape to mesh
     boolean hasBadMesh; // there are elements preventing computation available for visualization
   };
   typedef sequence<ComputeError> compute_error_array;
index bc5576797f0ba94bb15c793d9bc249a7c8fa88dc..610d7d09bbc2efa388e1a5a1eec21fb758560d90 100644 (file)
@@ -273,7 +273,7 @@ const BRepMesh_Triangle* SMESH_Delaunay::GetTriangleNear( int iBndNode )
   if ( iBndNode >= _triaDS->NbNodes() )
     return 0;
   int nodeIDs[3];
-  int nbNbNodes = _bndNodes.size();
+  int nbBndNodes = _bndNodes.size();
 #if OCC_VERSION_LARGE <= 0x07030000
   typedef BRepMesh::ListOfInteger TLinkList;
 #else
@@ -289,9 +289,9 @@ const BRepMesh_Triangle* SMESH_Delaunay::GetTriangleNear( int iBndNode )
       if ( tria.Movability() != BRepMesh_Deleted )
       {
         _triaDS->ElementNodes( tria, nodeIDs );
-        if ( nodeIDs[0]-1 < nbNbNodes &&
-             nodeIDs[1]-1 < nbNbNodes &&
-             nodeIDs[2]-1 < nbNbNodes )
+        if ( nodeIDs[0]-1 < nbBndNodes &&
+             nodeIDs[1]-1 < nbBndNodes &&
+             nodeIDs[2]-1 < nbBndNodes )
           return &tria;
       }
     }
@@ -301,9 +301,9 @@ const BRepMesh_Triangle* SMESH_Delaunay::GetTriangleNear( int iBndNode )
       if ( tria.Movability() != BRepMesh_Deleted )
       {
         _triaDS->ElementNodes( tria, nodeIDs );
-        if ( nodeIDs[0]-1 < nbNbNodes &&
-             nodeIDs[1]-1 < nbNbNodes &&
-             nodeIDs[2]-1 < nbNbNodes )
+        if ( nodeIDs[0]-1 < nbBndNodes &&
+             nodeIDs[1]-1 < nbBndNodes &&
+             nodeIDs[2]-1 < nbBndNodes )
           return &tria;
       }
     }
@@ -373,14 +373,29 @@ void SMESH_Delaunay::ToPython() const
   }
 
   int nodeIDs[3];
+  const char* dofName[] = { "Free",
+                            "InVolume",
+                            "OnSurface",
+                            "OnCurve",
+                            "Fixed",
+                            "Frontier",
+                            "Deleted" };
+  text << "# nb elements = " << _triaDS->NbElements() << endl;
+  std::vector< int > deletedElems;
   for ( int i = 0; i < _triaDS->NbElements(); ++i )
   {
     const BRepMesh_Triangle& t = _triaDS->GetElement( i+1 );
     if ( t.Movability() == BRepMesh_Deleted )
-      continue;
+      deletedElems.push_back( i+1 );
+    //   continue;
     _triaDS->ElementNodes( t, nodeIDs );
-    text << "mesh.AddFace([ " << nodeIDs[0] << ", " << nodeIDs[1] << ", " << nodeIDs[2] << " ])" << endl;
+    text << "mesh.AddFace([ " << nodeIDs[0] << ", " << nodeIDs[1] << ", " << nodeIDs[2] << " ]) # "
+         <<  dofName[ t.Movability() ] << endl;
   }
+  text << "mesh.MakeGroupByIds( 'deleted elements', SMESH.FACE, [";
+  for ( int id : deletedElems )
+    text << id << ",";
+  text << "])" << endl;
 
   const char* fileName = "/tmp/Delaunay.py";
   SMESH_File file( fileName, false );
index 76f4b3378e24e46d873eb954c9ad28c4ee785bf0..7c195c379b8ccaf9098bff0b7a3f34d19fd3c270 100644 (file)
@@ -66,7 +66,7 @@
 //-------------------------------------------------------------------------------------
 // A macro makes description of a caught exception and calls onExceptionFun(const char*).
 // Several onExceptionFun() are defined here: throwSalomeEx(), doNothing() and returnError().
-// To add your own catch close, define SMY_OWN_CATCH macro before including this file.
+// To add your own catch clause, define SMY_OWN_CATCH macro before including this file.
 
 #define SMESH_CATCH( onExceptionFun )                                   \
   }                                                                     \