Miind
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MPILib::algorithm::DelayAlgorithm< Weight > Class Template Reference

#include <libs/MPILib/include/DelayAlgorithm.hpp>

Inheritance diagram for MPILib::algorithm::DelayAlgorithm< Weight >:
Inheritance graph
Collaboration diagram for MPILib::algorithm::DelayAlgorithm< Weight >:
Collaboration graph

Public Types

typedef Weight WeightType
 

Public Member Functions

 DelayAlgorithm (Time t_delay)
 
virtual ~DelayAlgorithm ()
 
virtual DelayAlgorithm< Weight > * clone () const
 
virtual void configure (const SimulationRunParameter &simParam)
 
virtual void evolveNodeState (const std::vector< Rate > &nodeVector, const std::vector< Weight > &weightVector, Time time)
 
virtual void evolveNodeState (const std::vector< Rate > &nodeVector, const std::vector< Weight > &weightVector, Time time, const std::vector< NodeType > &typeVector)
 
std::valarray< double > & getArrayInterpretation (AlgorithmGrid &grid) const
 
std::valarray< double > & getArrayState (AlgorithmGrid &grid) const
 
virtual Rate getCurrentRate () const
 
virtual Time getCurrentTime () const
 
Time getDelayTime () const
 
virtual AlgorithmGrid getGrid (NodeId, bool b_state) const
 
NumbergetStateSize (AlgorithmGrid &grid) const
 
Number getStateSize (const AlgorithmGrid &grid) const
 
virtual void prepareEvolve (const std::vector< Rate > &nodeVector, const std::vector< Weight > &weightVector, const std::vector< NodeType > &typeVector)
 

Private Types

typedef std::pair< Rate, Timerate_time_pair
 

Private Member Functions

Rate CalculateDelayedRate ()
 
Rate Interpolate () const
 

Private Attributes

std::deque< rate_time_pair_queue
 
Rate _rate_current
 
Time _t_current
 
Time _t_delay
 

Detailed Description

template<class Weight>
class MPILib::algorithm::DelayAlgorithm< Weight >

This algorithm is effectively a pipeline with a preselected delay.

In some simulations connections must be implemented with time delays. If that needs to be done with high precision, create a node, configure it with a DelayAlgorithm, connected the output to be delayed to this node and connect the output of this node to the node specified by the original connection. At the moment this is the only way to implement delays. Please note that it is expected that the node that carries this algorithm expects one and only one input node.

Definition at line 43 of file DelayAlgorithm.hpp.

Member Typedef Documentation

template<class Weight>
typedef std::pair<Rate, Time> MPILib::algorithm::DelayAlgorithm< Weight >::rate_time_pair
private

Definition at line 109 of file DelayAlgorithm.hpp.

typedef Weight MPILib::AlgorithmInterface< Weight >::WeightType
inherited

Definition at line 41 of file AlgorithmInterface.hpp.

Constructor & Destructor Documentation

template<class Weight >
MPILib::algorithm::DelayAlgorithm< Weight >::DelayAlgorithm ( Time  t_delay)

Create algorithm with a delay time

Parameters
t_delayThe delay time

Definition at line 31 of file DelayAlgorithmCode.hpp.

template<class Weight >
MPILib::algorithm::DelayAlgorithm< Weight >::~DelayAlgorithm ( )
virtual

virtual destructor

Definition at line 37 of file DelayAlgorithmCode.hpp.

Member Function Documentation

template<class Weight >
Rate MPILib::algorithm::DelayAlgorithm< Weight >::CalculateDelayedRate ( )
private

Definition at line 91 of file DelayAlgorithmCode.hpp.

References i.

template<class Weight >
DelayAlgorithm< Weight > * MPILib::algorithm::DelayAlgorithm< Weight >::clone ( ) const
virtual

Cloning operation, to provide each DynamicNode with its own Algorithm instance. Clients use the naked pointer at their own risk.

Implements MPILib::AlgorithmInterface< Weight >.

Definition at line 41 of file DelayAlgorithmCode.hpp.

template<class Weight >
void MPILib::algorithm::DelayAlgorithm< Weight >::configure ( const SimulationRunParameter simParam)
virtual

Configure the Algorithm

Parameters
simParamThe simulation parameter

Implements MPILib::AlgorithmInterface< Weight >.

Definition at line 45 of file DelayAlgorithmCode.hpp.

References MPILib::SimulationRunParameter::getTBegin().

template<class Weight >
void MPILib::algorithm::DelayAlgorithm< Weight >::evolveNodeState ( const std::vector< Rate > &  nodeVector,
const std::vector< Weight > &  weightVector,
Time  time 
)
virtual

Evolve the node state. Overwrite this method if your algorithm does not need to know the NodeTypes.

Parameters
nodeVectorVector of the node States. If the size its different from 1, results are undefined. In Debug builds an assert will be triggered.
weightVectorVector of the weights of the nodes. It must have length one. The numerial value of the weight will be ignored.
timeTime point of the algorithm

Reimplemented from MPILib::AlgorithmInterface< Weight >.

Definition at line 50 of file DelayAlgorithmCode.hpp.

virtual void MPILib::AlgorithmInterface< Weight >::evolveNodeState ( const std::vector< Rate > &  nodeVector,
const std::vector< Weight > &  weightVector,
Time  time,
const std::vector< NodeType > &  typeVector 
)
inlinevirtualinherited

Evolve the node state. In the default case it simply calls envolveNodeState without the NodeTypes. However if an algorithm needs the nodeTypes of the precursors overwrite this function.

Parameters
nodeVectorVector of the node States
weightVectorVector of the weights of the nodes
timeTime point of the algorithm
typeVectorVector of the NodeTypes of the precursors

Definition at line 83 of file AlgorithmInterface.hpp.

References MPILib::AlgorithmInterface< WeightValue >::evolveNodeState().

std::valarray<double>& MPILib::AlgorithmInterface< Weight >::getArrayInterpretation ( AlgorithmGrid grid) const
inlineinherited
std::valarray<double>& MPILib::AlgorithmInterface< Weight >::getArrayState ( AlgorithmGrid grid) const
inlineinherited

Definition at line 120 of file AlgorithmInterface.hpp.

References MPILib::AlgorithmGrid::getArrayState().

template<class Weight >
Rate MPILib::algorithm::DelayAlgorithm< Weight >::getCurrentRate ( ) const
virtual

The calculated rate of the node

Returns
The rate of the node

Implements MPILib::AlgorithmInterface< Weight >.

Definition at line 79 of file DelayAlgorithmCode.hpp.

template<class Weight >
Time MPILib::algorithm::DelayAlgorithm< Weight >::getCurrentTime ( ) const
virtual

The current time

Returns
The current time

Implements MPILib::AlgorithmInterface< Weight >.

Definition at line 74 of file DelayAlgorithmCode.hpp.

template<class Weight>
Time MPILib::algorithm::DelayAlgorithm< Weight >::getDelayTime ( ) const
inline

Gets the delay time determining this algorithm. Does not need to be virtual, as it is not part of the AlgorithmInterface

Definition at line 101 of file DelayAlgorithm.hpp.

References MPILib::algorithm::DelayAlgorithm< Weight >::_t_delay.

template<class Weight >
AlgorithmGrid MPILib::algorithm::DelayAlgorithm< Weight >::getGrid ( NodeId  ,
bool  b_state 
) const
virtual

Stores the algorithm state in a Algorithm Grid

Returns
The state of the algorithm

Implements MPILib::AlgorithmInterface< Weight >.

Definition at line 85 of file DelayAlgorithmCode.hpp.

Number& MPILib::AlgorithmInterface< Weight >::getStateSize ( AlgorithmGrid grid) const
inlineinherited

Definition at line 130 of file AlgorithmInterface.hpp.

References MPILib::AlgorithmGrid::getStateSize().

Number MPILib::AlgorithmInterface< Weight >::getStateSize ( const AlgorithmGrid grid) const
inlineinherited

Definition at line 135 of file AlgorithmInterface.hpp.

References MPILib::AlgorithmGrid::getStateSize().

template<class Weight >
Rate MPILib::algorithm::DelayAlgorithm< Weight >::Interpolate ( ) const
private

Definition at line 105 of file DelayAlgorithmCode.hpp.

virtual void MPILib::AlgorithmInterface< Weight >::prepareEvolve ( const std::vector< Rate > &  nodeVector,
const std::vector< Weight > &  weightVector,
const std::vector< NodeType > &  typeVector 
)
inlinevirtualinherited

prepare the Evolve method

Parameters
nodeVectorVector of the node States
weightVectorVector of the weights of the nodes
typeVectorVector of the NodeTypes of the precursors

Definition at line 95 of file AlgorithmInterface.hpp.

Member Data Documentation

template<class Weight>
std::deque<rate_time_pair> MPILib::algorithm::DelayAlgorithm< Weight >::_queue
private

Definition at line 115 of file DelayAlgorithm.hpp.

template<class Weight>
Rate MPILib::algorithm::DelayAlgorithm< Weight >::_rate_current
private

Definition at line 113 of file DelayAlgorithm.hpp.

template<class Weight>
Time MPILib::algorithm::DelayAlgorithm< Weight >::_t_current
private

Definition at line 111 of file DelayAlgorithm.hpp.

template<class Weight>
Time MPILib::algorithm::DelayAlgorithm< Weight >::_t_delay
private

The documentation for this class was generated from the following files: