X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_PreMeshInfo.cxx;h=159db363b983b85a609c345e290cde069ab05044;hb=7ba6caead509499e353b12ac44a26a9eb7b0eecf;hp=e56adfadf43b4e3f9971d8dadf19f8720a7946de;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_PreMeshInfo.cxx b/src/SMESH_I/SMESH_PreMeshInfo.cxx index e56adfadf..159db363b 100644 --- a/src/SMESH_I/SMESH_PreMeshInfo.cxx +++ b/src/SMESH_I/SMESH_PreMeshInfo.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -38,37 +38,24 @@ #include "SMESH_Mesh_i.hxx" #include "SMESH_subMesh_i.hxx" +#include + #include #include #include #include -#include #include +#include -#include -#include #include #include +#include "SMESH_TryCatch.hxx" + #include CORBA_SERVER_HEADER(SALOME_Session) -#define MYDEBUGOUT(msg) //std::cout << msg << std::endl; -//================================================================================ -#define PreMeshInfo_TRY \ - try { OCC_CATCH_SIGNALS -//================================================================================ -#define PreMeshInfo_CATCH } \ - catch (Standard_Failure& ex) { \ - onExceptionCaught(SMESH_Comment("OCC Exception caught: \t")<GetCurrentStudy(); if ( !study->_is_nil() && study->StudyId() == mesh->GetStudyId() ) { - SALOMEDS::SObject_var meshSO = gen->ObjectToSObject(study, mesh->_this() ); - CORBA::Object_var obj = gen->GetNS()->Resolve( "/Kernel/Session" ); + SALOMEDS::SObject_wrap meshSO = gen->ObjectToSObject(study, mesh->_this() ); + CORBA::Object_var obj = gen->GetNS()->Resolve( "/Kernel/Session" ); _session = SALOME::Session::_narrow( obj ); if ( !meshSO->_is_nil() && !_session->_is_nil() ) { @@ -258,6 +233,7 @@ namespace med2smeshTypes[ MED::eSEG3 ] = SMDSEntity_Quad_Edge ; med2smeshTypes[ MED::eTRIA3 ] = SMDSEntity_Triangle ; med2smeshTypes[ MED::eTRIA6 ] = SMDSEntity_Quad_Triangle ; + med2smeshTypes[ MED::eTRIA7 ] = SMDSEntity_BiQuad_Triangle ; med2smeshTypes[ MED::eQUAD4 ] = SMDSEntity_Quadrangle ; med2smeshTypes[ MED::eQUAD8 ] = SMDSEntity_Quad_Quadrangle ; med2smeshTypes[ MED::eQUAD9 ] = SMDSEntity_BiQuad_Quadrangle ; @@ -310,7 +286,7 @@ namespace const std::string& name, HDFgroup* hdfGroup) { - // we use med identification of element (MED::EGeometrieElement>) types + // we use med identification of element (MED::EGeometrieElement) types // but not enum SMDSAbs_EntityType because values of SMDSAbs_EntityType may // change at insertion of new items in the middle. const vector& medTypes = mesh2medElemType(); @@ -430,7 +406,7 @@ void SMESH_PreMeshInfo::LoadFromFile( SMESH_Mesh_i* mesh, const std::string& hdfFile, const bool toRemoveFiles) { - PreMeshInfo_TRY; + SMESH_TRY; SMESH_PreMeshInfo* meshPreInfo = new SMESH_PreMeshInfo( mesh,meshID,medFile,hdfFile ); mesh->changePreMeshInfo() = meshPreInfo; @@ -454,7 +430,7 @@ void SMESH_PreMeshInfo::LoadFromFile( SMESH_Mesh_i* mesh, { meshPreInfo->FullLoadFromFile(); } - PreMeshInfo_CATCH; + SMESH_CATCH( SMESH::doNothing ); } //================================================================================ @@ -797,7 +773,7 @@ void SMESH_PreMeshInfo::SaveToFile( SMESH_Mesh_i* mesh, HDFgroup* infoHdfGroup = new HDFgroup( hdfGroupName, hdfFile ); infoHdfGroup->CreateOnDisk(); - PreMeshInfo_TRY; + SMESH_TRY; // info of mesh meshInfo2hdf( mesh->GetMeshInfo(), "Mesh", infoHdfGroup ); @@ -840,7 +816,7 @@ void SMESH_PreMeshInfo::SaveToFile( SMESH_Mesh_i* mesh, } } - PreMeshInfo_CATCH; + SMESH_CATCH( SMESH::doNothing ); infoHdfGroup->CloseOnDisk(); } @@ -858,10 +834,10 @@ void SMESH_PreMeshInfo::FullLoadFromFile() const SMESH_PreMeshInfo* meshInfo = _mesh->changePreMeshInfo(); _mesh->changePreMeshInfo() = NULL; // to allow GUI accessing to real info - ::SMESH_Mesh& mesh = _mesh->GetImpl(); + ::SMESH_Mesh& mesh = _mesh->GetImpl(); SMESHDS_Mesh* meshDS = mesh.GetMeshDS(); - PreMeshInfo_TRY; + SMESH_TRY; MYDEBUGOUT( "BEG FullLoadFromFile() " << _meshID ); @@ -882,7 +858,7 @@ void SMESH_PreMeshInfo::FullLoadFromFile() const // load sub-meshes readSubMeshes( &myReader ); - PreMeshInfo_CATCH; + SMESH_CATCH( SMESH::doNothing ); _mesh->changePreMeshInfo() = meshInfo; @@ -919,6 +895,19 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const SMESHDS_Mesh* meshDS = _mesh->GetImpl().GetMeshDS(); + // issue 0020693. Restore _isModified flag + if ( aTopGroup->ExistInternalObject( "_isModified" )) + { + HDFdataset* aDataset = new HDFdataset( "_isModified", aTopGroup ); + aDataset->OpenOnDisk(); + hdf_size size = aDataset->GetSize(); + int* isModified = new int[ size ]; + aDataset->ReadFromDisk( isModified ); + aDataset->CloseOnDisk(); + _mesh->GetImpl().SetIsModified( bool(*isModified)); + delete [] isModified; + } + bool submeshesInFamilies = ( ! aTopGroup->ExistInternalObject( "Submeshes" )); if ( submeshesInFamilies ) // from MED { @@ -1132,7 +1121,7 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const void SMESH_PreMeshInfo::ForgetAllData() const { - PreMeshInfo_TRY; + SMESH_TRY; if ( _mesh->changePreMeshInfo() != this ) return _mesh->changePreMeshInfo()->ForgetAllData(); @@ -1153,9 +1142,9 @@ void SMESH_PreMeshInfo::ForgetAllData() const map::iterator id2sm = _mesh->_mapSubMeshIor.begin(); for ( ; id2sm != _mesh->_mapSubMeshIor.end(); ++id2sm ) { - if ( SMESH_subMesh_i* sm = SMESH::DownCast( id2sm->second )) + if ( SMESH_subMesh_i* sm_i = SMESH::DownCast( id2sm->second )) { - SMESH_PreMeshInfo* & info = sm->changePreMeshInfo(); + SMESH_PreMeshInfo* & info = sm_i->changePreMeshInfo(); delete info; info = NULL; } @@ -1164,12 +1153,12 @@ void SMESH_PreMeshInfo::ForgetAllData() const _mesh->changePreMeshInfo() = NULL; delete this; - PreMeshInfo_CATCH; + SMESH_CATCH( SMESH::doNothing ); // Finalize loading - // PreMeshInfo_TRY; + // SMESH_TRY; // ::SMESH_Mesh& mesh = _mesh->GetImpl(); @@ -1180,7 +1169,19 @@ void SMESH_PreMeshInfo::ForgetAllData() const // // hyp->UpdateAsMeshesRestored(); - // PreMeshInfo_CATCH; + // SMESH_CATCH( SMESH::doNothing ); +} + +//================================================================================ +/*! + * \brief remove all SMESH_PreMeshInfo fields from mesh and its child objects w/o data loading + */ +//================================================================================ + +void SMESH_PreMeshInfo::ForgetAllData( SMESH_Mesh_i* mesh ) +{ + if ( mesh && mesh->changePreMeshInfo() ) + mesh->changePreMeshInfo()->ForgetAllData(); } //================================================================================ @@ -1262,10 +1263,10 @@ void SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD(SALOMEDS::SComponent_ptr sme SALOMEDS::Study_var study = smeshComp->GetStudy(); if ( theStudyIDToMeshCounter[ (int) study->StudyId() ] > 0 ) { - SALOMEDS::ChildIterator_var itBig = study->NewChildIterator( smeshComp ); + SALOMEDS::ChildIterator_wrap itBig = study->NewChildIterator( smeshComp ); for ( ; itBig->More(); itBig->Next() ) { - SALOMEDS::SObject_var gotBranch = itBig->Value(); - CORBA::Object_var anObject = SMESH_Gen_i::SObjectToObject( gotBranch ); + SALOMEDS::SObject_wrap gotBranch = itBig->Value(); + CORBA::Object_var anObject = SMESH_Gen_i::SObjectToObject( gotBranch ); if ( SMESH_Mesh_i* mesh = SMESH::DownCast( anObject )) { if ( mesh->changePreMeshInfo() )