#include <cassert>
#include <vector>
#include <nvector/nvector_serial.h>
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 > | |
VECTOR | CreateEmptyVector () |
template<typename VECTOR > | |
bool | IsEmptyVector (VECTOR &rVec) |
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<> | |
std::vector< double > | CreateEmptyVector () |
template<> | |
bool | IsEmptyVector (std::vector< double > &rVec) |
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<> | |
bool | IsEmptyVector (N_Vector &rVec) |
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) |
std::vector< double > | MakeStdVec (N_Vector v) |
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.
A helper function to copy a std::vector<double> into an N_Vector.
rSrc | source vector | |
rDest | destination vector; must exist and be the correct size |
Definition at line 437 of file VectorHelperFunctions.hpp.
void CopyFromStdVector | ( | const std::vector< double > & | rSrc, | |
std::vector< double > & | rDest | |||
) | [inline] |
Specialisation for std::vector<double>.
rSrc | ||
rDest |
Definition at line 286 of file VectorHelperFunctions.hpp.
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.
rSrc | source vector | |
rDest | destination vector; must exist and be the correct size |
Referenced by AbstractParameterisedSystem< VECTOR >::GetInitialConditions(), and OdeSolution::rGetDerivedQuantities().
A helper function to copy an N_Vector into a std::vector<double>.
rSrc | source vector | |
rDest | destination vector; will be resized and filled |
Definition at line 415 of file VectorHelperFunctions.hpp.
void CopyToStdVector | ( | const std::vector< double > & | rSrc, | |
std::vector< double > & | rDest | |||
) | [inline] |
Specialisation for std::vector<double>.
rSrc | ||
rDest |
Definition at line 275 of file VectorHelperFunctions.hpp.
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.
rSrc | source vector | |
rDest | destination vector; will be resized and filled |
Referenced by MakeStdVec(), OdeSolution::rGetDerivedQuantities(), and AbstractParameterisedSystem< VECTOR >::SetDefaultInitialConditions().
Specialisation for CVODE's N_Vector type.
rVec |
Definition at line 393 of file VectorHelperFunctions.hpp.
Specialisation for std::vector<double>.
rVec |
Definition at line 264 of file VectorHelperFunctions.hpp.
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.
rVec | the vector to copy |
Referenced by AbstractParameterisedSystem< VECTOR >::GetStateVariables().
N_Vector CreateEmptyVector | ( | ) | [inline] |
Specialisation for std::vector<double>.
Specialisation for CVODE's N_Vector type.
Definition at line 359 of file VectorHelperFunctions.hpp.
VECTOR CreateEmptyVector | ( | ) | [inline] |
Helper function to create a new empty/unset vector, useful for defining a default parameter value.
Specialisation for std::vector<double>.
Specialisation for CVODE's N_Vector type.
Definition at line 359 of file VectorHelperFunctions.hpp.
Specialisation for CVODE's N_Vector type.
rVec | ||
size |
Definition at line 347 of file VectorHelperFunctions.hpp.
Specialisation for std::vector<double>.
rVec | ||
size |
Definition at line 223 of file VectorHelperFunctions.hpp.
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.
rVec | the empty vector | |
size | the size to create it as |
Referenced by AbstractParameterisedSystem< VECTOR >::GetInitialConditions(), AbstractCvodeSystem::RecordStoppingPoint(), and AbstractParameterisedSystem< VECTOR >::SetStateVariables().
void DeleteVector | ( | N_Vector & | rVec | ) | [inline] |
Specialisation for CVODE's N_Vector type.
rVec |
Definition at line 379 of file VectorHelperFunctions.hpp.
void DeleteVector | ( | std::vector< double > & | rVec | ) | [inline] |
Specialisation for std::vector<double>.
rVec |
Definition at line 255 of file VectorHelperFunctions.hpp.
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.
rVec | the vector |
Referenced by AbstractParameterisedSystem< VECTOR >::GetAnyVariable(), AbstractCvodeSystem::Init(), AbstractCvodeSystem::ResetSolver(), AbstractParameterisedSystem< VECTOR >::ResetToInitialConditions(), OdeSolution::rGetDerivedQuantities(), and AbstractCvodeSystem::~AbstractCvodeSystem().
Specialisation for CVODE's N_Vector type.
rVec | ||
index |
Definition at line 301 of file VectorHelperFunctions.hpp.
double GetVectorComponent | ( | const std::vector< double > & | rVec, | |
unsigned | index | |||
) | [inline] |
Specialisation for std::vector<double>.
rVec | ||
index |
Definition at line 179 of file VectorHelperFunctions.hpp.
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.
rVec | the vector to access | |
index | the index of the component to get |
Referenced by AbstractParameterisedSystem< VECTOR >::GetAnyVariable(), AbstractParameterisedSystem< VECTOR >::GetParameter(), AbstractParameterisedSystem< VECTOR >::GetStateMessage(), AbstractParameterisedSystem< VECTOR >::GetStateVariable(), AbstractCvodeSystem::RecordStoppingPoint(), AbstractParameterisedSystem< VECTOR >::SetStateVariables(), and AbstractCvodeSystem::SetupCvode().
Specialisation for CVODE's N_Vector type.
rVec |
Definition at line 325 of file VectorHelperFunctions.hpp.
Specialisation for std::vector<double>.
rVec |
Definition at line 203 of file VectorHelperFunctions.hpp.
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.
rVec | the vector |
Referenced by AbstractParameterisedSystem< VECTOR >::GetAnyVariable(), AbstractParameterisedSystem< VECTOR >::GetParameter(), AbstractParameterisedSystem< VECTOR >::GetStateMessage(), AbstractParameterisedSystem< VECTOR >::SetAnyVariable(), AbstractParameterisedSystem< VECTOR >::SetDefaultInitialConditions(), AbstractParameterisedSystem< VECTOR >::SetParameter(), and AbstractParameterisedSystem< VECTOR >::SetStateVariables().
void InitialiseEmptyVector | ( | N_Vector & | rVec | ) | [inline] |
Specialisation for CVODE's N_Vector type.
rVec |
Definition at line 336 of file VectorHelperFunctions.hpp.
void InitialiseEmptyVector | ( | std::vector< double > & | rVec | ) | [inline] |
Specialisation for std::vector<double>.
rVec |
Definition at line 213 of file VectorHelperFunctions.hpp.
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.
rVec | the vector |
Referenced by AbstractParameterisedSystem< VECTOR >::AbstractParameterisedSystem(), and AbstractParameterisedSystem< VECTOR >::GetInitialConditions().
Specialisation for CVODE's N_Vector type.
rVec |
Definition at line 369 of file VectorHelperFunctions.hpp.
Specialisation for std::vector<double>.
rVec |
Definition at line 245 of file VectorHelperFunctions.hpp.
bool IsEmptyVector | ( | VECTOR & | rVec | ) | [inline] |
Helper function to test whether a vector is empty/unset.
rVec | the vector |
Make a standard vector from an N_Vector
v | A CVODE N_Vector to copy the entries from |
Definition at line 460 of file VectorHelperFunctions.hpp.
References CopyToStdVector().
Referenced by AbstractCvodeSystem::Solve().
Specialisation for CVODE's N_Vector type.
rVec | ||
index | ||
value |
Definition at line 314 of file VectorHelperFunctions.hpp.
void SetVectorComponent | ( | std::vector< double > & | rVec, | |
unsigned | index, | |||
double | value | |||
) | [inline] |
Specialisation for std::vector<double>.
rVec | ||
index | ||
value |
Definition at line 192 of file VectorHelperFunctions.hpp.
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.
rVec | the vector to modify | |
index | the index of the component to set | |
value | the new value |
Referenced by AbstractCvodeSystem::RecordStoppingPoint(), AbstractParameterisedSystem< VECTOR >::SetAnyVariable(), AbstractParameterisedSystem< VECTOR >::SetParameter(), AbstractParameterisedSystem< VECTOR >::SetStateVariable(), and AbstractParameterisedSystem< VECTOR >::SetStateVariables().