X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FBase%2FDijkstraBase.hxx;h=d04ecf56e7bba0299b5190043b423fbc3f0e232b;hb=5c78aecb0f5a207ff020e24f99d1e9bd8c388ad1;hp=a78554b82107e7d746954a8132dc86c77b64e317;hpb=3a438326c6901fafd9be8b5446a828aa5f63a1cc;p=FrontAlgorithms.git diff --git a/lib/fpa/Base/DijkstraBase.hxx b/lib/fpa/Base/DijkstraBase.hxx index a78554b..d04ecf5 100644 --- a/lib/fpa/Base/DijkstraBase.hxx +++ b/lib/fpa/Base/DijkstraBase.hxx @@ -40,26 +40,13 @@ fpa::Base::DijkstraBase< _TAlgorithm >:: { } -// ------------------------------------------------------------------------- -template< class _TAlgorithm > -typename fpa::Base::DijkstraBase< _TAlgorithm >:: -TOutputValue fpa::Base::DijkstraBase< _TAlgorithm >:: -_ComputeOutputValue( const TNode& n ) -{ - TOutputValue c = this->m_WeightFunction->Evaluate( n.Vertex, n.Parent ); - return( c + this->_GetOutputValue( n.Parent ) ); -} - // ------------------------------------------------------------------------- template< class _TAlgorithm > void fpa::Base::DijkstraBase< _TAlgorithm >:: -_QueueInit( ) +_ComputeOutputValue( TNode& n ) { - typedef typename Superclass::TSeedsInterface::TSeeds::iterator _TIt; - - this->Superclass::_QueueInit( ); - for( _TIt sIt = this->BeginSeeds( ); sIt != this->EndSeeds( ); ++sIt ) - sIt->Value = TOutputValue( 0 ); + TOutputValue c = this->m_WeightFunction->Evaluate( n.Vertex, n.Parent ); + n.Value = c + this->_GetOutputValue( n.Parent ); } // ------------------------------------------------------------------------- @@ -109,6 +96,16 @@ _QueueSize( ) const return( this->m_Queue.size( ) ); } +// ------------------------------------------------------------------------- +template< class _TAlgorithm > +void fpa::Base::DijkstraBase< _TAlgorithm >:: +_PrepareSeeds( TNodes& nodes ) +{ + typename TNodes::iterator nIt = nodes.begin( ); + for( ; nIt != nodes.end( ); ++nIt ) + nIt->Value = TOutputValue( 0 ); +} + #endif // __fpa__Base__DijkstraBase__hxx__ // eof - $RCSfile$