From 656d6656d48e949cb5493e4860c9837e71b4e0f6 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 24 Feb 2012 10:39:58 +0000 Subject: [PATCH] 0021208: Performance issue when loading SMESH with an hdf file containing a big mesh rename private methods to start from lower-case letters + void Load(); --- src/SMESH/SMESH_Mesh.cxx | 35 +++++++++++++++++++++++++---------- src/SMESH/SMESH_Mesh.hxx | 22 ++++++++++++++-------- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 45d541b7a..2e09dcd86 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -108,7 +108,7 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId, _isAutoColor = false; _isModified = false; _shapeDiagonal = 0.0; - _rmGroupCallUp = 0; + _callUp = 0; _myMeshDS->ShapeToMesh( PseudoShape() ); } @@ -131,7 +131,7 @@ SMESH_Mesh::SMESH_Mesh(): _isAutoColor( false ), _isModified( false ), _shapeDiagonal( 0.0 ), - _rmGroupCallUp( 0 ) + _callUp( 0 ) { } @@ -176,8 +176,8 @@ SMESH_Mesh::~SMESH_Mesh() } _mapSubMesh.clear(); - if ( _rmGroupCallUp) delete _rmGroupCallUp; - _rmGroupCallUp = 0; + if ( _callUp) delete _callUp; + _callUp = 0; // remove self from studyContext if ( _gen ) @@ -326,6 +326,18 @@ double SMESH_Mesh::GetShapeDiagonalSize() const return _shapeDiagonal; } +//================================================================================ +/*! + * \brief Load mesh from study file + */ +//================================================================================ + +void SMESH_Mesh::Load() +{ + if (_callUp) + _callUp->Load(); +} + //======================================================================= /*! * \brief Remove all nodes and elements @@ -1043,6 +1055,9 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h if ( !GetMeshDS()->IsUsedHypothesis( hyp )) return; + if (_callUp) + _callUp->HypothesisModified(); + const SMESH_Algo *foundAlgo = 0; SMESH_HypoFilter algoKind, compatibleHypoKind; list usedHyps; @@ -1684,15 +1699,15 @@ list SMESH_Mesh::GetGroupIds() const //================================================================================ /*! - * \brief Set a caller of RemoveGroup() at level of CORBA API implementation. + * \brief Set a caller of methods at level of CORBA API implementation. * The set upCaller will be deleted by SMESH_Mesh */ //================================================================================ -void SMESH_Mesh::SetRemoveGroupCallUp( TRmGroupCallUp* upCaller ) +void SMESH_Mesh::SetCallUp( TCallUp* upCaller ) { - if ( _rmGroupCallUp ) delete _rmGroupCallUp; - _rmGroupCallUp = upCaller; + if ( _callUp ) delete _callUp; + _callUp = upCaller; } //============================================================================= @@ -1708,8 +1723,8 @@ bool SMESH_Mesh::RemoveGroup (const int theGroupID) GetMeshDS()->RemoveGroup( _mapGroup[theGroupID]->GetGroupDS() ); delete _mapGroup[theGroupID]; _mapGroup.erase (theGroupID); - if (_rmGroupCallUp) - _rmGroupCallUp->RemoveGroup( theGroupID ); + if (_callUp) + _callUp->RemoveGroup( theGroupID ); return true; } diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index 2546d7fbf..f569156b4 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -98,11 +98,14 @@ public: */ static const TopoDS_Solid& PseudoShape(); + /*! + * \brief Load mesh from study file + */ + void Load(); /*! * \brief Remove all nodes and elements */ void Clear(); - /*! * \brief Remove all nodes and elements of indicated shape */ @@ -295,12 +298,14 @@ public: SMESH_Group* ConvertToStandalone ( int theGroupID ); - struct TRmGroupCallUp + struct TCallUp // callback from SMESH to SMESH_I level { virtual void RemoveGroup (const int theGroupID)=0; - virtual ~TRmGroupCallUp() {} + virtual void HypothesisModified ()=0; + virtual void Load ()=0; + virtual ~TCallUp() {} }; - void SetRemoveGroupCallUp( TRmGroupCallUp * upCaller ); + void SetCallUp( TCallUp * upCaller ); bool SynchronizeGroups(); @@ -351,10 +356,11 @@ protected: TListOfListOfInt _mySubMeshOrder; - // Struct calling RemoveGroup at CORBA API implementation level, used - // to make an upper level be consistent with a lower one when group removal - // is invoked by hyp modification - TRmGroupCallUp* _rmGroupCallUp; + // Struct calling methods at CORBA API implementation level, used to + // 1) make an upper level be consistent with a lower one when group removal + // is invoked by hyp modification (issue 0020918) + // 2) to forget not loaded mesh data at hyp modification + TCallUp* _callUp; protected: SMESH_Mesh();