Salome HOME
22573: [CEA 1154] Regression on a blsurf mesh (crash on test_periodicity_LR_ONLY.py)
authoreap <eap@opencascade.com>
Tue, 31 Mar 2015 16:42:12 +0000 (19:42 +0300)
committereap <eap@opencascade.com>
Tue, 31 Mar 2015 16:42:12 +0000 (19:42 +0300)
+ IMP 22264: EDF 2648 GEOM: Propagate edges automatic orientation (fix Number of Segments dlg)
+ bad STL files are written on Windows (reported by YFR)
+ 22874: [CEA 1425] Performance SMESH Module ( refix ~SMESH_Mesh() )

src/DriverSTL/DriverSTL_W_SMDS_Mesh.cxx
src/SMESH/SMESH_Mesh.cxx
src/SMESH/SMESH_subMesh.cxx
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx
src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h
src/StdMeshersGUI/StdMeshersGUI_PropagationHelperWdg.cxx
src/StdMeshersGUI/StdMeshersGUI_PropagationHelperWdg.h

index 8ddbfd0dd8463135b2516611a7f0952ec1590b07..78a068e578da1ef12631b8b4d319c05fe16a5131 100644 (file)
@@ -305,7 +305,7 @@ Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeAscii() const
   {
     const SMDS_MeshElement* aFace = itFaces->next();
     int nbTria = getTriangles( aFace, triaNodes );
-    
+
     for ( int iT = 0, iN = 0; iT < nbTria; ++iT )
     {
       gp_XYZ normale = getNormale( triaNodes[iN],
@@ -315,7 +315,7 @@ Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeAscii() const
                " facet normal % 12e % 12e % 12e\n"
                "   outer loop\n" ,
                normale.X(), normale.Y(), normale.Z());
-      aFile.writeRaw ( sval, 70 );
+      aFile.writeRaw ( sval, 70 + strlen( sval + 70 )); // at least 70 but can be more (WIN)
 
       for ( int jN = 0; jN < 3; ++jN, ++iN )
       {
@@ -323,11 +323,11 @@ Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeAscii() const
         sprintf (sval,
                  "     vertex % 12e % 12e % 12e\n",
                  node.X(), node.Y(), node.Z() );
-        aFile.writeRaw ( sval, 54 );
+        aFile.writeRaw ( sval, 54 + strlen( sval + 54 ));
       }
       aFile.writeRaw ("   endloop\n"
                       " endfacet\n", 21 );
-    } 
+    }
   }
   aFile.writeRaw ("endsolid\n" , 9 );
 
index aac87a540f26e24a594d6c852ca88b4508e7a38d..24042d9da45baf471bf2e72e06f5e63857786892 100644 (file)
@@ -181,22 +181,10 @@ SMESH_Mesh::~SMESH_Mesh()
 {
   MESSAGE("SMESH_Mesh::~SMESH_Mesh");
 
-  // Unassign algorithms in order to have all SMESH_subMeshEventListenerData deleted (22874)
+  // avoid usual removal of elements while processing RemoveHypothesis( algo ) event
   SMESHDS_SubMeshIteratorPtr smIt = _myMeshDS->SubMeshes();
-  while ( smIt->more() ) {
-    // avoid usual removal of elements while processing RemoveHypothesis( algo ) event
+  while ( smIt->more() )
     const_cast<SMESHDS_SubMesh*>( smIt->next() )->Clear();
-  }
-  const ShapeToHypothesis & hyps = _myMeshDS->GetHypotheses();
-  for ( ShapeToHypothesis::Iterator s2hyps( hyps ); s2hyps.More(); s2hyps.Next() )
-  {
-    const TopoDS_Shape& s = s2hyps.Key();
-    THypList         hyps = s2hyps.ChangeValue(); // copy
-    THypList::const_iterator h = hyps.begin();
-    for ( ; h != hyps.end(); ++h )
-      if ( (*h)->GetType() != SMESHDS_Hypothesis::PARAM_ALGO )
-        RemoveHypothesis( s, (*h)->GetID() );
-  }
 
   // issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study
   //   Notify event listeners at least that something happens
@@ -2276,8 +2264,8 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
         TopTools_ListIteratorOfListOfShape ancIt (ancList);
         while ( ancIt.More() && ancIt.Value().ShapeType() >= memberType )
           ancIt.Next();
-        if ( ancIt.More() )
-          ancList.InsertBefore( theShape, ancIt );
+        if ( ancIt.More() ) ancList.InsertBefore( theShape, ancIt );
+        else                ancList.Append( theShape );
       }
   }
   else // else added for 52457: Addition of hypotheses is 8 time longer than meshing
