OGS 6.2.2-87-g988ee9c30.dirty.20200123122242
MathLib::ODE::detail::FunctionHandlesImpl< N > Struct Template Referencefinal

## Detailed Description

### template<unsigned N> struct MathLib::ODE::detail::FunctionHandlesImpl< N >

Function handles for an ODE system of N equations.

Definition at line 58 of file FunctionHandles.h.

#include <FunctionHandles.h>

Inheritance diagram for MathLib::ODE::detail::FunctionHandlesImpl< N >:
Collaboration diagram for MathLib::ODE::detail::FunctionHandlesImpl< N >:

## Public Member Functions

FunctionHandlesImpl (Function< N > &f, JacobianFunction< N > &df)

bool call (const double t, const double *const y, double *const ydot) override

bool callJacobian (const double t, const double *const y, double *const ydot, double *const jac) override

bool hasJacobian () const override
Tells whether a Jacobian function has been set. More...

unsigned getNumberOfEquations () const override
Returns the number of equations in the ODE system. More...

Public Member Functions inherited from MathLib::ODE::detail::FunctionHandles
virtual ~FunctionHandles ()=default

## Public Attributes

Function< N > f

JacobianFunction< N > df

## ◆ FunctionHandlesImpl()

template<unsigned N>
 MathLib::ODE::detail::FunctionHandlesImpl< N >::FunctionHandlesImpl ( Function< N > & f, JacobianFunction< N > & df )
inline

Definition at line 60 of file FunctionHandles.h.

60  : f(f), df(df)
61  {
62  }

## ◆ call()

template<unsigned N>
 bool MathLib::ODE::detail::FunctionHandlesImpl< N >::call ( const double t, const double *const y, double *const ydot )
inlineoverridevirtual

Calls the stored function f computing .

The raw pointers passed to this method are wrapped in some Eigen::Map objects before being passed to f. Thereby the information about the size of the vectors is restored. No memory is copied for that.

Returns
true or false indicating whether the function succeeded.

Implements MathLib::ODE::detail::FunctionHandles.

Definition at line 72 of file FunctionHandles.h.

74  {
75  if (f)
76  {
77  MappedVector<N> ydot_mapped{ydot};
78  return f(t, MappedConstVector<N>{y}, ydot_mapped);
79  }
80  return false;
81  }

## ◆ callJacobian()

template<unsigned N>
 bool MathLib::ODE::detail::FunctionHandlesImpl< N >::callJacobian ( const double t, const double *const y, double *const ydot, double *const jac )
inlineoverridevirtual

Calls the stored function computing .

Returns
true or false indicating whether the function succeeded.
call()

Implements MathLib::ODE::detail::FunctionHandles.

Definition at line 89 of file FunctionHandles.h.

91  {
92  if (df)
93  {
94  MappedMatrix<N, N> jac_mapped{jac};
95  return df(t,
96  MappedConstVector<N>{y},
97  MappedConstVector<N>{ydot},
98  jac_mapped);
99  }
100  return false;
101  }

## ◆ getNumberOfEquations()

template<unsigned N>
 unsigned MathLib::ODE::detail::FunctionHandlesImpl< N >::getNumberOfEquations ( ) const
inlineoverridevirtual

Returns the number of equations in the ODE system.

Implements MathLib::ODE::detail::FunctionHandles.

Definition at line 104 of file FunctionHandles.h.

104 { return N; }

## ◆ hasJacobian()

template<unsigned N>
 bool MathLib::ODE::detail::FunctionHandlesImpl< N >::hasJacobian ( ) const
inlineoverridevirtual

Tells whether a Jacobian function has been set.

Implements MathLib::ODE::detail::FunctionHandles.

Definition at line 103 of file FunctionHandles.h.

103 { return df != nullptr; }

## ◆ df

template<unsigned N>

Definition at line 106 of file FunctionHandles.h.

## ◆ f

template<unsigned N>

Definition at line 105 of file FunctionHandles.h.

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