X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_PreMeshInfo.cxx;h=7514ad21580bf1dd2b3a451346aa63836cea69a9;hp=e11046e1b4a459a0c4b8e4fc322abfc3ad288378;hb=cb55604f37e3d2583272fd436bb6557b041948b5;hpb=d5029840731bccaa1718e65f0abf3b19198c7293 diff --git a/src/SMESH_I/SMESH_PreMeshInfo.cxx b/src/SMESH_I/SMESH_PreMeshInfo.cxx index e11046e1b..7514ad215 100644 --- a/src/SMESH_I/SMESH_PreMeshInfo.cxx +++ b/src/SMESH_I/SMESH_PreMeshInfo.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 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 @@ -61,7 +61,7 @@ using namespace std; namespace { - enum { GroupOnFilter_OutOfDate = -1 }; + enum { GroupOnFilter_OutOfDate = -777 }; // count not yet loaded meshes static int theMeshCounter = 0; @@ -72,7 +72,7 @@ namespace */ //================================================================================ - void meshInfoLoaded( SMESH_Mesh_i* mesh ) + void meshInfoLoaded( SMESH_Mesh_i* /*mesh*/ ) { theMeshCounter++; } @@ -82,7 +82,7 @@ namespace */ //================================================================================ - void filesNoMoreNeeded(SMESH_Mesh_i* mesh, + void filesNoMoreNeeded(SMESH_Mesh_i* /*mesh*/, std::string medFile, std::string hdfFile) { @@ -254,7 +254,7 @@ namespace std::vector data; for ( size_t i = 0; i < meshInfo->length(); ++i ) - if ( meshInfo[i] > 0 ) + if ( meshInfo[i] > 0 || meshInfo[i] == GroupOnFilter_OutOfDate ) { data.push_back( DriverMED::GetMedGeoType( SMDSAbs_EntityType( i ))); //medTypes[ i ] ); data.push_back( meshInfo[ i ] ); @@ -282,10 +282,12 @@ namespace */ //================================================================================ -void SMESH_PreMeshInfo::hdf2meshInfo( const std::string& name, - HDFgroup* hdfGroup) +void SMESH_PreMeshInfo::hdf2meshInfo( const std::string& name, + HDFgroup* hdfGroup, + const TColStd_MapOfAsciiString& allHdfNames) { - if ( hdfGroup->ExistInternalObject( name.c_str()) ) + //if ( hdfGroup->ExistInternalObject( name.c_str()) ) PAL23514 + if ( allHdfNames.Contains( name.c_str() )) { HDFdataset* dataset = new HDFdataset( name.c_str(), hdfGroup ); dataset->OpenOnDisk(); @@ -414,7 +416,17 @@ bool SMESH_PreMeshInfo::readPreInfoFromHDF() HDFgroup* infoHdfGroup = new HDFgroup( hdfGroupName, aFile ); infoHdfGroup->OpenOnDisk(); - _mesh->changePreMeshInfo()->hdf2meshInfo( "Mesh", infoHdfGroup ); + // PAL23514: get all names from the HDFgroup to avoid iteration on its contents + // within aGroup->ExistInternalObject( name ) + TColStd_MapOfAsciiString mapOfNames; + { + std::vector< std::string > subNames; + infoHdfGroup->GetAllObjects( subNames ); + for ( size_t iN = 0; iN < subNames.size(); ++iN ) + mapOfNames.Add( subNames[ iN ].c_str() ); + } + + _mesh->changePreMeshInfo()->hdf2meshInfo( "Mesh", infoHdfGroup, mapOfNames ); // read SMESH_PreMeshInfo of groups map::const_iterator i2group = _mesh->_mapGroups.begin(); @@ -427,7 +439,7 @@ bool SMESH_PreMeshInfo::readPreInfoFromHDF() if ( SMESHDS_GroupBase* group = group_i->GetGroupDS() ) { const std::string name = group->GetStoreName(); - group_i->changePreMeshInfo()->hdf2meshInfo( name, infoHdfGroup ); + group_i->changePreMeshInfo()->hdf2meshInfo( name, infoHdfGroup, mapOfNames ); } } } @@ -439,9 +451,12 @@ bool SMESH_PreMeshInfo::readPreInfoFromHDF() if ( SMESH_subMesh_i* sm = SMESH::DownCast( id2sm->second )) { sm->changePreMeshInfo() = newInstance(); - sm->changePreMeshInfo()->hdf2meshInfo( SMESH_Comment( sm->GetId()), infoHdfGroup ); + sm->changePreMeshInfo()->hdf2meshInfo( SMESH_Comment( sm->GetId()), + infoHdfGroup, + mapOfNames ); } } + infoHdfGroup->CloseOnDisk(); } aFile->CloseOnDisk(); @@ -460,14 +475,11 @@ bool SMESH_PreMeshInfo::readMeshInfo() { _isInfoOk = true; - MED::PWrapper aMed = MED::CrWrapper(_medFileName,true); - // if ( aMed->GetVersion() != MED::eV2_2 ) - // return false; - + MED::PWrapper aMed = MED::CrWrapperR(_medFileName); MED::PMeshInfo medMeshInfo = aMed->CrMeshInfo(3,3,SMESH_Comment( _meshID )); // read nb nodes - int nbNodes = std::max( 0, aMed->GetNbNodes( medMeshInfo )); + int nbNodes = Max( 0, aMed->GetNbNodes( medMeshInfo )); if ( nbNodes > 0 ) { setNb( SMDSEntity_Node, nbNodes); @@ -516,7 +528,7 @@ void SMESH_PreMeshInfo::readGroupInfo() map< int, vector< SMESH_PreMeshInfo* > > famId2grInfo; - MED::PWrapper aMed = MED::CrWrapper(_medFileName,false); + MED::PWrapper aMed = MED::CrWrapperR(_medFileName); MED::PMeshInfo medMeshInfo = aMed->CrMeshInfo(3,3,SMESH_Comment( _meshID )); // read families to fill in famId2grInfo @@ -829,8 +841,9 @@ void SMESH_PreMeshInfo::FullLoadFromFile() const meshDS->Modified(); // load dependent meshes referring/referred via hypotheses - mesh.GetSubMesh( mesh.GetShapeToMesh() )-> - ComputeStateEngine (SMESH_subMesh::SUBMESH_LOADED); + SMESH_subMesh* mainSub = mesh.GetSubMesh( mesh.GetShapeToMesh() ); + mainSub->ComputeStateEngine (SMESH_subMesh::SUBMESH_RESTORED); // #16648 + mainSub->ComputeStateEngine (SMESH_subMesh::SUBMESH_LOADED); MYDEBUGOUT( "END FullLoadFromFile()" ); } @@ -939,7 +952,7 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const if ( isNode ) { SMDS_PositionPtr pos = aPositionCreator.MakePosition( smType[ smID ]); SMDS_MeshNode* node = const_cast( static_cast( elem )); - node->SetPosition( pos ); + node->SetPosition( pos, sm->GetID() ); sm->AddNode( node ); } else { sm->AddElement( elem ); @@ -1040,8 +1053,7 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const // -- Most probably a bad study was saved when there were // not fixed bugs in SMDS_MeshInfo if ( aPos->GetTypeOfPosition() == SMDS_TOP_FACE ) { - SMDS_FacePosition* fPos = const_cast - ( static_cast( aPos )); + SMDS_FacePositionPtr fPos = aPos; fPos->SetUParameter( aUPos[ iNode ]); fPos->SetVParameter( aVPos[ iNode ]); } @@ -1049,9 +1061,8 @@ void SMESH_PreMeshInfo::readSubMeshes(DriverMED_R_SMESHDS_Mesh* reader) const else { // ASSERT( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE );-- issue 20182 if ( aPos->GetTypeOfPosition() == SMDS_TOP_EDGE ) { - SMDS_EdgePosition* fPos = const_cast - ( static_cast( aPos )); - fPos->SetUParameter( aUPos[ iNode ]); + SMDS_EdgePositionPtr ePos = aPos; + ePos->SetUParameter( aUPos[ iNode ]); } } }