index a7b015260631705e396ff8193615a2d1dd96fa5f..6545ef40ceb6c2fc04b31c00609d4f325955103a 100644 (file)
@@ -2469,7 +2469,9 @@ void SMESH_subMesh::deleteOwnListeners()
   {
     if ( !_father->MeshExists( d->myMeshID ))
       continue;
-    if ( _father->GetId() == d->myMeshID && !_father->GetSubMeshContaining( d->mySubMeshID ))
+    if ( _father->GetId() == d->myMeshID &&
+         this->GetId()    != d->mySubMeshID &&
+         !_father->GetSubMeshContaining( d->mySubMeshID ))
       continue;
     d->mySubMesh->DeleteEventListener( d->myListener );
   }
index 519478d300bd5126f75585304eb9676c955fc84c..ec4cb02c6e0eb5014b86fd567dc36d35a0879ba3 100644 (file)
@@ -114,8 +114,6 @@ namespace MeshEditor_I {
       _myMeshDS  = new SMESHDS_Mesh( _id, true );
       myPreviewType = previewElements;
     }
-    //!< Destructor
-    virtual ~TPreviewMesh() { delete _myMeshDS; _myMeshDS = 0; }
     //!< Copy a set of elements
     void Copy(const TIDSortedElemSet & theElements,
               TIDSortedElemSet&        theCopyElements,
index ec15db30b106eabb6d5c1371ae7feb1f01235722..cfb80164e4dc55852e8e69ba36b74a7640fc2745 100644 (file)
@@ -225,7 +225,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
 
   if ( !aGeomEntry.isEmpty() || !aMainEntry.isEmpty() )
   {
-    myReversedEdgesHelper = new StdMeshersGUI_PropagationHelperWdg( myDirectionWidget, fr );
+    myReversedEdgesHelper = new StdMeshersGUI_PropagationHelperWdg( myDirectionWidget, fr, false );
     lay->addWidget( myReversedEdgesHelper );
     lay->setStretchFactor( myReversedEdgesHelper, 1 );
   }
@@ -236,6 +236,8 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
   connect( myExpr,  SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
   connect( myConv,  SIGNAL( buttonClicked( int ) ), this, SLOT( onValueChanged() ) );
 
+  onValueChanged();
+
   return fr;
 }
 
@@ -438,10 +440,12 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
 
   myScale->setShown( distr==1 );
   myLScale->setShown( distr==1 );
-  myReversedEdgesBox->setShown( !distr==0 );
-  myDirectionWidget->ShowPreview( !distr==0 );
-  if ( myReversedEdgesHelper )
-    myReversedEdgesHelper->setShown( !distr==0 );
+  myReversedEdgesBox->setShown( distr!=0 );
+  if ( myReversedEdgesHelper ) {
+    myReversedEdgesHelper->Clear();
+    myReversedEdgesHelper->setShown( distr!=0 );
+  }
+  myDirectionWidget->ShowPreview( distr!=0 );
 
   bool isFunc = distr==2 || distr==3;
   myPreview->setShown( isFunc );
index 61dc6047b32893c264581037d8dc18b05e17136b..f39b2feb9c2089939249f22eba6eb2deb2a7be74 100644 (file)
@@ -46,6 +46,7 @@ class QGroupBox;
 class QGridLayout;
 class QRadioButton;
 class StdMeshersGUI_SubShapeSelectorWdg;
+class StdMeshersGUI_PropagationHelperWdg;
 
 typedef struct
 {
@@ -96,7 +97,7 @@ private:
   QGroupBox*       myReversedEdgesBox;
 
   StdMeshersGUI_SubShapeSelectorWdg*    myDirectionWidget;
-  QWidget*                              myReversedEdgesHelper;
+  StdMeshersGUI_PropagationHelperWdg*   myReversedEdgesHelper;
 };
 
 #endif // STDMESHERSGUI_NBSEGMENTSCREATOR_H
index 1105299a90564fb2f6623cfd2834db657f9983d9..9f9dbd002d8ec5253f03b614835fd8527fcfb245 100644 (file)
 
 StdMeshersGUI_PropagationHelperWdg::
 StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelectWdg,
-                                    QWidget*                           parent ):
+                                    QWidget*                           parent,
+                                    bool                               show ):
   QWidget( parent ), mySubSelectWdg( subSelectWdg ), myActor( 0 ), myModelActor( 0 )
 {
-  QGroupBox* helperBox      = new QGroupBox( tr("HELPER"), this );
-  QCheckBox* showGeomChkBox = new QCheckBox( tr("SHOW_GEOMETRY"), helperBox );
-  QGroupBox* chainBox       = new QGroupBox( tr("PROPAGATION_CHAINS"), helperBox );
-  chainBox->setCheckable( true );
-  chainBox->setChecked( false );
-  myListWidget              = new QListWidget( helperBox );
+  QGroupBox* helperBox = new QGroupBox( tr("HELPER"), this );
+  myShowGeomChkBox     = new QCheckBox( tr("SHOW_GEOMETRY"), helperBox );
+  myChainBox           = new QGroupBox( tr("PROPAGATION_CHAINS"), helperBox );
+  myChainBox->setCheckable( true );
+  myChainBox->setChecked( false );
+  myListWidget         = new QListWidget( helperBox );
   myListWidget->setSelectionMode( QAbstractItemView::SingleSelection );
-  myAddButton               = new QPushButton( tr("ADD"), helperBox );
-  myReverseButton           = new QPushButton( tr("REVERSE"), helperBox );
+  myAddButton          = new QPushButton( tr("ADD"), helperBox );
+  myReverseButton      = new QPushButton( tr("REVERSE"), helperBox );
 
-  QGridLayout* chainsLayout = new QGridLayout( chainBox );
+  QGridLayout* chainsLayout = new QGridLayout( myChainBox );
   chainsLayout->setMargin( MARGIN );
   chainsLayout->setSpacing( SPACING );
   chainsLayout->addWidget(myListWidget,    0, 0, 3, 3);
@@ -87,21 +88,22 @@ StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelect
   QVBoxLayout* helperLayout = new QVBoxLayout( helperBox );
   helperLayout->setMargin( MARGIN );
   helperLayout->setSpacing( SPACING );
-  helperLayout->addWidget( showGeomChkBox );
-  helperLayout->addWidget( chainBox );
+  helperLayout->addWidget( myShowGeomChkBox );
+  helperLayout->addWidget( myChainBox );
 
   QVBoxLayout* lay = new QVBoxLayout( this );
   lay->setMargin( 0 );
   lay->setSpacing( SPACING );
   lay->addWidget( helperBox );
 
-  connect( showGeomChkBox,  SIGNAL( toggled(bool)), SLOT( onShowGeometry(bool)));
-  connect( chainBox,        SIGNAL( toggled(bool)), SLOT( updateList(bool)));
+  connect( myShowGeomChkBox,SIGNAL( toggled(bool)), SLOT( onShowGeometry(bool)));
+  connect( myChainBox,        SIGNAL( toggled(bool)), SLOT( updateList(bool)));
   connect( myListWidget,    SIGNAL( itemSelectionChanged()), SLOT( onListSelectionChanged() ));
   connect( myAddButton,     SIGNAL( clicked(bool)), SLOT( onAdd() ));
   connect( myReverseButton, SIGNAL( clicked(bool)), SLOT( onReverse() ));
 
-  onListSelectionChanged();
+  if ( show )
+    onListSelectionChanged();
 }
 
 //================================================================================
@@ -126,6 +128,31 @@ StdMeshersGUI_PropagationHelperWdg::~StdMeshersGUI_PropagationHelperWdg()
   }
 }
 
+//================================================================================
+/*!
+ * \brief Switch off all buttons and previews
+ */
+//================================================================================
+
+void StdMeshersGUI_PropagationHelperWdg::Clear()
+{
+  myShowGeomChkBox->setChecked( false );
+
+  myListWidget->blockSignals( true );
+  myListWidget->clear();
+  myListWidget->blockSignals( false );
+
+  myChainBox->blockSignals( true );
+  myChainBox->setChecked( false );
+  myChainBox->blockSignals( false );
+
+  if ( myActor )
+    myActor->SetVisibility( false );
+
+  if ( myModelActor )
+    myModelActor->SetVisibility( false );
+}
+
 //================================================================================
 /*!
  * \brief SLOT called when 'Show Geometry' is checked
index b0b5ad99b6c973a29dff7c39ebd0c4cb9b9f6f3a..241e4070d88e64868399cac523817578c25952b2 100644 (file)
@@ -30,6 +30,8 @@ class QListWidget;
 class StdMeshersGUI_SubShapeSelectorWdg;
 class vtkRenderer;
 class GEOM_Actor;
+class QCheckBox;
+class QGroupBox;
 
 /*!
  * \brief A widget showing a list of propagation chains of EDGEs.
@@ -43,9 +45,12 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_PropagationHelperWdg : public QWidget
 
  public:
   StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelectWdg,
-                                      QWidget* parent = 0 );
+                                      QWidget* parent = 0,
+                                      bool show = true);
   ~StdMeshersGUI_PropagationHelperWdg();
 
+  void                           Clear();
+
  private slots:
 
   void                           onShowGeometry(bool toShow);
@@ -64,9 +69,11 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_PropagationHelperWdg : public QWidget
   GEOM_Actor*                        myActor;
   GEOM_Actor*                        myModelActor;
 
-  QListWidget*                   myListWidget;
-  QPushButton*                   myAddButton;
-  QPushButton*                   myReverseButton;
+  QListWidget*                       myListWidget;
+  QPushButton*                       myAddButton;
+  QPushButton*                       myReverseButton;
+  QCheckBox*                         myShowGeomChkBox;
+  QGroupBox*                         myChainBox;
 
   std::vector< std::vector<int> >    myChains;
 };