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 CreateVectorIfEmpty (VECTOR &rVec, unsigned size)
template<typename VECTOR>
void DeleteVector (VECTOR &rVec)
template<typename VECTOR>
VECTOR CopyVector (VECTOR &rVec)
template<typename VECTOR>
void CopyToStdVector (const VECTOR &rSrc, std::vector< double > &rDest)
template<typename VECTOR>
void CopyFromStdVector (const std::vector< double > &rSrc, VECTOR &rDest)
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 CreateVectorIfEmpty (std::vector< double > &rVec, unsigned size)
template<>
void DeleteVector (std::vector< double > &rVec)
template<>
std::vector< double > CopyVector (std::vector< double > &rVec)
template<>
void CopyToStdVector (const std::vector< double > &rSrc, std::vector< double > &rDest)
template<>
void CopyFromStdVector (const std::vector< double > &rSrc, std::vector< double > &rDest)
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 CreateVectorIfEmpty (N_Vector &rVec, unsigned size)
template<>
void DeleteVector (N_Vector &rVec)
template<>
N_Vector CopyVector (N_Vector &rVec)
template<>
void CopyToStdVector (const N_Vector &rSrc, std::vector< double > &rDest)
template<>
void CopyFromStdVector (const std::vector< double > &rSrc, N_Vector &rDest)


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

template<>
void CopyFromStdVector ( const std::vector< double > &  rSrc,
N_Vector &  rDest 
) [inline]

A helper function to copy a std::vector<double> into an N_Vector.

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

Definition at line 389 of file VectorHelperFunctions.hpp.

template<>
void CopyFromStdVector ( const std::vector< double > &  rSrc,
std::vector< double > &  rDest 
) [inline]

Specialisation for std::vector<double>.

Parameters:
rSrc 
rDest 

Definition at line 254 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
void CopyFromStdVector ( const std::vector< double > &  rSrc,
VECTOR &  rDest 
) [inline]

A helper function to copy a std::vector<double> into a VECTOR.

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

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

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

template<>
void CopyToStdVector ( const N_Vector &  rSrc,
std::vector< double > &  rDest 
) [inline]

A helper function to copy an N_Vector into a std::vector<double>.

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

Definition at line 367 of file VectorHelperFunctions.hpp.

template<>
void CopyToStdVector ( const std::vector< double > &  rSrc,
std::vector< double > &  rDest 
) [inline]

Specialisation for std::vector<double>.

Parameters:
rSrc 
rDest 

Definition at line 243 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
void CopyToStdVector ( const VECTOR &  rSrc,
std::vector< double > &  rDest 
) [inline]

A helper function to copy a VECTOR into a std::vector<double>.

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

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

Referenced by AbstractCvodeCell::MakeStdVec(), OdeSolution::rGetDerivedQuantities(), and AbstractParameterisedSystem< VECTOR >::SetDefaultInitialConditions().

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

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 345 of file VectorHelperFunctions.hpp.

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

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 232 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 CreateVectorIfEmpty ( N_Vector &  rVec,
unsigned  size 
) [inline]

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 
size 

Definition at line 318 of file VectorHelperFunctions.hpp.

template<>
void CreateVectorIfEmpty ( std::vector< double > &  rVec,
unsigned  size 
) [inline]

Specialisation for std::vector<double>.

Parameters:
rVec 
size 

Definition at line 210 of file VectorHelperFunctions.hpp.

template<typename VECTOR>
void CreateVectorIfEmpty ( VECTOR &  rVec,
unsigned  size 
) [inline]

If the given vector is empty, set it to have a particular size, allocating memory if necessary. It is a no-op if the vector is non-empty.

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

Parameters:
rVec the empty vector
size the size to create it as

Referenced by AbstractParameterisedSystem< VECTOR >::GetInitialConditions(), and AbstractParameterisedSystem< VECTOR >::SetStateVariables().

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

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 331 of file VectorHelperFunctions.hpp.

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

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 223 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(), AbstractCvodeCell::Init(), AbstractParameterisedSystem< VECTOR >::ResetToInitialConditions(), OdeSolution::rGetDerivedQuantities(), and AbstractCvodeCell::~AbstractCvodeCell().

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

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 
index 

Definition at line 272 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 166 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(), AbstractParameterisedSystem< VECTOR >::GetStateVariable(), and AbstractParameterisedSystem< VECTOR >::SetStateVariables().

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

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 296 of file VectorHelperFunctions.hpp.

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

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 190 of file VectorHelperFunctions.hpp.

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

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

Specialisation for CVODE's N_Vector type.

Parameters:
rVec 

Definition at line 307 of file VectorHelperFunctions.hpp.

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

Specialisation for std::vector<double>.

Parameters:
rVec 

Definition at line 200 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(), and AbstractParameterisedSystem< VECTOR >::GetInitialConditions().

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 285 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 179 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(), AbstractParameterisedSystem< VECTOR >::SetStateVariable(), and AbstractParameterisedSystem< VECTOR >::SetStateVariables().


Generated on Tue May 31 14:31:53 2011 for Chaste by  doxygen 1.5.5