Salome HOME
23239: [CEA 1739] Regression : crash trying to create mesh
authoreap <eap@opencascade.com>
Wed, 17 Feb 2016 17:36:53 +0000 (20:36 +0300)
committereap <eap@opencascade.com>
Wed, 17 Feb 2016 17:36:53 +0000 (20:36 +0300)
   (StdMesher_Prism_3D.cxx)

+ minor changes

doc/salome/gui/SMESH/images/quad_from_ma_mesh.png
src/SMESH/SMESH_Mesh.hxx
src/SMESHUtils/SMESH_MAT2d.cxx
src/SMESHUtils/SMESH_MAT2d.hxx
src/StdMeshers/StdMeshers_Prism_3D.cxx

index f233cc640783dea9f48b8889bf27a8d5e9920fc7..3e3c63b23bd8d64dddc806f68f5bb70b7a974ffc 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/quad_from_ma_mesh.png and b/doc/salome/gui/SMESH/images/quad_from_ma_mesh.png differ
index 5221ab7d2d1506486b714f020e07a7b49c986240..fc00be6a77c0a7070148737f9b5ec05d4bee565f 100644 (file)
@@ -344,7 +344,7 @@ class SMESH_EXPORT SMESH_Mesh
   bool IsOrderOK( const SMESH_subMesh* smBefore,
                   const SMESH_subMesh* smAfter ) const;
 
-  ostream& Dump(ostream & save);
+  std::ostream& Dump(ostream & save);
   
 private:
 
index c9fcd85013fb991b19f7235285c15c7b1c79b03b..7b9eac3c20248084ed8b75f6f6504753686e9bcd 100644 (file)
@@ -47,7 +47,7 @@
 #include <TopoDS_Wire.hxx>
 
 #ifdef _DEBUG_
-#define _MYDEBUG_
+//#define _MYDEBUG_
 #include "SMESH_File.hxx"
 #include "SMESH_Comment.hxx"
 #endif
@@ -162,6 +162,8 @@ namespace
     if ( inSegments.size() > 1000 )
       return;
     const char* fileName = "/misc/dn25/salome/eap/salome/misc/Code/C++/MAdebug.txt";
+    const char*     user = getenv("USER");
+    if ( !user || strcmp( user, "eap" )) return;
     SMESH_File file(fileName, false );
     file.remove();
     file.openForWriting();
@@ -1518,9 +1520,9 @@ Adaptor3d_Curve* SMESH_MAT2d::MedialAxis::make3DCurve(const Branch& branch) cons
  */
 //================================================================================
 
-void SMESH_MAT2d::Branch::init( vector<const TVDEdge*>&                maEdges,
-                                const Boundary*                        boundary,
-                                map< const TVDVertex*, BranchEndType > endType )
+void SMESH_MAT2d::Branch::init( vector<const TVDEdge*>&                 maEdges,
+                                const Boundary*                         boundary,
+                                map< const TVDVertex*, BranchEndType >& endType )
 {
   if ( maEdges.empty() ) return;
 
index 618608e07e73f5072d6256b71cd21d9075d60d1f..328366ccefe7d81b9e71f8d80c7d65adf540f27d 100644 (file)
@@ -120,9 +120,9 @@ namespace SMESH_MAT2d
 
   public: // internal: construction
 
-    void init( std::vector<const TVDEdge*>&                maEdges,
-               const Boundary*                             boundary,
-               std::map< const TVDVertex*, BranchEndType > endType);
+    void init( std::vector<const TVDEdge*>&                 maEdges,
+               const Boundary*                              boundary,
+               std::map< const TVDVertex*, BranchEndType >& endType);
     void setBranchesToEnds( const std::vector< Branch >&   branches);
     BranchPoint getPoint( const TVDVertex* vertex ) const;
     void setRemoved( const BranchPoint& proxyPoint );
index 645bad1e2fe5c47a251bef2637fe531d34f09998..8b7347d7b9702cc27cd8b02b523e7da47039e776 100644 (file)
@@ -2512,16 +2512,17 @@ namespace // utils used by StdMeshers_Prism_3D::IsApplicable()
     }
     EdgeWithNeighbors() {}
   };
-  struct PrismSide
+  // PrismSide contains all FACEs linking a bottom EDGE with a top one. 
+  struct PrismSide 
   {
-    TopoDS_Face                 _face;
-    TopTools_IndexedMapOfShape *_faces; // pointer because its copy constructor is private
-    TopoDS_Edge                 _topEdge;
-    vector< EdgeWithNeighbors >*_edges;
-    int                         _iBotEdge;
-    vector< bool >              _isCheckedEdge;
+    TopoDS_Face                 _face;    // a currently treated upper FACE
+    TopTools_IndexedMapOfShape *_faces;   // all FACEs (pointer because of a private copy constructor)
+    TopoDS_Edge                 _topEdge; // a current top EDGE
+    vector< EdgeWithNeighbors >*_edges;   // all EDGEs of _face
+    int                         _iBotEdge;       // index of _topEdge within _edges
+    vector< bool >              _isCheckedEdge;  // mark EDGEs whose two owner FACEs found
     int                         _nbCheckedEdges; // nb of EDGEs whose location is defined
-    PrismSide                  *_leftSide;
+    PrismSide                  *_leftSide;       // neighbor sides
     PrismSide                  *_rightSide;
     void SetExcluded() { _leftSide = _rightSide = NULL; }
     bool IsExcluded() const { return !_leftSide; }
@@ -2679,7 +2680,7 @@ bool StdMeshers_Prism_3D::IsApplicable(const TopoDS_Shape & shape, bool toCheckA
 
     typedef vector< EdgeWithNeighbors > TEdgeWithNeighborsVec;
     vector< TEdgeWithNeighborsVec > faceEdgesVec( allFaces.Extent() + 1 );
-    const size_t nbEdgesMax = facesOfEdge.Extent() * 2; // there can be seam EDGES
+    const size_t nbEdgesMax = facesOfEdge.Extent() * 2; // there can be seam EDGEs
     TopTools_IndexedMapOfShape* facesOfSide = new TopTools_IndexedMapOfShape[ nbEdgesMax ];
     SMESHUtils::ArrayDeleter<TopTools_IndexedMapOfShape> delFacesOfSide( facesOfSide );
 
@@ -2815,6 +2816,10 @@ bool StdMeshers_Prism_3D::IsApplicable(const TopoDS_Shape & shape, bool toCheckA
               side._isCheckedEdge[ side._iBotEdge ] = true;
               side._nbCheckedEdges = 1; // bottom EDGE is known
             }
+            else // probably a triangular top face found
+            {
+              side._face.Nullify();
+            }
             side._topEdge.Nullify();
             isOK = ( !side._edges->empty() || side._faces->Extent() > 1 );