# File kernel/src/simulationTools/OneStepIntegrator.hpp¶

Go to the source code of this file

Base class (i.e.

common interface) for dynamical system integration over a time step.

class OneStepIntegrator : public std11::enable_shared_from_this<OneStepIntegrator>
#include <OneStepIntegrator.hpp>

Generic class to manage DynamicalSystem(s) time-integration.

!!! This is a virtual class, interface for some specific integrators !!!

At the time, available integrators are:

Attributes access

OSI::TYPES getType() const

id of the integrator (see list in OSI::TYPES enum)

Return

int

SP::DynamicalSystemsGraph dynamicalSystemsGraph() const

get the graph of dynamical systems associated with the Integrator warning: returns the whole ds graph, not only ds integrated by the present osi.

Return

a SP::DynamicalSystemsGraph

void setDynamicalSystemsGraph(SP::DynamicalSystemsGraph dsg)

set the graph of dynamical systems associated with the Integrator

unsigned int getSizeMem() const

get number of internal memory vectors needed in dynamical systems integrated with this osi.

Return

an unsigned int

SP::Simulation simulation() const

get the Simulation that owns the OneStepIntegrator (pointer link)

Return

a pointer to Simulation

void setSimulationPtr(SP::Simulation newS)

set the Simulation of the OneStepIntegrator

Parameters

virtual unsigned int levelMinForOutput()

minimal level required for output var used with this integration scheme.

var[level] is the derivative of order ‘level’ of var.

virtual unsigned int levelMaxForOutput()

maximal level required for output var used with this integration scheme.

var[level] is the derivative of order ‘level’ of var.

virtual unsigned int levelMinForInput()

minimal level required for input var used with this integration scheme.

var[level] is the derivative of order ‘level’ of var.

virtual unsigned int levelMaxForInput()

maximal level required for input var used with this integration scheme.

var[level] is the derivative of order ‘level’ of var.

virtual unsigned int numberOfIndexSets() const = 0

get the number of index sets required for the simulation

Return

unsigned int

internal memory (graph properties) management

bool isInitialized()
void setIsInitialized(bool value)
bool explicitJacobiansOfRelation()
void setExplicitJacobiansOfRelation(bool newval)
virtual void initialize()

initialise the integrator

virtual void initialize_nonsmooth_problems()

Initialization process of the nonsmooth problems linked to this OSI.

virtual void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds) = 0

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

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

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

Computation functions

void update_interaction_output(Interaction &inter, double time, InteractionProperties &interaction_properties)

compute interaction output (y) for all levels and swaps in memory

Parameters
• inter: the interaction to update

• time: value for output computation

• interaction_properties: properties of the interaction, in the Interaction Graph I0

virtual void computeInitialNewtonState()

compute the initial state (for dynamical system variables) of the Newton loop.

virtual double computeResidu()

return the maximum of all norms for the discretized residus of DS

Return

a double

virtual void computeFreeState()

integrates the Dynamical System linked to this integrator, without taking constraints into account.

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

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

Parameters
• vertex_inter: of the interaction graph

• osnsp: pointer to OneStepNSProblem

virtual double computeResiduOutput(double time, SP::InteractionsGraph indexSet)

compute the residu of the output of the relation (y) This computation depends on the type of OSI

Parameters
• time: time of computation

• indexSet: the index set of the interaction that are concerned

virtual double computeResiduInput(double time, SP::InteractionsGraph indexSet)

compute the residu of the input of the relation (R or p) This computation depends on the type of OSI

Parameters
• time: time of computation

• indexSet: the index set of the interaction that are concerned

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

integrate the system, between tinit and tend, with possible stop at tout

Parameters
• tinit: start time

• tend: expected end time

• tout: real end time

• idid: extra flag, meaningful only for OSI used in EventDriven schemes

void resetAllNonSmoothParts()

set to zero all the r vectors of the DynamicalSystems integrated by this OSI

void resetNonSmoothPart(unsigned int level)

set to zero all the r vectors of the DynamicalSystems of the present OSI for a given level

Parameters
• level:

virtual void updateState(const unsigned int level) = 0

update the state of the DynamicalSystem attached to this Integrator

