Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
Sandals::Solution< Real, N, M > Struct Template Reference

Class container for the numerical solution of a system of ODEs/DAEs. More...

#include <Solution.hh>

Public Types

using Vector = Eigen::Vector<Real, Eigen::Dynamic>
using MatrixN = Eigen::Matrix<Real, N, Eigen::Dynamic>
using MatrixM = Eigen::Matrix<Real, M, Eigen::Dynamic>

Public Member Functions

 Solution ()
 Solution (Integer size)
void resize (Integer size)
void conservative_resize (Integer size)
void clear ()
bool is_empty () const
Integer size () const
std::vector< Real > std_t () const
Vector eig_t () const
std::vector< Real > std_x (Integer i) const
std::map< Integer, std::vector< Real > > std_x () const
std::map< Integer, Vectoreig_x () const
std::map< std::string, std::vector< Real > > std_x (std::vector< std::string > names) const
std::map< std::string, Vectoreig_x (std::vector< std::string > names) const
std::vector< Real > std_h (Integer i) const
std::map< Integer, std::vector< Real > > std_h () const
std::map< Integer, Vectoreig_h () const
std::map< std::string, std::vector< Real > > std_h (std::vector< std::string > names) const
std::map< std::string, Vectoreig_h (std::vector< std::string > names) const

Public Attributes

Vector t
MatrixN x
MatrixM h

Detailed Description

template<typename Real, Integer N, Integer M = 0>
struct Sandals::Solution< Real, N, M >

Class container for the numerical solution of a system of Ordinary Differential Equations (ODEs) or Differential Algebraic Equations (DAEs). The solution is stored in a independent variable (or time) vector, states matrix and invariant matrix, where each row of matrix represents the value of a state/invariant at a given mesh node, i.e.,

\[\begin{array}{l} \mathbf{t} &=& \left[ t_1, t_2, \ldots, t_k \right]^\top \text{,} \\ \mathbf{X} &=& \begin{bmatrix} \mathbf{x}_1 \\ \mathbf{x}_2 \\ \vdots \\ \mathbf{x}_k \end{bmatrix} = \begin{bmatrix} x_{11} & x_{12} & \cdots & x_{1k} \\ x_{21} & x_{22} & \cdots & x_{2k} \\ \vdots & \vdots & \ddots & \vdots \\ x_{n1} & x_{n2} & \cdots & x_{nk} \end{bmatrix} \text{,} \\ \mathbf{H} &=& \begin{bmatrix} \mathbf{h}_1 \\ \mathbf{h}_2 \\ \vdots \\ \mathbf{h}_k \end{bmatrix} = \begin{bmatrix} h_{11} & h_{12} & \cdots & h_{1k} \\ h_{21} & h_{22} & \cdots & h_{2k} \\ \vdots & \vdots & \ddots & \vdots \\ h_{m1} & h_{m2} & \cdots & h_{mk} \end{bmatrix} \text{.} \end{array} \]

Such a solution can be retrieved as standard library vectors or Eigen library vectors.

Template Parameters
RealThe scalar number type.
NThe dimension of the ODE/DAE system.
MThe dimension of the invariants manifold.

Member Typedef Documentation

◆ MatrixM

template<typename Real, Integer N, Integer M = 0>
using Sandals::Solution< Real, N, M >::MatrixM = Eigen::Matrix<Real, M, Eigen::Dynamic>

Templetized matrix type.

◆ MatrixN

template<typename Real, Integer N, Integer M = 0>
using Sandals::Solution< Real, N, M >::MatrixN = Eigen::Matrix<Real, N, Eigen::Dynamic>

Templetized matrix type.

◆ Vector

template<typename Real, Integer N, Integer M = 0>
using Sandals::Solution< Real, N, M >::Vector = Eigen::Vector<Real, Eigen::Dynamic>

Templetized vector type.

Constructor & Destructor Documentation

◆ Solution() [1/2]

template<typename Real, Integer N, Integer M = 0>
Sandals::Solution< Real, N, M >::Solution ( )
inline

Class constructor for the Solution class.

◆ Solution() [2/2]

template<typename Real, Integer N, Integer M = 0>
Sandals::Solution< Real, N, M >::Solution ( Integer size)
inline

Class constructor for the Solution class given the independent variable (or time) and states sizes.

Parameters
[in]sizeThe size of the independent variable (or time) vector and states matrix.

Member Function Documentation

◆ clear()

template<typename Real, Integer N, Integer M = 0>
void Sandals::Solution< Real, N, M >::clear ( )
inline

Clear the independent variable (or time) vector and states matrix.

◆ conservative_resize()

template<typename Real, Integer N, Integer M = 0>
void Sandals::Solution< Real, N, M >::conservative_resize ( Integer size)
inline

Resize conserving the data of the independent variable (or time) vector and states matrix.

Parameters
[in]sizeThe size of the independent variable (or time) vector and states matrix.

◆ eig_h() [1/2]

template<typename Real, Integer N, Integer M = 0>
std::map< Integer, Vector > Sandals::Solution< Real, N, M >::eig_h ( ) const
inline

Get a map of the invariants vectors \( \mathbf{H} \) as Eigen library vectors.

Returns
A map of the invariants vectors as Eigen library vectors.

◆ eig_h() [2/2]

template<typename Real, Integer N, Integer M = 0>
std::map< std::string, Vector > Sandals::Solution< Real, N, M >::eig_h ( std::vector< std::string > names) const
inline

