X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FFilters%2FDijkstraBase.hxx;fp=lib%2Ffpa%2FFilters%2FDijkstraBase.hxx;h=0000000000000000000000000000000000000000;hb=a8ac405fe1422bc0792a810f7f0693096a22c20e;hp=ae6c6adaf34618a16cbc09c69af8af2620c5bcad;hpb=8abe87eaa0d29ba667d5cbf35f4ca1ca2e38c6c4;p=FrontAlgorithms.git diff --git a/lib/fpa/Filters/DijkstraBase.hxx b/lib/fpa/Filters/DijkstraBase.hxx deleted file mode 100644 index ae6c6ad..0000000 --- a/lib/fpa/Filters/DijkstraBase.hxx +++ /dev/null @@ -1,129 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= -#ifndef __fpa__Filters__DijkstraBase__hxx__ -#define __fpa__Filters__DijkstraBase__hxx__ - -#include -#include - -// ------------------------------------------------------------------------- -template< class _TTraits > -void fpa::Filters::DijkstraBase< _TTraits >:: -SetWeightFunction( TScalarWeight* w ) -{ - if( this->m_ScalarWeight.GetPointer( ) != w ) - { - this->_Deassociate( this->m_ScalarWeight ); - this->m_ScalarWeight = w; - this->_Associate( this->m_ScalarWeight ); - this->Modified( ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -void fpa::Filters::DijkstraBase< _TTraits >:: -SetWeightFunction( TVertexWeight* w ) -{ - if( this->m_VertexWeight.GetPointer( ) != w ) - { - this->_Deassociate( this->m_VertexWeight ); - this->m_VertexWeight = w; - this->_Associate( this->m_VertexWeight ); - this->Modified( ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -fpa::Filters::DijkstraBase< _TTraits >:: -DijkstraBase( ) - : Superclass( ) -{ - this->SetInitValue( TOutputValue( 0 ) ); -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -fpa::Filters::DijkstraBase< _TTraits >:: -~DijkstraBase( ) -{ -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -void fpa::Filters::DijkstraBase< _TTraits >:: -_UpdateOutputValue( TNode& n ) -{ - // Do nothing -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -void fpa::Filters::DijkstraBase< _TTraits >:: -_QueueClear( ) -{ - this->m_Queue.clear( ); -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -typename fpa::Filters::DijkstraBase< _TTraits >:: -TNode fpa::Filters::DijkstraBase< _TTraits >:: -_QueuePop( ) -{ - std::pop_heap( - this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder - ); - TNode n = this->m_Queue.back( ); - this->m_Queue.pop_back( ); - return( n ); -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -void fpa::Filters::DijkstraBase< _TTraits >:: -_QueuePush( const TNode& n ) -{ - bool push_needed = ( n.Parent == n.Vertex ); - push_needed |= !( n.Value < this->_GetOutputValue( n.Parent ) ); - if( push_needed ) - { - this->m_Queue.push_back( n ); - std::push_heap( - this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder - ); - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -unsigned long fpa::Filters::DijkstraBase< _TTraits >:: -_QueueSize( ) const -{ - return( this->m_Queue.size( ) ); -} - -// ------------------------------------------------------------------------- -template< class _TTraits > -void fpa::Filters::DijkstraBase< _TTraits >:: -_ComputeOutputValue( TNode& n ) -{ - if( this->m_VertexWeight.IsNotNull( ) ) - { - TOutputValue c = this->m_VertexWeight->Evaluate( n.Vertex, n.Parent ); - if( this->m_ScalarWeight.IsNotNull( ) ) - c = this->m_ScalarWeight->Evaluate( c ); - n.Value = c + this->_GetOutputValue( n.Parent ); - } - else - n.Value = TOutputValue( -1 ); -} - -#endif // __fpa__Filters__DijkstraBase__hxx__ -// eof - $RCSfile$