X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Gen.cxx;h=69e499dd5effcb8884fc45b732ea9091ac037258;hb=04f997252152407f9180e03f0af428ab2ca6f4be;hp=504089aea77cf618f6939a85d77e6a23c5f15bd6;hpb=eef0bf5cc772a6bdacf6ae2a4d81fdcb9d3a7fdb;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 504089aea..69e499dd5 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -20,7 +20,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// SMESH SMESH : implementaion of SMESH idl descriptions +// SMESH SMESH : implementation of SMESH idl descriptions // File : SMESH_Gen.cxx // Author : Paul RASCLE, EDF // Module : SMESH @@ -73,6 +73,19 @@ SMESH_Gen::SMESH_Gen() //vtkDebugLeaks::SetExitError(0); } +namespace +{ + // a structure used to nullify SMESH_Gen field of SMESH_Hypothesis, + // which is needed for SMESH_Hypothesis not deleted before ~SMESH_Gen() + struct _Hyp : public SMESH_Hypothesis + { + void NullifyGen() + { + _gen = 0; + } + }; +} + //============================================================================= /*! * Destructor @@ -84,9 +97,16 @@ SMESH_Gen::~SMESH_Gen() std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin(); for ( ; i_sc != _mapStudyContext.end(); ++i_sc ) { - delete i_sc->second->myDocument; - delete i_sc->second; - } + StudyContextStruct* context = i_sc->second; + std::map < int, SMESH_Hypothesis * >::iterator i_hyp = context->mapHypothesis.begin(); + for ( ; i_hyp != context->mapHypothesis.end(); ++i_hyp ) + { + if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second )) + h->NullifyGen(); + } + delete context->myDocument; + delete context; + } } //============================================================================= @@ -101,7 +121,7 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode) { Unexpect aCatch(SalomeException); - // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + // Get studyContext, create it if it doesn't exist, with a SMESHDS_Document StudyContextStruct *aStudyContext = GetStudyContext(theStudyId); // create a new SMESH_mesh object @@ -148,6 +168,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, // one face only. SMESH_subMesh::compute_event computeEvent = aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE; + if ( !aMesh.HasShapeToMesh() ) + computeEvent = SMESH_subMesh::COMPUTE_NOGEOM; // if several algos and no geometry if ( anUpward ) // is called from the below code in this method { @@ -371,9 +393,6 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, MEMOSTAT; - if ( aCompactMesh ) - aMesh.GetMeshDS()->compactMesh(); - // fix quadratic mesh by bending iternal links near concave boundary if ( aCompactMesh && // a final compute aShape.IsSame( aMesh.GetShapeToMesh() ) && @@ -386,6 +405,10 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, aHelper.FixQuadraticElements( sm->GetComputeError() ); } } + + if ( aCompactMesh ) + aMesh.GetMeshDS()->compactMesh(); + return ret; } @@ -583,7 +606,6 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh, ret = Evaluate( aMesh, aShape, aResMap, /*anUpward=*/true, aShapesId ); } - MESSAGE( "VSR - SMESH_Gen::Evaluate() finished, OK = " << ret); return ret; } @@ -1057,7 +1079,8 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_subMesh * aSubMesh, SMESH_Mesh& aMesh = *aSubMesh->GetFather(); SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); - filter.And( filter.IsApplicableTo( aShape )); + if ( aMesh.HasShapeToMesh() ) + filter.And( filter.IsApplicableTo( aShape )); typedef SMESH_Algo::Features AlgoData; @@ -1128,7 +1151,7 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_subMesh * aSubMesh, StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId) { - // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + // Get studyContext, create it if it doesn't exist, with a SMESHDS_Document if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) { @@ -1165,7 +1188,7 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType) //============================================================================= /*! - * Genarate a new id unique withing this Gen + * Genarate a new id unique within this Gen */ //=============================================================================