22573: [CEA 1154] Regression on a blsurf mesh (crash on test_periodicity_LR_ONLY.py)

+ 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() )
This commit is contained in:
eap 2015-03-31 19:42:12 +03:00
parent e6d6fd4aa1
commit b0a962d83d
8 changed files with 75 additions and 48 deletions

View File

@ -315,7 +315,7 @@ Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeAscii() const
" facet normal % 12e % 12e % 12e\n" " facet normal % 12e % 12e % 12e\n"
" outer loop\n" , " outer loop\n" ,
normale.X(), normale.Y(), normale.Z()); 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 ) for ( int jN = 0; jN < 3; ++jN, ++iN )
{ {
@ -323,7 +323,7 @@ Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeAscii() const
sprintf (sval, sprintf (sval,
" vertex % 12e % 12e % 12e\n", " vertex % 12e % 12e % 12e\n",
node.X(), node.Y(), node.Z() ); node.X(), node.Y(), node.Z() );
aFile.writeRaw ( sval, 54 ); aFile.writeRaw ( sval, 54 + strlen( sval + 54 ));
} }
aFile.writeRaw (" endloop\n" aFile.writeRaw (" endloop\n"
" endfacet\n", 21 ); " endfacet\n", 21 );

View File

@ -181,22 +181,10 @@ SMESH_Mesh::~SMESH_Mesh()
{ {
MESSAGE("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(); SMESHDS_SubMeshIteratorPtr smIt = _myMeshDS->SubMeshes();
while ( smIt->more() ) { while ( smIt->more() )
// avoid usual removal of elements while processing RemoveHypothesis( algo ) event
const_cast<SMESHDS_SubMesh*>( smIt->next() )->Clear(); 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 // issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study
// Notify event listeners at least that something happens // Notify event listeners at least that something happens
@ -2276,8 +2264,8 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
TopTools_ListIteratorOfListOfShape ancIt (ancList); TopTools_ListIteratorOfListOfShape ancIt (ancList);
while ( ancIt.More() && ancIt.Value().ShapeType() >= memberType ) while ( ancIt.More() && ancIt.Value().ShapeType() >= memberType )
ancIt.Next(); ancIt.Next();
if ( ancIt.More() ) if ( ancIt.More() ) ancList.InsertBefore( theShape, ancIt );
ancList.InsertBefore( theShape, ancIt ); else ancList.Append( theShape );
} }
} }
else // else added for 52457: Addition of hypotheses is 8 time longer than meshing else // else added for 52457: Addition of hypotheses is 8 time longer than meshing

View File

@ -2469,7 +2469,9 @@ void SMESH_subMesh::deleteOwnListeners()
{ {
if ( !_father->MeshExists( d->myMeshID )) if ( !_father->MeshExists( d->myMeshID ))
continue; continue;
if ( _father->GetId() == d->myMeshID && !_father->GetSubMeshContaining( d->mySubMeshID )) if ( _father->GetId() == d->myMeshID &&
this->GetId() != d->mySubMeshID &&
!_father->GetSubMeshContaining( d->mySubMeshID ))
continue; continue;
d->mySubMesh->DeleteEventListener( d->myListener ); d->mySubMesh->DeleteEventListener( d->myListener );
} }

View File

@ -114,8 +114,6 @@ namespace MeshEditor_I {
_myMeshDS = new SMESHDS_Mesh( _id, true ); _myMeshDS = new SMESHDS_Mesh( _id, true );
myPreviewType = previewElements; myPreviewType = previewElements;
} }
//!< Destructor
virtual ~TPreviewMesh() { delete _myMeshDS; _myMeshDS = 0; }
//!< Copy a set of elements //!< Copy a set of elements
void Copy(const TIDSortedElemSet & theElements, void Copy(const TIDSortedElemSet & theElements,
TIDSortedElemSet& theCopyElements, TIDSortedElemSet& theCopyElements,

View File

@ -225,7 +225,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
if ( !aGeomEntry.isEmpty() || !aMainEntry.isEmpty() ) if ( !aGeomEntry.isEmpty() || !aMainEntry.isEmpty() )
{ {
myReversedEdgesHelper = new StdMeshersGUI_PropagationHelperWdg( myDirectionWidget, fr ); myReversedEdgesHelper = new StdMeshersGUI_PropagationHelperWdg( myDirectionWidget, fr, false );
lay->addWidget( myReversedEdgesHelper ); lay->addWidget( myReversedEdgesHelper );
lay->setStretchFactor( myReversedEdgesHelper, 1 ); lay->setStretchFactor( myReversedEdgesHelper, 1 );
} }
@ -236,6 +236,8 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
connect( myExpr, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) ); connect( myExpr, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
connect( myConv, SIGNAL( buttonClicked( int ) ), this, SLOT( onValueChanged() ) ); connect( myConv, SIGNAL( buttonClicked( int ) ), this, SLOT( onValueChanged() ) );
onValueChanged();
return fr; return fr;
} }
@ -438,10 +440,12 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
myScale->setShown( distr==1 ); myScale->setShown( distr==1 );
myLScale->setShown( distr==1 ); myLScale->setShown( distr==1 );
myReversedEdgesBox->setShown( !distr==0 ); myReversedEdgesBox->setShown( distr!=0 );
myDirectionWidget->ShowPreview( !distr==0 ); if ( myReversedEdgesHelper ) {
if ( myReversedEdgesHelper ) myReversedEdgesHelper->Clear();
myReversedEdgesHelper->setShown( !distr==0 ); myReversedEdgesHelper->setShown( distr!=0 );
}
myDirectionWidget->ShowPreview( distr!=0 );
bool isFunc = distr==2 || distr==3; bool isFunc = distr==2 || distr==3;
myPreview->setShown( isFunc ); myPreview->setShown( isFunc );

View File

@ -46,6 +46,7 @@ class QGroupBox;
class QGridLayout; class QGridLayout;
class QRadioButton; class QRadioButton;
class StdMeshersGUI_SubShapeSelectorWdg; class StdMeshersGUI_SubShapeSelectorWdg;
class StdMeshersGUI_PropagationHelperWdg;
typedef struct typedef struct
{ {
@ -96,7 +97,7 @@ private:
QGroupBox* myReversedEdgesBox; QGroupBox* myReversedEdgesBox;
StdMeshersGUI_SubShapeSelectorWdg* myDirectionWidget; StdMeshersGUI_SubShapeSelectorWdg* myDirectionWidget;
QWidget* myReversedEdgesHelper; StdMeshersGUI_PropagationHelperWdg* myReversedEdgesHelper;
}; };
#endif // STDMESHERSGUI_NBSEGMENTSCREATOR_H #endif // STDMESHERSGUI_NBSEGMENTSCREATOR_H

View File

@ -64,20 +64,21 @@
StdMeshersGUI_PropagationHelperWdg:: StdMeshersGUI_PropagationHelperWdg::
StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelectWdg, StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelectWdg,
QWidget* parent ): QWidget* parent,
bool show ):
QWidget( parent ), mySubSelectWdg( subSelectWdg ), myActor( 0 ), myModelActor( 0 ) QWidget( parent ), mySubSelectWdg( subSelectWdg ), myActor( 0 ), myModelActor( 0 )
{ {
QGroupBox* helperBox = new QGroupBox( tr("HELPER"), this ); QGroupBox* helperBox = new QGroupBox( tr("HELPER"), this );
QCheckBox* showGeomChkBox = new QCheckBox( tr("SHOW_GEOMETRY"), helperBox ); myShowGeomChkBox = new QCheckBox( tr("SHOW_GEOMETRY"), helperBox );
QGroupBox* chainBox = new QGroupBox( tr("PROPAGATION_CHAINS"), helperBox ); myChainBox = new QGroupBox( tr("PROPAGATION_CHAINS"), helperBox );
chainBox->setCheckable( true ); myChainBox->setCheckable( true );
chainBox->setChecked( false ); myChainBox->setChecked( false );
myListWidget = new QListWidget( helperBox ); myListWidget = new QListWidget( helperBox );
myListWidget->setSelectionMode( QAbstractItemView::SingleSelection ); myListWidget->setSelectionMode( QAbstractItemView::SingleSelection );
myAddButton = new QPushButton( tr("ADD"), helperBox ); myAddButton = new QPushButton( tr("ADD"), helperBox );
myReverseButton = new QPushButton( tr("REVERSE"), helperBox ); myReverseButton = new QPushButton( tr("REVERSE"), helperBox );
QGridLayout* chainsLayout = new QGridLayout( chainBox ); QGridLayout* chainsLayout = new QGridLayout( myChainBox );
chainsLayout->setMargin( MARGIN ); chainsLayout->setMargin( MARGIN );
chainsLayout->setSpacing( SPACING ); chainsLayout->setSpacing( SPACING );
chainsLayout->addWidget(myListWidget, 0, 0, 3, 3); chainsLayout->addWidget(myListWidget, 0, 0, 3, 3);
@ -87,21 +88,22 @@ StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelect
QVBoxLayout* helperLayout = new QVBoxLayout( helperBox ); QVBoxLayout* helperLayout = new QVBoxLayout( helperBox );
helperLayout->setMargin( MARGIN ); helperLayout->setMargin( MARGIN );
helperLayout->setSpacing( SPACING ); helperLayout->setSpacing( SPACING );
helperLayout->addWidget( showGeomChkBox ); helperLayout->addWidget( myShowGeomChkBox );
helperLayout->addWidget( chainBox ); helperLayout->addWidget( myChainBox );
QVBoxLayout* lay = new QVBoxLayout( this ); QVBoxLayout* lay = new QVBoxLayout( this );
lay->setMargin( 0 ); lay->setMargin( 0 );
lay->setSpacing( SPACING ); lay->setSpacing( SPACING );
lay->addWidget( helperBox ); lay->addWidget( helperBox );
connect( showGeomChkBox, SIGNAL( toggled(bool)), SLOT( onShowGeometry(bool))); connect( myShowGeomChkBox,SIGNAL( toggled(bool)), SLOT( onShowGeometry(bool)));
connect( chainBox, SIGNAL( toggled(bool)), SLOT( updateList(bool))); connect( myChainBox, SIGNAL( toggled(bool)), SLOT( updateList(bool)));
connect( myListWidget, SIGNAL( itemSelectionChanged()), SLOT( onListSelectionChanged() )); connect( myListWidget, SIGNAL( itemSelectionChanged()), SLOT( onListSelectionChanged() ));
connect( myAddButton, SIGNAL( clicked(bool)), SLOT( onAdd() )); connect( myAddButton, SIGNAL( clicked(bool)), SLOT( onAdd() ));
connect( myReverseButton, SIGNAL( clicked(bool)), SLOT( onReverse() )); 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 * \brief SLOT called when 'Show Geometry' is checked

View File

@ -30,6 +30,8 @@ class QListWidget;
class StdMeshersGUI_SubShapeSelectorWdg; class StdMeshersGUI_SubShapeSelectorWdg;
class vtkRenderer; class vtkRenderer;
class GEOM_Actor; class GEOM_Actor;
class QCheckBox;
class QGroupBox;
/*! /*!
* \brief A widget showing a list of propagation chains of EDGEs. * \brief A widget showing a list of propagation chains of EDGEs.
@ -43,9 +45,12 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_PropagationHelperWdg : public QWidget
public: public:
StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelectWdg, StdMeshersGUI_PropagationHelperWdg( StdMeshersGUI_SubShapeSelectorWdg* subSelectWdg,
QWidget* parent = 0 ); QWidget* parent = 0,
bool show = true);
~StdMeshersGUI_PropagationHelperWdg(); ~StdMeshersGUI_PropagationHelperWdg();
void Clear();
private slots: private slots:
void onShowGeometry(bool toShow); void onShowGeometry(bool toShow);
@ -64,9 +69,11 @@ class STDMESHERSGUI_EXPORT StdMeshersGUI_PropagationHelperWdg : public QWidget
GEOM_Actor* myActor; GEOM_Actor* myActor;
GEOM_Actor* myModelActor; GEOM_Actor* myModelActor;
QListWidget* myListWidget; QListWidget* myListWidget;
QPushButton* myAddButton; QPushButton* myAddButton;
QPushButton* myReverseButton; QPushButton* myReverseButton;
QCheckBox* myShowGeomChkBox;
QGroupBox* myChainBox;
std::vector< std::vector<int> > myChains; std::vector< std::vector<int> > myChains;
}; };