From: akl Date: Fri, 23 May 2014 11:55:57 +0000 (+0400) Subject: Fix of self depending case. X-Git-Tag: V7_5_0a1~50^2~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=30c1376c61e8e9637017df1932c41412bc069b9b;p=modules%2Fgeom.git Fix of self depending case. --- diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index cd667ba7f..e982b12b8 100755 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -3105,7 +3105,9 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, //std::cout << "AKL: add link ior: " << depList[j]->GetEntry() << endl; } //std::cout << "AKL: <<<<<<<< start next step: " << endl; - getUpwardDependency(depList[j], upLevelList, level+1); + if ( !depList[j]->IsSame( gbo ) ) { + getUpwardDependency(depList[j], upLevelList, level+1); + } //std::cout << "AKL: end next step >>>>>>>> : " << endl; } if ( level > 0 ) { @@ -3128,21 +3130,20 @@ void GEOM_Gen_i::getDownwardDependency( SALOMEDS::Study_ptr theStudy, if ( !comp ) return; - GEOMUtils::NodeLinks anIORs; - GEOMUtils::LevelInfo aLevelMap; std::string aGboIOR = gbo->GetEntry(); - if ( level > 0 ) { - if ( level-1 >= downLevelList.size() ) { + cout << "for " << aGboIOR << " at level " << level << endl; + /*if ( level > 0 ) { + if ( level >= downLevelList.size() ) { downLevelList.push_back( aLevelMap ); //std::cout << "AKL: new map" << endl; } else { - aLevelMap = downLevelList.at(level-1); + aLevelMap = downLevelList.at(level); if ( aLevelMap.count( aGboIOR ) > 0 ) { anIORs = aLevelMap[ aGboIOR ]; //std::cout << "AKL: get already added iors list: " << endl; } } - } + }*/ SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator( comp ); for ( it->InitEx( true ); it->More(); it->Next() ) { SALOMEDS::SObject_var child = it->Value(); @@ -3155,20 +3156,40 @@ void GEOM_Gen_i::getDownwardDependency( SALOMEDS::Study_ptr theStudy, if( depList->length() == 0 ) continue; std::string aGoIOR = geomObj->GetEntry(); + //cout << "check " << aGoIOR << endl; for( int i = 0; i < depList->length(); i++ ) { + //cout << "depends on " << depList[i]->GetEntry() << endl; if ( depList[i]->IsSame( gbo ) ) { - if ( level > 0 ) { - anIORs.push_back( geomObj->GetEntry()); + //cout << " the same! " << endl; + //if ( level > 0 ) { + GEOMUtils::NodeLinks anIORs; + GEOMUtils::LevelInfo aLevelMap; + anIORs.push_back( gbo->GetEntry()); + if ( level >= downLevelList.size() ) { + downLevelList.push_back( aLevelMap ); + //std::cout << "AKL: new map" << endl; + } else { + aLevelMap = downLevelList.at(level); + if ( aLevelMap.count( aGoIOR ) > 0 ) { + anIORs = aLevelMap[ aGoIOR ]; + //std::cout << "AKL: get already added iors list: " << endl; + } + } + aLevelMap.insert( std::pair(aGoIOR, anIORs) ); + downLevelList[level] = aLevelMap; + //} + if ( !depList[i]->IsSame( geomObj ) ) { + //cout << " go on! " << endl; + getDownwardDependency(theStudy, geomObj, downLevelList, level+1); } - getDownwardDependency(theStudy, geomObj, downLevelList, level+1); } } } - if ( level > 0 ) { + /*if ( level > 0 ) { aLevelMap.insert( std::pair(aGboIOR, anIORs) ); downLevelList[level-1] = aLevelMap; - } + }*/ } //=====================================================================================