X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_ImportSource.cxx;h=0ee9c4b4130e3c4d3a657be6f6de35863f08739d;hb=41b3e4433388f439856c3b0bb3725e9c81179c24;hp=a9d8a8124a391e96ed01a033a9ff0f97c5dfd695;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_ImportSource.cxx b/src/StdMeshers/StdMeshers_ImportSource.cxx index a9d8a8124..0ee9c4b41 100644 --- a/src/StdMeshers/StdMeshers_ImportSource.cxx +++ b/src/StdMeshers/StdMeshers_ImportSource.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 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 @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -121,23 +121,28 @@ namespace //================================================================================ vector getValidGroups(const vector& groups, - StudyContextStruct* studyContext) + StudyContextStruct* studyContext, + bool loaded=false) { vector okGroups; - for ( int i = 0; i < groups.size(); ++i ) + for ( size_t i = 0; i < groups.size(); ++i ) { try { // we expect SIGSEGV on a dead group OCC_CATCH_SIGNALS; SMESH_Group* okGroup = 0; - map::iterator itm = itm = studyContext->mapMesh.begin(); + map::iterator itm = studyContext->mapMesh.begin(); for ( ; !okGroup && itm != studyContext->mapMesh.end(); itm++) { SMESH_Mesh::GroupIteratorPtr gIt = itm->second->GetGroups(); while ( gIt->more() && !okGroup ) if ( gIt->next() == groups[i] ) + { okGroup = groups[i]; + if ( loaded ) + itm->second->Load(); + } } if ( okGroup ) okGroups.push_back( okGroup ); @@ -169,7 +174,7 @@ namespace { int tgtID = resMapKey.second; SMESH_Mesh* tgtMesh = 0; - map::iterator itm = itm = studyContext->mapMesh.begin(); + map::iterator itm = studyContext->mapMesh.begin(); for ( ; !tgtMesh && itm != studyContext->mapMesh.end(); itm++) { tgtMesh = (*itm).second; @@ -193,14 +198,16 @@ namespace //============================================================================= /*! * Returns groups to import elements from + * \param [in] loaded - if \c true, meshes holding the groups are loaded */ //============================================================================= -const std::vector& StdMeshers_ImportSource1D::GetGroups() const +const std::vector& StdMeshers_ImportSource1D::GetGroups(bool loaded) const { // filter off deleted groups vector okGroups = getValidGroups( _groups, - _gen->GetStudyContext(_studyId) ); + _gen->GetStudyContext(_studyId), + loaded); if ( okGroups.size() != _groups.size() ) ((StdMeshers_ImportSource1D*)this)->_groups = okGroups; @@ -243,7 +250,7 @@ std::vector StdMeshers_ImportSource1D::GetSourceMeshes() const StudyContextStruct* studyContext = _gen->GetStudyContext(_studyId); for ( set::iterator id = meshIDs.begin(); id != meshIDs.end(); ++id ) { - map::iterator itm = itm = studyContext->mapMesh.begin(); + map::iterator itm = studyContext->mapMesh.begin(); for ( ; itm != studyContext->mapMesh.end(); itm++) { SMESH_Mesh* mesh = (*itm).second; @@ -387,7 +394,7 @@ void StdMeshers_ImportSource1D::RestoreGroups(const std::vector& g _groups = groups; _resultGroups.clear(); - int i = 0; + size_t i = 0; while ( i < _resultGroupsStorage.size() ) { int key1 = _resultGroupsStorage[i++];