Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Protection for the case of python command wrapped over several lines
[modules/smesh.git]
/
src
/
StdMeshers
/
StdMeshers_ImportSource.cxx
diff --git
a/src/StdMeshers/StdMeshers_ImportSource.cxx
b/src/StdMeshers/StdMeshers_ImportSource.cxx
index a9d8a8124a391e96ed01a033a9ff0f97c5dfd695..1332432803809fe8f968b4c1e73bf9ff348b7720 100644
(file)
--- a/
src/StdMeshers/StdMeshers_ImportSource.cxx
+++ b/
src/StdMeshers/StdMeshers_ImportSource.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
13
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-20
20
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
//
// 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
// 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
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-20,7
+20,7
@@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SMESH StdMeshers_ImportSource1D : implementaion of SMESH idl descriptions
+// SMESH StdMeshers_ImportSource1D : implementa
t
ion of SMESH idl descriptions
// File : StdMeshers_ImportSource1D.cxx
// Module : SMESH
//
// File : StdMeshers_ImportSource1D.cxx
// Module : SMESH
//
@@
-49,9
+49,8
@@
using namespace std;
//=============================================================================
StdMeshers_ImportSource1D::StdMeshers_ImportSource1D(int hypId,
//=============================================================================
StdMeshers_ImportSource1D::StdMeshers_ImportSource1D(int hypId,
- int studyId,
SMESH_Gen * gen)
SMESH_Gen * gen)
- :SMESH_Hypothesis(hypId,
studyId,
gen),
+ :SMESH_Hypothesis(hypId, gen),
_toCopyMesh(false),
_toCopyGroups(false)
{
_toCopyMesh(false),
_toCopyGroups(false)
{
@@
-66,9
+65,8
@@
StdMeshers_ImportSource1D::StdMeshers_ImportSource1D(int hypId,
//=============================================================================
StdMeshers_ImportSource2D::StdMeshers_ImportSource2D(int hypId,
//=============================================================================
StdMeshers_ImportSource2D::StdMeshers_ImportSource2D(int hypId,
- int studyId,
SMESH_Gen * gen)
SMESH_Gen * gen)
- :StdMeshers_ImportSource1D(hypId,
studyId,
gen)
+ :StdMeshers_ImportSource1D(hypId, gen)
{
_name = "ImportSource2D";
_param_algo_dim = 2; // is used by StdMeshers_Import_2D;
{
_name = "ImportSource2D";
_param_algo_dim = 2; // is used by StdMeshers_Import_2D;
@@
-121,23
+119,28
@@
namespace
//================================================================================
vector<SMESH_Group*> getValidGroups(const vector<SMESH_Group*>& groups,
//================================================================================
vector<SMESH_Group*> getValidGroups(const vector<SMESH_Group*>& groups,
- StudyContextStruct* studyContext)
+ StudyContextStruct* studyContext,
+ bool loaded=false)
{
vector<SMESH_Group*> okGroups;
{
vector<SMESH_Group*> okGroups;
- for (
in
t 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;
{
try
{
// we expect SIGSEGV on a dead group
OCC_CATCH_SIGNALS;
SMESH_Group* okGroup = 0;
- map<int, SMESH_Mesh*>::iterator itm =
itm =
studyContext->mapMesh.begin();
+ map<int, SMESH_Mesh*>::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] )
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];
okGroup = groups[i];
+ if ( loaded )
+ itm->second->Load();
+ }
}
if ( okGroup )
okGroups.push_back( okGroup );
}
if ( okGroup )
okGroups.push_back( okGroup );
@@
-169,7
+172,7
@@
namespace
{
int tgtID = resMapKey.second;
SMESH_Mesh* tgtMesh = 0;
{
int tgtID = resMapKey.second;
SMESH_Mesh* tgtMesh = 0;
- map<int, SMESH_Mesh*>::iterator itm =
itm =
studyContext->mapMesh.begin();
+ map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; !tgtMesh && itm != studyContext->mapMesh.end(); itm++)
{
tgtMesh = (*itm).second;
for ( ; !tgtMesh && itm != studyContext->mapMesh.end(); itm++)
{
tgtMesh = (*itm).second;
@@
-193,14
+196,16
@@
namespace
//=============================================================================
/*!
* Returns groups to import elements from
//=============================================================================
/*!
* Returns groups to import elements from
+ * \param [in] loaded - if \c true, meshes holding the groups are loaded
*/
//=============================================================================
*/
//=============================================================================
-const std::vector<SMESH_Group*>& StdMeshers_ImportSource1D::GetGroups() const
+const std::vector<SMESH_Group*>& StdMeshers_ImportSource1D::GetGroups(
bool loaded
) const
{
// filter off deleted groups
vector<SMESH_Group*> okGroups = getValidGroups( _groups,
{
// filter off deleted groups
vector<SMESH_Group*> okGroups = getValidGroups( _groups,
- _gen->GetStudyContext(_studyId) );
+ _gen->GetStudyContext(),
+ loaded);
if ( okGroups.size() != _groups.size() )
((StdMeshers_ImportSource1D*)this)->_groups = okGroups;
if ( okGroups.size() != _groups.size() )
((StdMeshers_ImportSource1D*)this)->_groups = okGroups;
@@
-240,10
+245,10
@@
std::vector<SMESH_Mesh*> StdMeshers_ImportSource1D::GetSourceMeshes() const
vector<SMESH_Mesh*> meshes;
if ( !meshIDs.empty() )
{
vector<SMESH_Mesh*> meshes;
if ( !meshIDs.empty() )
{
- StudyContextStruct* studyContext = _gen->GetStudyContext(
_studyId
);
+ StudyContextStruct* studyContext = _gen->GetStudyContext();
for ( set<int>::iterator id = meshIDs.begin(); id != meshIDs.end(); ++id )
{
for ( set<int>::iterator id = meshIDs.begin(); id != meshIDs.end(); ++id )
{
- map<int, SMESH_Mesh*>::iterator itm =
itm =
studyContext->mapMesh.begin();
+ map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; itm != studyContext->mapMesh.end(); itm++)
{
SMESH_Mesh* mesh = (*itm).second;
for ( ; itm != studyContext->mapMesh.end(); itm++)
{
SMESH_Mesh* mesh = (*itm).second;
@@
-387,13
+392,13
@@
void StdMeshers_ImportSource1D::RestoreGroups(const std::vector<SMESH_Group*>& g
_groups = groups;
_resultGroups.clear();
_groups = groups;
_resultGroups.clear();
-
in
t i = 0;
+
size_
t i = 0;
while ( i < _resultGroupsStorage.size() )
{
int key1 = _resultGroupsStorage[i++];
int key2 = _resultGroupsStorage[i++];
pair<int, int> resMapKey( key1, key2 );
while ( i < _resultGroupsStorage.size() )
{
int key1 = _resultGroupsStorage[i++];
int key2 = _resultGroupsStorage[i++];
pair<int, int> resMapKey( key1, key2 );
- SMESH_Mesh* mesh = getTgtMeshByKey( resMapKey, _gen->GetStudyContext(
_studyId
));
+ SMESH_Mesh* mesh = getTgtMeshByKey( resMapKey, _gen->GetStudyContext());
// restore mesh ids at least
_resultGroups.insert( make_pair (resMapKey,vector<SMESH_Group*>() ));
// restore mesh ids at least
_resultGroups.insert( make_pair (resMapKey,vector<SMESH_Group*>() ));
@@
-456,7
+461,7
@@
StdMeshers_ImportSource1D::GetResultGroups(const SMESHDS_Mesh& srcMesh,
if ( key2groups == _resultGroups.end() )
return 0;
vector<SMESH_Group*> vec = getValidGroups((*key2groups).second,
if ( key2groups == _resultGroups.end() )
return 0;
vector<SMESH_Group*> vec = getValidGroups((*key2groups).second,
- _gen->GetStudyContext(
_studyId
) );
+ _gen->GetStudyContext() );
if ( vec.size() != key2groups->second.size())
key2groups->second = vec;
if ( vec.size() != key2groups->second.size())
key2groups->second = vec;