Get a map of the invariants vectors \( \mathbf{H} \) as Eigen library vectors.

Parameters
[in]namesThe names of the invariants vectors.
Returns
A map of the invariants vectors as Eigen library vectors.

◆ eig_t()

template<typename Real, Integer N, Integer M = 0>
Vector Sandals::Solution< Real, N, M >::eig_t ( ) const
inline

Get the independent variable (or time) vector \( \mathbf{t} \) as Eigen library vector.

Returns
The independent variable (or time) vector \( \mathbf{t} \) as Eigen library vector.

◆ eig_x() [1/2]

template<typename Real, Integer N, Integer M = 0>
std::map< Integer, Vector > Sandals::Solution< Real, N, M >::eig_x ( ) const
inline

Get a map of the states vectors \( \mathbf{X} \) as Eigen library vectors.

Returns
A map of the states vectors as Eigen library vectors.

◆ eig_x() [2/2]

template<typename Real, Integer N, Integer M = 0>
std::map< std::string, Vector > Sandals::Solution< Real, N, M >::eig_x ( std::vector< std::string > names) const
inline

Get a map of the states vectors \( \mathbf{X} \) as Eigen library vectors.

Parameters
[in]namesThe names of the states vectors.
Returns
A map of the states vectors as Eigen library vectors.

◆ is_empty()

template<typename Real, Integer N, Integer M = 0>
bool Sandals::Solution< Real, N, M >::is_empty ( ) const
inline

Check if the independent variable (or time) vector and states matrix are empty.

Returns
True if the independent variable (or time) vector and states matrix are empty, false otherwise.

◆ resize()

template<typename Real, Integer N, Integer M = 0>
void Sandals::Solution< Real, N, M >::resize ( Integer size)
inline

Resize the independent variable (or time) vector and states matrix.

Parameters
[in]sizeThe size of the independent variable (or time) vector and states matrix.

◆ size()

template<typename Real, Integer N, Integer M = 0>
Integer Sandals::Solution< Real, N, M >::size ( ) const
inline

Get the size of the independent variable (or time) vector and states matrix.

Returns
The size of the independent variable (or time) vector and states matrix.

◆ std_h() [1/3]

template<typename Real, Integer N, Integer M = 0>
std::map< Integer, std::vector< Real > > Sandals::Solution< Real, N, M >::std_h ( ) const
inline

Get a map of the invariants vectors \( \mathbf{H} \) as standard library vectors.

Returns
A map of the invariants vectors as standard library vectors.

◆ std_h() [2/3]

template<typename Real, Integer N, Integer M = 0>
std::vector< Real > Sandals::Solution< Real, N, M >::std_h ( Integer i) const
inline

Get the \( i \)-th invariants vector \( \mathbf{h}_i \) as a standard library vector.

Parameters
[in]iThe index of the invariant vector.
Returns
The \( i \)-th invariants vector as a standard library vector.

◆ std_h() [3/3]

template<typename Real, Integer N, Integer M = 0>
std::map< std::string, std::vector< Real > > Sandals::Solution< Real, N, M >::std_h ( std::vector< std::string > names) const
inline

Get a map of the invariants vectors \( \mathbf{H} \) as standard vectors.

Parameters
[in]namesThe names of the invariants vectors.
Returns
A map of the invariants vectors as standard vectors.

◆ std_t()

template<typename Real, Integer N, Integer M = 0>
std::vector< Real > Sandals::Solution< Real, N, M >::std_t ( ) const
inline

Get the independent variable (or time) vector \( \mathbf{t} \) as a standard library vector.

Returns
The independent variable (or time) vector \( \mathbf{t} \) as a standard library vector.

◆ std_x() [1/3]

template<typename Real, Integer N, Integer M = 0>
std::map< Integer, std::vector< Real > > Sandals::Solution< Real, N, M >::std_x ( ) const
inline

Get a map of the states vectors \( \mathbf{X} \) as standard library vectors.

Returns
A map of the states vectors as standard library vectors.

◆ std_x() [2/3]

template<typename Real, Integer N, Integer M = 0>
std::vector< Real > Sandals::Solution< Real, N, M >::std_x ( Integer i) const
inline

Get the \( i \)-th state vector \( \mathbf{x}_i \) as a standard library vector.

Parameters
[in]iThe index of the state vector.
Returns
The \( i \)-th state vector as a standard library vector.

◆ std_x() [3/3]

template<typename Real, Integer N, Integer M = 0>
std::map< std::string, std::vector< Real > > Sandals::Solution< Real, N, M >::std_x ( std::vector< std::string > names) const
inline

Get a map of the states vectors \( \mathbf{X} \) as standard vectors.

Parameters
[in]namesThe names of the states vectors.
Returns
A map of the states vectors as standard vectors.

Member Data Documentation

◆ h

template<typename Real, Integer N, Integer M = 0>
MatrixM Sandals::Solution< Real, N, M >::h

Invariants solution matrix \( \mathbf{H} \).

◆ t

template<typename Real, Integer N, Integer M = 0>
Vector Sandals::Solution< Real, N, M >::t

Independent variable (or time) solution vector \( \mathbf{t} \).

◆ x

template<typename Real, Integer N, Integer M = 0>
MatrixN Sandals::Solution< Real, N, M >::x

States solution matrix \( \mathbf{X} \).


The documentation for this struct was generated from the following file: