File kernel/src/simulationTools/LinearOSNS.hpp#

Go to the source code of this file

Linear Complementarity Problem formulation and solving.

Typedefs

typedef std::vector<double> MuStorage#

stl vector of double

Enums

enum LINEAROSNS_ASSEMBLY_TYPE#

Values:

enumerator REDUCED_BLOCK#
enumerator GLOBAL#
enumerator REDUCED_DIRECT#
enumerator GLOBAL_REDUCED#
class LinearOSNS : public OneStepNSProblem
#include <LinearOSNS.hpp>

Base (abstract) class for linear non-smooth problems.

Usually in the form:

\( w = q + M z \)

where

  • \( w \in R^{n} \) and \( z \in R^{n} \) are the unknowns,

  • \( M \in R^{n \times n } \) and \( q \in R^{n} \)

examples: LCP, FrictionContact

Subclassed by AVI, Equality, FrictionContact, GenericMechanical, GlobalFrictionContact, LCP, MLCP, MultipleImpact, Relay, RollingFrictionContact

Public Functions

inline LinearOSNS(SP::SolverOptions options, LINEAROSNS_ASSEMBLY_TYPE assemblyType = REDUCED_BLOCK)

constructor from a pre-defined solver options set.

Parameters:
  • options – the options set

  • assemblytype – the method used to build the assembled matrix - default=REDUCED_BLOCK

inline virtual ~LinearOSNS()

destructor

inline const SiconosVector getW() const

copy of the current value of vector w

Returns:

a SiconosVector

inline SP::SiconosVector w() const

current w vector (pointer link)

Returns:

pointer on a SiconosVector

inline void setWPtr(SP::SiconosVector newPtr)

set w vector (pointer link)

Parameters:

newPtr – the new SP::SiconosVector

inline const SiconosVector getz() const

copy of the current value of vector z

Returns:

a SiconosVector

inline SP::SiconosVector z() const

current z vector (pointer link)

Returns:

pointer on a SiconosVector

inline void setzPtr(SP::SiconosVector newPtr)

set z vector (pointer link)

Parameters:

newPtr – the new SP::SiconosVector

inline SP::OSNSMatrix M() const

M matrix (pointer link)

Returns:

pointer on a OSNSMatrix

inline void setMPtr(SP::OSNSMatrix newM)

set M to pointer newPtr

Parameters:

newM – the new M matrix

inline SP::OSNSMatrix H() const

get H

Returns:

pointer on a OSNSMatrix

inline void setH(SP::OSNSMatrix H)

set the value of H

Parameters:

H – the new matrix

inline const SiconosVector getQ() const

get the value of q, the constant vector in the LinearOSNS

Returns:

SiconosVector

inline SP::SiconosVector q() const

get q, the the constant vector in the LinearOSNS

Returns:

pointer on a SiconosVector

inline void setQPtr(SP::SiconosVector newQ)

set q to pointer newPtr

Parameters:

newQ – the new q vector

inline NM_types getMStorageType() const

get the type of storage used for M

Returns:

NM_types (NM_DENSE, NM_SPARSE_BLOCK)

inline void setMStorageType(NM_types i)

set which type of storage will be used for M

Warning

this function does not allocate any memory for M, it just sets an indicator for future use

Parameters:

i – (NM_DENSE, NM_SPARSE_BLOCK)

inline void setAssemblyType(LINEAROSNS_ASSEMBLY_TYPE assemblyType)

set which type of assembly will be used for M

void initVectorsMemory()

Memory allocation or resizing for z,w,q.

virtual void initOSNSMatrix()

initialize the _M matrix

virtual void initialize(SP::Simulation sim) override

To initialize the LinearOSNS problem(computes topology …)

Parameters:

sim – the simulation owning this OSNSPB

virtual void computeInteractionBlock(const InteractionsGraph::EDescriptor &ed) override

compute extra-diagonal interactionBlock-matrix

Parameters:

ed – an edge descriptor

virtual void computeDiagonalInteractionBlock(const InteractionsGraph::VDescriptor &vd) override

compute diagonal Interaction block

Parameters:

vd – a vertex descriptor

virtual void computeM()

compute matrix M

virtual void computeqBlock(InteractionsGraph::VDescriptor &vertex, unsigned int pos)

To compute a part of the q vector of the OSNS.

Parameters:
  • vertex – vertex (interaction) which corresponds to the considered block

  • pos – the position of the first element of yOut to be set

virtual void computeq(double time)

compute vector q

Parameters:

time – the current time

virtual bool preCompute(double time) override

build problem coefficients (if required)

Parameters:

time – the current time

Returns:

true if the indexSet is not empty

virtual void postCompute() override

update interactions variables (y and lambda) according to current problem found solutions.

virtual void display() const override

print the data to the screen

inline void setKeepLambdaAndYState(bool val)

choose initialisation behavior for w and z.

Parameters:

val – true: init w and z with previous values of y and lambda saved in interactions, false: init to 0.

virtual bool checkCompatibleNSLaw(NonSmoothLaw &nslaw) = 0#
ACCEPT_STD_VISITORS()#

Protected Functions

ACCEPT_SERIALIZATION(LinearOSNS)#
LinearOSNS() = default#

default constructor (private)

Protected Attributes

SP::SiconosVector _w#

vector w of a LinearOSNS system

SP::SiconosVector _z#

vector z of a LinearOSNS system

SP::OSNSMatrix _M#

matrix M of a LinearOSNS system

SP::SiconosVector _q#

vector q of a LinearOSNS system

SP::OSNSMatrix _W#

matrix W of a LinearOSNS system

SP::OSNSMatrix _W_inverse#

matrix W of a LinearOSNS system

SP::OSNSMatrix _H#

matrix H of a LinearOSNS system

LINEAROSNS_ASSEMBLY_TYPE _assemblyType#

Assembly strategy.

NM_types _numericsMatrixStorageType = NM_DENSE#

Storage type for M - NM_DENSE: SiconosMatrix (dense), NM_SPARSE_BLOCK: Sparse Storage (embedded into OSNSMatrix)

bool _keepLambdaAndYState = true#

a boolean to decide if _w and _z vectors are initialized with previous values of Y and Lambda when a change occurs in problem size

Friends

friend struct _TimeSteppingNSLEffect
friend struct _EventDrivenNSLEffect
friend struct _NSLEffectOnSim