File kernel/src/simulationTools/OneStepNSProblem.hpp#
Go to the source code of this file
Interface to formalize and solve Non-Sooth problems.
-
class OneStepNSProblem
- #include <OneStepNSProblem.hpp>
Non Smooth Problem Formalization and Simulation.
This is an abstract class, that provides an interface to define a non smooth problem:
a formulation (ie the way the problem is written)
a solver (algorithm and solving formulation, that can be different from problem formulation)
routines to compute the problem solution.
Two types of problem formulation are available :
Quadratic Problem
Linear Problem
See derived classes (QP and LinearOSNS) for details.
For Linear problems, the following formulations exists:
Linear Complementarity (LCP)
Mixed Linear Complementarity (MLCP)
Affine Variational Inequalities (AVI)
The usual way to build and initialize a one-step nonsmooth problem is :
call constructor with the id of the required Numerics solver. (see Solver class or Numerics documentation for details on algorithm name and parameters).
initialize(simulation) Initialize process is usually done through model->initialize(simulation). See Examples for practical details.
Options for Numerics and the driver for solvers
When the Numerics driver is called a set of solver options (name, tolerance, max. number of iterations …) is required –> SolverOptions.
Default values are always set in solver options the OneStepNSProblem is built but if you need to set them yourself, please check Users’guide, Numerics solvers part.
Subclassed by LinearOSNS, QP
Public Functions
-
inline OneStepNSProblem(SP::SolverOptions options)
constructor from a pre-defined solver options set.
- Parameters:
options – the options set
-
inline virtual ~OneStepNSProblem()
destructor
-
inline SP::SolverOptions numericsSolverOptions() const
To get the SolverOptions structure.
- Returns:
, the numerics structure used to save solver parameters
-
inline unsigned int getSizeOutput() const
returns the dimension of the nonsmooth problem
-
inline SP::Simulation simulation() const
get the simulation which owns this nonsmooth problem
- Returns:
a pointer on Simulation
-
inline void setSimulationPtr(SP::Simulation newS)
set the Simulation of the OneStepNSProblem
- Parameters:
newS – a pointer to Simulation
-
inline unsigned int indexSetLevel() const
get indexSetLevel
- Returns:
an unsigned int
-
inline void setIndexSetLevel(unsigned int newVal)
set the value of level min
- Parameters:
newVal – an unsigned int
-
inline unsigned int inputOutputLevel() const
get the Input/Output level
- Returns:
an unsigned int
-
inline void setInputOutputLevel(unsigned int newVal)
set the value of Input/Output level
- Parameters:
newVal – an unsigned int
-
inline unsigned int maxSize() const
get maximum value allowed for the dimension of the problem
- Returns:
an unsigned int
-
inline void setMaxSize(const unsigned int newVal)
set the value of maxSize
- Parameters:
newVal – an unsigned int
-
void setNumericsVerboseMode(bool vMode)
Turn on/off verbose mode in numerics solver.
-
void setNumericsVerboseLevel(int level)
set the verbose level in numerics solver
-
bool hasInteractions() const
Check if the OSNSPb has interactions.
- Returns:
bool = true if the osnsp has interactions, i.e. indexSet(_indexSetLevel)->size >0
-
inline virtual void display() const#
-
virtual void displayBlocks(SP::InteractionsGraph indexSet)
Display the set of blocks for a given indexSet.
- Parameters:
indexSet – the concerned index set
-
virtual void updateInteractionBlocks()
compute interactionBlocks if necessary (this depends on the type of OSNS, on the indexSets …)
-
virtual void computeInteractionBlock(const InteractionsGraph::EDescriptor &ed) = 0
compute extra-diagonal interactionBlock-matrix
- Parameters:
ed – an edge descriptor
-
virtual void computeDiagonalInteractionBlock(const InteractionsGraph::VDescriptor &vd) = 0
compute diagonal Interaction block
- Parameters:
vd – a vertex descriptor
-
inline bool hasBeenUpdated()
- Returns:
bool _hasBeenUpdated
-
inline void setHasBeenUpdated(bool v)
turn activation flag
- Parameters:
v – to set _hasBeenUpdated.
-
virtual void initialize(SP::Simulation sim)
initialize the problem (topology and so on)
- Parameters:
sim – the simulation that owns this OSNSPB
-
virtual bool preCompute(double time) = 0
prepare data of the osns for solving
- Parameters:
time – the current time
- Returns:
true if the computation of the OSNS has to be carry on, false otherwise
-
virtual int compute(double time) = 0
To run the solver for ns problem.
- Parameters:
time – current time
- Returns:
int information about the solver convergence.
-
virtual void postCompute() = 0
post treatment for output of the solver
-
void setSolverId(int solverId)
change the solver type and its default parameters
clear memory for the existing options set
create and initialize a new one
- Parameters:
solverId – the new solver
-
SP::SimpleMatrix getOSIMatrix(OneStepIntegrator &osi, SP::DynamicalSystem ds)
get the OSI-related matrices used to compute the current InteractionBlock (Ex: for MoreauJeanOSI, W)
- Parameters:
osi – the OSI of the concerned dynamical system
ds – the concerned dynamical system
- Returns:
the required matrix
-
VIRTUAL_ACCEPT_VISITORS(OneStepNSProblem)#
Protected Functions
-
ACCEPT_SERIALIZATION(OneStepNSProblem)#
-
OneStepNSProblem() = default#
default constructor
Protected Attributes
-
unsigned int _sizeOutput = 0#
size of the nonsmooth problem
-
unsigned int _indexSetLevel = 0#
level of index sets that is considered by this osnsp
-
unsigned int _inputOutputLevel = 0#
level of input and output variables of the nonsmooth problems.
We consider that the osnsp computes y[_inputOutputLevel] and lambda[_inputOutputLevel]
-
unsigned int _maxSize = 0#
maximum value for sizeOutput.
Set to the number of declared constraints by default (topology->getNumberOfConstraints()); This value is used to allocate memory for M during initialize call. The best choice is to set maxSize to the estimated maximum dimension of the problem. It must not exceed …
-
std::set<float> _nslawtype#
-
bool _hasBeenUpdated = false#
Private Functions
-
OneStepNSProblem(const OneStepNSProblem&) = delete#
-
OneStepNSProblem &operator=(const OneStepNSProblem&) = delete#