]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Mon, 29 May 2017 03:05:13 +0000 (22:05 -0500)
committerLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Mon, 29 May 2017 03:05:13 +0000 (22:05 -0500)
lib/fpa/Base/Dijkstra.hxx
lib/fpa/Base/RegionGrow.hxx

index 3584b1ab406a57a282c2b491345840208101522c..b7c10f478a2d6eee59fa04fbc08b0501ca23b4e6 100644 (file)
@@ -137,7 +137,8 @@ GenerateData( )
     // Add neighborhood
     TVertices neighbors = this->_GetNeighbors( node.Vertex );
     typename TVertices::const_iterator neighIt = neighbors.begin( );
-    for( ; neighIt != neighbors.end( ); ++neighIt )
+    bool coll = false;
+    while( neighIt != neighbors.end( ) && !coll )
     {
       TVertex neigh = *neighIt;
       if( this->_IsMarked( neigh ) )
@@ -149,7 +150,11 @@ GenerateData( )
           this->GetNumberOfSeeds( ) > 1 &&
           nColl == 1
           )
+        {
           q.clear( );
+          coll = true;
+
+        } // fi
       }
       else
       {
@@ -171,8 +176,9 @@ GenerateData( )
         } // fi
 
       } // fi
+      ++neighIt;
 
-    } // rof
+    } // elihw
 
   } // elihw
   this->_FreeMarks( );
index b942dfd9eb1fb6f1fb4eb7c6bd6b667f68847388..09fe59a726de35fa761af02f636317ee09db42f6 100644 (file)
@@ -121,7 +121,8 @@ GenerateData( )
     // Add neighborhood
     TVertices neighbors = this->_GetNeighbors( node.first );
     typename TVertices::const_iterator neighIt = neighbors.begin( );
-    for( ; neighIt != neighbors.end( ); ++neighIt )
+    bool coll = false;
+    while( neighIt != neighbors.end( ) && !coll )
     {
       TVertex neigh = *neighIt;
       if( this->_IsMarked( neigh ) )
@@ -133,13 +134,18 @@ GenerateData( )
           this->GetNumberOfSeeds( ) > 1 &&
           nColl == 1
           )
+        {
           while( q.size( ) > 0 )
             q.pop( );
+          coll = true;
+
+        } // fi
       }
       else
         q.push( _TNode( neigh, node.second ) );
+      ++neighIt;
 
-    } // rof
+    } // elihw
 
   } // elihw
   this->_FreeMarks( );