The goal of this document is to give a global view of the timestepping implementation in SICONOS.
Global Stack
	- Model::initialize
	
		- Topology::initializecalculate relative degrees and number of index sets
- Simulation::initalize
			- EventManager::initializee.g. save data
- DynamicSystem::initialize
- OneStepIntegrator::initialize
- TimeStepping::initLevelMaxdefine number of index sets by Simulation strategy and relative degree of UnitaryRelation
- Topology::indexSetsResizeresizes vector of UnitaryRelationsGraph to include graphs of active UnitaryRelation in specific updateIndexSet method
- Timestepping::initOSNSinitialize position depending index sets and OSNS
 
 
- TimeStepping::computeOneStep -> TimeStepping::advanceToEvent -> TimeStepping::NewtonSolve
- TimeStepping::nextStep
TimeStepping::newtonSolve
  
  	- TimeStepping::computeInitialResidu
- CASE : LINEAR
  		- TimeStepping::prepareNewtonIteration
- TimeStepping::computeFreeState
- TimeStepping::computeOneStepNSProblem(SICONOS_OSNSP_TimeStepping_VELOCITY)
- TimeStepping::(Default)CheckSolverOutput
- TimeStepping::update
- TimeStepping::saveYandLambdaInMemory
- CASE : NONLINEAR -> LOOP WITH INDIVIDUAL STEP :
  		- TimeStepping::prepareNewtonIteration
- TimeStepping::computeFreeState
- TimeStepping::computeOneStepNSProblem(SICONOS_OSNSP_TimeStepping_VELOCITY)
- TimeStepping::(Default)CheckSolverOutput
- TimeStepping::update
- TimeStepping:newtonCheckConvergence
- TimeStepping::saveYandLambdaInMemory
TimeStepping::computeInitialResidu
	- Relation::computeh (virtual) -> Relation::computeOutputcompute local gaps for all Relations
- Relation::computeg (virtual) -> Relation::computeInputcompute local forces for all Relations
- DynamicalSystem::updatePluginsupdate plugin functions for the DynamicalSystem graph
- OneStepIntegrator::computeResidu (virtual)compute the global free residu DS->residuFree and the global residu DS->workFree for all OneStepIntegrators to cope with nonlinearities in velocity equation
- Relation::computeResiduY (virtual)compute the local free residu for output Relations (gaps) to cope their nonlinearities if switched on
TimeStepping::prepareNewtonIteration
	- Moreau::computeWcompute the iteration matrix for OneStepIntegrators
- Relation::computeJach (virtual)compute output Jacobians for all Relations
- Relation::computeJacg (virtual)compute input Jacobians for all Relations
- DynamicalSystem::preparStepprepare the DynamicalSystem graph : only to prepare for external software
- Relation::preparNewtonIterationprepare all Relations : only to prepare for external software
- OneStepNonsmoothProblem::setHasBeUpdatedinform all OneStepNonsmoothProblems about changed topology due to new index sets after Timestepping::nextStep
TimeStepping::computeFreeState
-> OneStepIntegrator::computeFreeState (virtual)
compute the global free state for all OneStepIntegrators in connected DynamicalSystems in DS->workFree
Simulation::computeOneStepNSProblem
-> OneStepNonsmoothProblem::compute (virtual)
solve all OneStepNonsmoothProblems	  		
	- OneStepNonsmoothProblem::preCompute (virtual) -calculate input for numerical solution method from local values (cf. Section 'Building of Numerics Matrix')
- Solve OneStepNonsmoothProbleminterface to numerical solution method
- OneStepNonsmoothProblem::postCompute (virtual)restore local gap and force from numerical solution method output
TimeStepping::(Default)CheckSolverOutput
reaction on numerical solution method flags
			
TimeStepping::update
	- Simulation::updateInput
		- OneStepIntegrator::resetNonsmoothPart (virtual)set global force to zero for all Interactions
- Interaction::computeInput -> Relation::computeInput (virtual)compute global force from local forces for all Interactions
- OneStepIntegrator::updateState (virtual)compute new state for all OneStepIntegrators
- TimeStepping::updateWorldFromDSupdate connected software, e.g. CAD, with new state
- Simulation::updateOutput -> Interaction::computeOutput -> Relation::computeOutput (virtual)compute local gaps from global values for all Interactions
TimeStepping::newtonCheckConvergence
OneStepIntegrator::computeResidu (virtual)
compute the global free residu DS->residuFree and the global residu DS->workFree for all OneStepIntegrators to cope with nonlinearities in velocity equation
Relation::computeResiduY (virtual)
compute the local free residu for output Relations (gaps) to cope their nonlinearities if switched on
Relation::computeResiduR (virtual)
compute the local free residu for input Relations (forces) to cope their nonlinearities if switched on
TimeStepping::saveYandLambdaInMemory
-> Interaction::swapInMemory (virtual)
-> Interaction::swapTimeStepInMemory (virtual)
save local gap and force for having initial guess and possibility to calculate Jacobians in next Newton step
Building of Numerics Matrix
-> OneStepNonsmoothProblem::preCompute
implemented only for LinearOSNS involving LinearOSNS::_M OSNSMatrix, LinearOSNS::_q SiconosVector
	- OneStepNonsmoothProblem::updateUnitaryBlocks
		- OneStepNonsmoothProblem::computeDiagUnitaryBlocks
- OneStepNonsmoothProblem::computeUnitaryBlocks
- OSNSMatrix_M::fill(indexset)
- _keepLambdaAndYState if switched on
- LinearOSNS::computeq -> LinearOSNS::computeqBlock -> OneStepIntegrator::computeFreeOutputnot implemented for Moreau2
TimeStepping::nextStep
-> Simulation::processEvent -> EventsManager::processEvents -> EventsManager::OptimizedProcessEvent
	- TimeDiscretizationEvent::process -> Simulation::saveInMemory
		- OneStepIntegrator::saveInMemory -> DynamicalSystem::swapInMemory (virtual)save state and set global force to zero WHY
- OneStepNonsmoothProblem::saveInMemory -> Interaction::swapInMemory (virtual)
- OneStepNonsmoothProblem::saveTimeStepInMemory -> Interaction::swapTimeStepInMemory (virtual)save local gap and force
- Simulation::updateIndexSetsonly position depending for TimeStepping and Newton loop does not depend on position
		- TimeStepping::updateIndexSet
- Topology::indexSet::update_vertices_indices
- Topology::indexSet::update_edges_indices
- TimeDiscretization::increment
- EventManager::update
TimeSteppingProjectOnConstraints::newtonSolve
projection on position only for NewtonEulerDS with kinetic metric
	- TimeSteppingProjectOnConstraints::newtonSolve
    	- TimeStepping::computeOneStepNSProblem
- NewtonEulerDS::normalizeq
- NewtonEulerDS::updateT
- TimeStepping::updateWorldFromDS
- Relation::computeh
- Relation::computeJach