VectorHelperFunctions.hpp File Reference

#include <cassert>
#include <vector>
#include <nvector/nvector_serial.h>

Include dependency graph for VectorHelperFunctions.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename VECTOR>
double GetVectorComponent (const VECTOR &rVec, unsigned index)
template<typename VECTOR>
void SetVectorComponent (VECTOR &rVec, unsigned index, double value)
template<typename VECTOR>
unsigned GetVectorSize (const VECTOR &rVec)
template<typename VECTOR>
void InitialiseEmptyVector (VECTOR &rVec)
template<typename VECTOR>
void DeleteVector (VECTOR &rVec)
template<typename VECTOR>
VECTOR CopyVector (VECTOR &rVec)
void CopyToStdVector (N_Vector src, std::vector< realtype > &rDest)
void CopyFromStdVector (const std::vector< realtype > &rSrc, N_Vector dest)
template<>
double GetVectorComponent (const std::vector< double > &rVec, unsigned index)
template<>
void SetVectorComponent (std::vector< double > &rVec, unsigned index, double value)
template<>
unsigned GetVectorSize (const std::vector< double > &rVec)
template<>
void InitialiseEmptyVector (std::vector< double > &rVec)
template<>
void DeleteVector (std::vector< double > &rVec)
template<>
std::vector< double > CopyVector (std::vector< double > &rVec)
template<>
double GetVectorComponent (const N_Vector &rVec, unsigned index)
template<>
void SetVectorComponent (N_Vector &rVec, unsigned index, double value)
template<>
unsigned GetVectorSize (const N_Vector &rVec)
template<>
void InitialiseEmptyVector (N_Vector &rVec)
template<>
void DeleteVector (N_Vector &rVec)
template<>
N_Vector CopyVector (N_Vector &rVec)


Detailed Description

A selection of helper functions to be able to access std::vector<double> and CVODE's N_Vector types using the same interface. These are used by AbstractParameterisedSystem and some tests.

Definition in file VectorHelperFunctions.hpp.


Function Documentation

void CopyFromStdVector ( const std::vector< realtype > &  rSrc,
N_Vector  dest 
) [inline]

A helper function to copy a std::vector<double> into an N_Vector. Only exists if CHASTE_CVODE is defined.

Parameters:
rSrc source vector
dest destination vector; must exist and be the correct size

Definition at line 151 of file VectorHelperFunctions.hpp.

Referenced by OdeSolution::rGetDerivedQuantities().

void CopyToStdVector ( N_Vector  src,
std::vector< realtype > &  rDest 
) [inline]

A helper function to copy an N_Vector into a std::vector<double>. Only exists if CHASTE_CVODE is defined.

Parameters:
src source vector
rDest destination vector; will be resized and filled

Definition at line 128 of file VectorHelperFunctions.hpp.

Referenced by OdeSolution::rGetDerivedQuantities().

template<>
N_Vector CopyVector ( N_Vector &  rVec  )  [inline]

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 307 of file VectorHelperFunctions.hpp.

template<>
std::vector<double> CopyVector ( std::vector< double > &  rVec  )  [inline]

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 231 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
VECTOR CopyVector ( VECTOR &  rVec  )  [inline]

Helper function to create a fresh copy of a vector.

This isn't a member so that we can specialise it without having to specialise the whole class.

Parameters:
rVec the vector to copy

Referenced by AbstractParameterisedSystem< VECTOR >::GetStateVariables().

template<>
void DeleteVector ( N_Vector &  rVec  )  [inline]

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 293 of file VectorHelperFunctions.hpp.

template<>
void DeleteVector ( std::vector< double > &  rVec  )  [inline]

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 222 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
void DeleteVector ( VECTOR &  rVec  )  [inline]

Helper function to delete a vector.

This isn't a member so that we can specialise it without having to specialise the whole class.

Parameters:
rVec the vector

Referenced by AbstractParameterisedSystem< VECTOR >::GetAnyVariable(), and OdeSolution::rGetDerivedQuantities().

template<>
double GetVectorComponent ( const N_Vector &  rVec,
unsigned  index 
) [inline]

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 
index 

Definition at line 248 of file VectorHelperFunctions.hpp.

template<>
double GetVectorComponent ( const std::vector< double > &  rVec,
unsigned  index 
) [inline]

Specialisation for std::vector<double>.

Parameters:
rVec 
index 

Definition at line 179 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
double GetVectorComponent ( const VECTOR &  rVec,
unsigned  index 
) [inline]

Helper function to get a vector component.

This isn't a member so that we can specialise it without having to specialise the whole class.

Parameters:
rVec the vector to access
index the index of the component to get

Referenced by AbstractParameterisedSystem< VECTOR >::GetAnyVariable(), AbstractParameterisedSystem< VECTOR >::GetParameter(), and AbstractParameterisedSystem< VECTOR >::GetStateVariable().

template<>
unsigned GetVectorSize ( const N_Vector &  rVec  )  [inline]

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 272 of file VectorHelperFunctions.hpp.

template<>
unsigned GetVectorSize ( const std::vector< double > &  rVec  )  [inline]

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 203 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
unsigned GetVectorSize ( const VECTOR &  rVec  )  [inline]

Helper function to determine a vector's size.

This isn't a member so that we can specialise it without having to specialise the whole class.

Parameters:
rVec the vector
Returns:
its size

Referenced by AbstractParameterisedSystem< VECTOR >::GetAnyVariable(), AbstractParameterisedSystem< VECTOR >::GetNumberOfParameters(), AbstractParameterisedSystem< VECTOR >::GetParameter(), AbstractParameterisedSystem< VECTOR >::SetAnyVariable(), and AbstractParameterisedSystem< VECTOR >::SetParameter().

template<>
void InitialiseEmptyVector ( N_Vector &  rVec  )  [inline]

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 283 of file VectorHelperFunctions.hpp.

template<>
void InitialiseEmptyVector ( std::vector< double > &  rVec  )  [inline]

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 213 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
void InitialiseEmptyVector ( VECTOR &  rVec  )  [inline]

Helper function to initialise a vector to be empty/unset.

This isn't a member so that we can specialise it without having to specialise the whole class.

Parameters:
rVec the vector

Referenced by AbstractParameterisedSystem< VECTOR >::AbstractParameterisedSystem().

template<>
void SetVectorComponent ( N_Vector &  rVec,
unsigned  index,
double  value 
) [inline]

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 
index 
value 

Definition at line 261 of file VectorHelperFunctions.hpp.

template<>
void SetVectorComponent ( std::vector< double > &  rVec,
unsigned  index,
double  value 
) [inline]

Specialisation for std::vector<double>.

Parameters:
rVec 
index 
value 

Definition at line 192 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
void SetVectorComponent ( VECTOR &  rVec,
unsigned  index,
double  value 
) [inline]

Helper function to set a vector component.

This isn't a member so that we can specialise it without having to specialise the whole class.

Parameters:
rVec the vector to modify
index the index of the component to set
value the new value

Referenced by AbstractParameterisedSystem< VECTOR >::SetAnyVariable(), AbstractParameterisedSystem< VECTOR >::SetParameter(), and AbstractParameterisedSystem< VECTOR >::SetStateVariable().


Generated on Mon Apr 18 11:35:40 2011 for Chaste by  doxygen 1.5.5