X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Gen.cxx;h=36e454366a4165396b8da07ba93724a5e0eb7ee6;hp=69e499dd5effcb8884fc45b732ea9091ac037258;hb=refs%2Fheads%2FV9_dev;hpb=9655cb578db3659e41763af22c9de67724bdd66d diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 69e499dd5..36e454366 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -65,6 +65,8 @@ using namespace std; SMESH_Gen::SMESH_Gen() { + _studyContext = new StudyContextStruct; + _studyContext->myDocument = new SMESHDS_Document(); _localId = 0; _hypId = 0; _segmentation = _nbSegments = 10; @@ -94,19 +96,14 @@ namespace SMESH_Gen::~SMESH_Gen() { - std::map < int, StudyContextStruct * >::iterator i_sc = _mapStudyContext.begin(); - for ( ; i_sc != _mapStudyContext.end(); ++i_sc ) - { - StudyContextStruct* context = i_sc->second; - std::map < int, SMESH_Hypothesis * >::iterator i_hyp = context->mapHypothesis.begin(); - for ( ; i_hyp != context->mapHypothesis.end(); ++i_hyp ) + std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin(); + for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp ) { if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second )) h->NullifyGen(); } - delete context->myDocument; - delete context; - } + delete _studyContext->myDocument; + delete _studyContext; } //============================================================================= @@ -116,21 +113,17 @@ SMESH_Gen::~SMESH_Gen() */ //============================================================================= -SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode) +SMESH_Mesh* SMESH_Gen::CreateMesh(bool theIsEmbeddedMode) throw(SALOME_Exception) { Unexpect aCatch(SalomeException); - // Get studyContext, create it if it doesn't exist, with a SMESHDS_Document - StudyContextStruct *aStudyContext = GetStudyContext(theStudyId); - // create a new SMESH_mesh object SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++, - theStudyId, this, theIsEmbeddedMode, - aStudyContext->myDocument); - aStudyContext->mapMesh[_localId-1] = aMesh; + _studyContext->myDocument); + _studyContext->mapMesh[_localId-1] = aMesh; return aMesh; } @@ -1149,17 +1142,9 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_subMesh * aSubMesh, */ //============================================================================= -StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId) +StudyContextStruct *SMESH_Gen::GetStudyContext() { - // Get studyContext, create it if it doesn't exist, with a SMESHDS_Document - - if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) - { - _mapStudyContext[studyId] = new StudyContextStruct; - _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); - } - StudyContextStruct *myStudyContext = _mapStudyContext[studyId]; - return myStudyContext; + return _studyContext; } //================================================================================