Miind
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MPILib::AlgorithmGrid Class Reference

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

Collaboration diagram for MPILib::AlgorithmGrid:
Collaboration graph

Public Member Functions

 AlgorithmGrid (Number)
 
 AlgorithmGrid (const std::vector< double > &array_state)
 
 AlgorithmGrid (const std::vector< double > &array_state, const std::vector< double > &array_interpretation)
 
AlgorithmGridoperator= (const AlgorithmGrid &rhs)
 
std::vector< double > toInterpretationVector () const
 
std::vector< double > toStateVector () const
 

Private Member Functions

const double * begin_interpretation () const
 
const double * begin_state () const
 
const double * end_interpretation () const
 
const double * end_state () const
 
std::valarray< double > & getArrayInterpretation ()
 
std::valarray< double > & getArrayState ()
 
NumbergetStateSize ()
 
Number getStateSize () const
 
void resize (Number number_of_new_bins)
 
template<class Value >
std::valarray< Value > toValarray (const std::vector< double > &vector) const
 
template<class Value >
std::vector< Value > toVector (const std::valarray< Value > &array, Number number_to_be_copied) const
 

Private Attributes

std::valarray< double > _arrayInterpretation
 
std::valarray< double > _arrayState
 
Number _numberState
 

Friends

template<class WeightValue >
class AlgorithmInterface
 

Detailed Description

AlgorithmGrid.

Stored the internal state of an algorithm

Definition at line 33 of file AlgorithmGrid.hpp.

Constructor & Destructor Documentation

AlgorithmGrid::AlgorithmGrid ( Number  number_of_elements)

Create the state for a AlgorithmGrid with a maximum number of elements

Definition at line 26 of file AlgorithmGrid.cpp.

AlgorithmGrid::AlgorithmGrid ( const std::vector< double > &  array_state)

Create an AlgorithmGrid with just a state (usually a single number)

Parameters
array_stateThe State of the algorithm

Definition at line 32 of file AlgorithmGrid.cpp.

AlgorithmGrid::AlgorithmGrid ( const std::vector< double > &  array_state,
const std::vector< double > &  array_interpretation 
)

Construct an AlgorithmGrid from

Parameters
array_statea state
array_interpretationan interpretation
Postcondition
the size of the state and interpretation array needs to be the same

Definition at line 38 of file AlgorithmGrid.cpp.

References _arrayInterpretation, and _arrayState.

Member Function Documentation

const double * AlgorithmGrid::begin_interpretation ( ) const
private

Definition at line 125 of file AlgorithmGrid.cpp.

References _arrayInterpretation.

const double * AlgorithmGrid::begin_state ( ) const
private

allow iteration over internal values of the state

Definition at line 112 of file AlgorithmGrid.cpp.

References _arrayState.

const double * AlgorithmGrid::end_interpretation ( ) const
private

Definition at line 132 of file AlgorithmGrid.cpp.

References _arrayInterpretation, and _numberState.

const double * AlgorithmGrid::end_state ( ) const
private

Definition at line 119 of file AlgorithmGrid.cpp.

References _arrayState, and _numberState.

std::valarray< double > & AlgorithmGrid::getArrayInterpretation ( )
private

Getter for the array interpretation

Returns
the interpretation array

Definition at line 93 of file AlgorithmGrid.cpp.

References _arrayInterpretation.

Referenced by MPILib::AlgorithmInterface< Weight >::getArrayInterpretation().

std::valarray< double > & AlgorithmGrid::getArrayState ( )
private

Getter for the state array

Returns
the state array

Definition at line 89 of file AlgorithmGrid.cpp.

References _arrayState.

Referenced by MPILib::AlgorithmInterface< Weight >::getArrayState().

Number & AlgorithmGrid::getStateSize ( )
private

Getter for the number of states stored

Returns
number of elements stored

Definition at line 97 of file AlgorithmGrid.cpp.

References _numberState.

Referenced by MPILib::AlgorithmInterface< Weight >::getStateSize().

Number AlgorithmGrid::getStateSize ( ) const
private

const getter for the number of states stored

Returns
number of elements stored

Definition at line 101 of file AlgorithmGrid.cpp.

References _numberState.

AlgorithmGrid & AlgorithmGrid::operator= ( const AlgorithmGrid rhs)

Assignment operator

Parameters
rhsThe assigned AlgorithmGrid
Returns
this

Definition at line 46 of file AlgorithmGrid.cpp.

References _arrayInterpretation, _arrayState, and _numberState.

void AlgorithmGrid::resize ( Number  number_of_new_bins)
private

Resize the arrays of elements

Parameters
number_of_new_binsThe new size of the arrays

Definition at line 106 of file AlgorithmGrid.cpp.

References _arrayInterpretation, and _arrayState.

std::vector< double > AlgorithmGrid::toInterpretationVector ( ) const

Getter for the interpretation vector

Returns
the interpretation vector

Definition at line 66 of file AlgorithmGrid.cpp.

References _arrayInterpretation, _numberState, and toVector().

std::vector< double > AlgorithmGrid::toStateVector ( ) const

Getter for the state vector

Returns
the state vector

Definition at line 61 of file AlgorithmGrid.cpp.

References _arrayState, _numberState, and toVector().

template<class Value >
std::valarray< Value > AlgorithmGrid::toValarray ( const std::vector< double > &  vector) const
private

Helper function to convert vector to valarray

Parameters
vectorto be converted
Returns
a valarray

Definition at line 71 of file AlgorithmGrid.cpp.

template<class Value >
std::vector< Value > AlgorithmGrid::toVector ( const std::valarray< Value > &  array,
Number  number_to_be_copied 
) const
private

Helper function to convert valarray to vector

Parameters
arraythe valarray to be converted
number_to_be_copiedThe number of elements copied
Returns
a vector

Definition at line 77 of file AlgorithmGrid.cpp.

Referenced by toInterpretationVector(), and toStateVector().

Friends And Related Function Documentation

template<class WeightValue >
friend class AlgorithmInterface
friend

Definition at line 75 of file AlgorithmGrid.hpp.

Member Data Documentation

std::valarray<double> MPILib::AlgorithmGrid::_arrayInterpretation
private
std::valarray<double> MPILib::AlgorithmGrid::_arrayState
private
Number MPILib::AlgorithmGrid::_numberState
private

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