X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_PreMeshInfo.cxx;h=38c13009cc5bfc1dffbce082c3a746fedc897753;hp=eb41811700c9713bb246968fba36f683eecfa41f;hb=bfd1d67c062ad9f60bc5315afaaed0d9f272b006;hpb=a1a6d5ddc111fa237d1164fda37ff823a3fac764 diff --git a/src/SMESH_I/SMESH_PreMeshInfo.cxx b/src/SMESH_I/SMESH_PreMeshInfo.cxx index eb4181170..38c13009c 100644 --- a/src/SMESH_I/SMESH_PreMeshInfo.cxx +++ b/src/SMESH_I/SMESH_PreMeshInfo.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -35,6 +35,7 @@ #include "SMDS_VertexPosition.hxx" #include "SMESHDS_Group.hxx" #include "SMESHDS_GroupOnFilter.hxx" +#include "SMESHDS_Mesh.hxx" #include "SMESH_Gen_i.hxx" #include "SMESH_Group_i.hxx" #include "SMESH_Mesh_i.hxx" @@ -286,10 +287,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(); @@ -418,7 +421,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(); @@ -431,7 +444,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 ); } } } @@ -443,7 +456,9 @@ 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 ); } } } @@ -943,7 +958,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 ); @@ -1044,8 +1059,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 ]); } @@ -1053,9 +1067,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 ]); } } }