File kernel/src/simulationTools/Hem5OSI.hpp

Go to the source code of this file

Hem5OSI solver (from E.

Hairer software lists)

Functions

TYPEDEF_SPTR(Hem5OSI_impl)
class Hem5OSI : public OneStepIntegrator
#include <Hem5OSI.hpp>

Hem5OSI solver (odepack)

Many parameters are required as input/output for LSODAR. See the documentation of this function in externals/odepack/opkdmain.f to have a full description of these parameters.

Most of them are read-only parameters (ie can not be set by user).

Except:

  • jt: Jacobian type indicator (1 means a user-supplied full Jacobian, 2 means an internally generated full Jacobian).

    Default = 2.

  • itol, rtol and atol

    ITOL = an indicator for the type of error control.

    RTOL = a relative error tolerance parameter, either a scalar or array of length NEQ.

    ATOL = an absolute error tolerance parameter, either a scalar or an array of length NEQ. Input only.

Public Types

enum Hem5OSI_ds_workVector_id

Values:

FREE
WORK_LENGTH
enum Hem5OSI_interaction_workBlockVector_id

Values:

xfree
BLOCK_WORK_LENGTH
enum Hem5OSI_interaction_workVector_id

Values:

OSNSP_RHS
WORK_INTERACTION_LENGTH

Public Functions

Hem5OSI()

constructor from a minimum set of data

~Hem5OSI()

destructor

ACCEPT_STD_VISITORS()

visitors hook

virtual void computeFreeOutput(InteractionsGraph::VDescriptor &vertex_inter, OneStepNSProblem *osnsp)

integrates the Interaction linked to this integrator, without taking non-smooth effects into account

Parameters

void computeJacobianRhs(double)

compute jacobian of the rhs at time t for all dynamical systems in the set

void computeRhs(double)

compute rhs(t) for all dynamical systems in the set

void display()

print the data to the screen

void f(integer *sizeOfX, doublereal *time, doublereal *x, doublereal *xdot)
void fillqWork(integer *sizex, doublereal *x)

fill qWork with a doublereal

Parameters
  • sizex: integer*, size of x array
  • x: doublereal* x:array of double

void fillvWork(integer *sizex, doublereal *x)

fill vWork with a doublereal

Parameters
  • sizex: integer*, size of x array
  • x: doublereal* x:array of double

void g(integer *nEq, doublereal *time, doublereal *x, integer *ng, doublereal *gOut)
const SA::doublereal getAtol() const

get absolute tolerance parameter for Hem5

Return
a doublereal*

SA::integer getIwork() const

get iwork

Return
a pointer to integer

int getMaxNstep() const

get the maximum number of steps for one call

Return
an interger

const SA::doublereal getRtol() const

get relative tolerance parameter for Hem5

Return
a doublereal*

const SA::doublereal getRwork() const

get real work vector parameter for lsodar

Return
a doublereal*

void initialize()

initialization of the integrator

void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds)

initialization of the work vectors and matrices (properties) related to one dynamical system on the graph and needed by the osi

Parameters
  • t: time of initialization
  • ds: the dynamical system

void initializeWorkVectorsForInteraction(Interaction &inter, InteractionProperties &interProp, DynamicalSystemsGraph &DSG)

initialization of the work vectors and matrices (properties) related to one interaction on the graph and needed by the osi

Parameters
  • inter: the interaction
  • interProp: the properties on the graph
  • DSG: the dynamical systems graph

const std::vector<integer> intData() const

get vector of integer parameters for lsodar

Return
a vector<integer>

integer intData(unsigned int i) const

get _intData[i]

Return
an integer
Parameters
  • i: index

void integrate(double &tinit, double &tend, double &tout, int &idid)

integrate the system, between tinit and tend (->iout=true), with possible stop at tout (->iout=false)

Parameters
  • tinit: initial time
  • tend: end time
  • tout: real end time
  • idid: in-out parameter, input: 1 for first call, else 2. Output: 2 if no root was found, else 3.

void jacobianfx(integer *, doublereal *, doublereal *, integer *, integer *, doublereal *, integer *)
unsigned int numberOfConstraints()
unsigned int numberOfIndexSets() const

get the number of index sets required for the simulation

Return
unsigned int

void prepareNewtonIteration(double time)
void setIntData(unsigned int i, int newValue)

set _intData[i]

Parameters
  • i: index
  • newValue:

void setMaxNstep(integer nstepmax)

set the maximul number of steps for one call of Hem5OSI

Parameters
  • nstepmax: an integer

void setMaxStepSize(doublereal maxstepsize)

set the minimum and maximum step sizes

Parameters
  • maxstepsize: double (maximul step size)

void setTol(integer itol, SA::doublereal rtol, SA::doublereal atol)

set itol, rtol and atol (tolerance parameters for Hem5)

Parameters
  • itol: integer (itol value)
  • rtol: doublereal * (rtol)
  • atol: doublereal * (atol)

void setTol(integer itol, doublereal rtol, doublereal atol)

set itol, rtol and atol (scalar tolerance parameters for Hem5)

Parameters
  • itol: integer (itol value)
  • rtol: double (rtol)
  • atol: double (atol)

void updateData()

update doubleData and iwork memory size, when changes occur in _intData.

void updateIntData()

update _intData

void updateState(const unsigned int level)

update the state of the DynamicalSystems attached to this Integrator

Parameters
  • level: level of interest for the dynamics

Public Members

SP::Hem5OSI_impl _impl

Private Functions

ACCEPT_SERIALIZATION(Hem5OSI)

serialization hooks

Private Members

SP::SiconosVector _atmp
SP::BlockVector _aWork

temporary vector to save a values

SP::SiconosVector _forcestmp
SP::BlockVector _forcesWork

temporary vector to save forces values

integer _idid
std::vector<integer> _intData

vector of integer data for the integrator _intData[0] NQ size of the position vector q _intData[1] NV size of the velocity vector v NQ >= NQ _intData[2] NU size of the external dynamic vector u _intData[3] NL size of the Lagrange multiplier vector lambda _intData[4] ITOL indicates whether RTOL and ATOL are scalar (ITOL=0), or array of dimension NQ + NV + NU (ITOL=1) _intData[5] IOUT selects the dense output formula _intData[6] LWK length of real array rwork _intData[7] LIWK length of integer array iwork See hem5.f

SP::SiconosVector _lambdatmp
SP::BlockVector _lambdaWork

temporary vector to save lambda values

SP::SiconosVector _qtmp
SP::BlockVector _qWork

temporary vector to save q values

doublereal _timeStep
SP::SiconosVector _utmp
SP::BlockVector _uWork

temporary vector to save v values

SP::SiconosVector _vtmp
SP::BlockVector _vWork

temporary vector to save v values

SA::doublereal atol

absolute tolerance

SA::integer iwork

integer work array

SA::doublereal rtol

relative tolerance

SA::doublereal rwork

real work array

Friends

friend _NSLEffectOnFreeOutput
friend Hem5OSI_impl