Parameters
• level: level of interest for the dynamics level is set to 0 by default since in all time-stepping schemes we update all the state whatever the value of level

void updateState()

update the state of the DynamicalSystem attached to this Integrator level is set to 0 by default since in all time-stepping schemes we update all the state whatever the value of level

virtual void updateOutput(double time)

update the output of the Interaction attached to this Integrator

virtual void updateInput(double time)

update the input of the Interaction attached to this Integrator

virtual void updateOutput(double time, unsigned int level)

update the output of the Interaction attached to this Integrator

Parameters
• time: current time

• level: level of interest for the dynamics

virtual void updateInput(double time, unsigned int level)

update the input of the Interaction attached to this Integrator

Parameters
• time: current time

• level: level of interest for the dynamics

virtual void prepareNewtonIteration(double time) = 0

Misc

virtual void display() = 0

print the data to the screen

virtual bool addInteractionInIndexSet(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to known if is it should be included in the IndexSet of level i.

Return

bool

Parameters
• inter:

• i:

virtual bool removeInteractionFromIndexSet(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to know if is it should be removed from the IndexSet of level i.

Return

bool

Parameters
• inter:

• i:

SP::ExtraAdditionalTerms extraAdditionalTerms()

Return

void setExtraAdditionalTerms(SP::ExtraAdditionalTerms eat)

Useful when a control loop is added to a DynamicalSystem.

Parameters
• eat: the ExtraAdditionalTerms to use

bool checkOSI(DynamicalSystemsGraph::VIterator dsi)

True if the dynamical system (a vertex in the ds graph) is integrated by this osi.

Parameters
• dsi: the iterator on the node of the graph corresponding to the dynamical system of interest.

bool checkOSI(DynamicalSystemsGraph::VDescriptor dsgv)

True if the dynamical system (a vertex in the ds graph) is integrated by this osi.

Parameters
• dsgv: the descriptor of the node in the graph corresponding to the dynamical system of interest.

Public Functions

virtual ~OneStepIntegrator()

destructor

VIRTUAL_ACCEPT_VISITORS(OneStepIntegrator)

Protected Functions

OneStepIntegrator(const OSI::TYPES &type)

basic constructor with OSI Id

Parameters
• type: integrator type/name

OneStepIntegrator()

default constructor

void _check_and_update_interaction_levels(Interaction &inter)

Compare interaction and current OSI levels for input and output.

Reset interaction if they are not compliant.

Parameters

SP::VectorOfVectors _initializeDSWorkVectors(SP::DynamicalSystem ds)

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

Parameters
• ds: the dynamical system

ACCEPT_SERIALIZATION(OneStepIntegrator)

Protected Attributes

SP::DynamicalSystemsGraph _dynamicalSystemsGraph

a graph of dynamical systems to integrate For the moment, we point to the graph of dynamical systems in the topology.

We use the properties “osi” to check if the dynamical system is integrated by this osi. It has to be improved by using a subgraph to avoid the use of checkOSI

bool _explicitJacobiansOfRelation

boolean variable to force an explicit evaluation of the Jacobians mapping of relations only at the beginning of the timestep and not in the Newton iteration

SP::ExtraAdditionalTerms _extraAdditionalTerms

struct to add terms in the integration.

Useful for Control

OSI::TYPES _integratorType

type/name of the Integrator

bool _isInitialized
unsigned int _levelMaxForInput

_levelMaxForInput is the maximum level for the input needed by the OneStepIntegrator

unsigned int _levelMaxForOutput

_levelMaxForOutput is the maximum level for the output needed by the OneStepIntegrator

unsigned int _levelMinForInput

_levelMinForInput is the minimum level for the input needed by the OneStepIntegrator

unsigned int _levelMinForOutput

_levelMinForOutput is the minimum level for the output needed by the OneStepIntegrator

SP::Simulation _simulation

A link to the simulation that owns this OSI.

unsigned int _sizeMem

size of the memory for the integrator

unsigned int _steps

steps of the integrator

Private Functions

OneStepIntegrator(const OneStepIntegrator&)

copy constructor, private, no copy nor pass-by value allowed

OneStepIntegrator &operator=(const OneStepIntegrator &OSI)

assignment (private => forbidden)

Return
Parameters
• OSI: