Class GenericMechanical

Defined in Program listing for file kernel/src/simulationTools/GenericMechanical.hpp

class GenericMechanical : public LinearOSNS

Formalization and Resolution of a generic mechanical problem: It mixes bilateral equality, complementarity, impact and friction problems.

This class is devoted to contains of a set of Non-Smooth Problem.

Main functions:

  • formalization of the problem: computes M,q using the set of “active” Interactions from the simulation and the interactionBlock-matrices saved in the field interactionBlocks. Functions: initialize(), computeInteractionBlock(), preCompute()

  • solving of the GenericMechanical problem: function compute(), used to call solvers from Numerics through the gmp_driver() interface of Numerics.

  • post-treatment of data: set values of y/lambda variables of the active Interaction (ie Interactions) using ouput results from the solver (velocity,reaction); function postCompute().

For details regarding the available options, see Nonsmooth problems formulations and available solvers in users’ guide.

Public Functions

GenericMechanical(int FC3D_Solver_Id = SICONOS_FRICTION_3D_ONECONTACT_NSN)

constructor from solver id


numericsSolverId – id of the internal friction solver of the generic problem default = SICONOS_FRICTION_3D_ONECONTACT_NSN

GenericMechanical(SP::SolverOptions options)

constructor from a pre-defined solver options set


options – the options set



virtual void initialize(SP::Simulation sim) override

initialize the GenericMechanical problem(compute topology …)


sim – the simulation, owner of this OSNSPB

virtual int compute(double time) override

Compute the unknown reaction and velocity and update the Interaction (y and lambda )


time – double current time


int information about the solver convergence (0: ok, >0 problem, see Numerics documentation)

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

compute extra-diagonal interactionBlock-matrix


ed – an edge descriptor

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

compute diagonal Interaction block


vd – a vertex descriptor

virtual void display() const override

print the data to the screen

virtual void updateInteractionBlocks() override

compute interactionBlocks if necessary (this depends on the type of OSNS, on the indexSets …)

virtual bool checkCompatibleNSLaw(NonSmoothLaw &nslaw) override

Check the compatibility fol the nslaw with the targeted OSNSP.