MULTIBODY SIMULATION SOFTWARE - API documentation

chrono::ChLcpConstraint Class Reference

#include <CHlcpConstraint.h>

Inheritance diagram for chrono::ChLcpConstraint:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ChLcpConstraint (const ChLcpConstraint &other)
virtual ChLcpConstraintnew_Duplicate ()=0
ChLcpConstraintoperator= (const ChLcpConstraint &other)
bool operator== (const ChLcpConstraint &other) const
virtual bool IsValid ()
virtual bool IsDisabled ()
virtual void SetDisabled (bool mon)
virtual bool IsRedundant ()
virtual void SetRedundant (bool mon)
virtual bool IsBroken ()
virtual void SetBroken (bool mon)
virtual bool IsUnilateral ()
virtual bool IsLinear ()
eChConstraintMode GetMode ()
void SetMode (eChConstraintMode mmode)
virtual bool IsActive ()
virtual double Compute_c_i ()
double Get_c_i ()
void Set_b_i (const double mb)
double Get_b_i ()
void Set_cfm_i (const double mcfm)
double Get_cfm_i ()
virtual void Set_l_i (double ml_i)
virtual double Get_l_i ()
virtual void Update_auxiliary ()
double Get_g_i ()
void Set_g_i (double m_g_i)
virtual double Compute_Cq_q ()=0
virtual void Increment_q (const double deltal)=0
virtual void Project ()
virtual double Violation (double mc_i)
virtual void Build_Cq (ChSparseMatrix &storage, int insrow)=0
virtual bool IsGPUcompatible ()
virtual void StreamIN (ChStreamInBinary &mstream)
virtual void StreamOUT (ChStreamOutBinary &mstream)

Protected Attributes

double c_i
double l_i
double b_i
double cfm_i
bool valid
bool disabled
bool redundant
bool broken
eChConstraintMode mode
double g_i


Detailed Description

Base class for representing constraints to be used with LCP solvers, used with LCP systems including inequalities, equalities, nonlinearities, etc.

| M -Cq'|*|q|- | f|= |0| , c>=0, l>=0, l*c=0; | Cq 0 | |l| |-b| |c|

The jacobian matrix [Cq] is built row by row by jacobians [Cq_i] of the constraints. In general, typical bilateral constraints must be solved to have residual the residual c_i = 0 (unilaterals: c_i>0) where the following linearization is introduced: c_i= [Cq_i]*q + b_i

The base class introduce just the minimum requirements for the solver, that is the basic methods which will be called by the solver. It is up to the inherited classes to implement these methods, and to add further features..


Constructor & Destructor Documentation

chrono::ChLcpConstraint::ChLcpConstraint ( const ChLcpConstraint other  ) 

Copy constructor.


Member Function Documentation

ChLcpConstraint & chrono::ChLcpConstraint::operator= ( const ChLcpConstraint other  ) 

Assignment operator: copy from other object.

bool chrono::ChLcpConstraint::operator== ( const ChLcpConstraint other  )  const

Comparison (compares anly flags, not the jacobians etc.).

virtual bool chrono::ChLcpConstraint::IsValid (  )  [virtual]

Tells if the constraint data is currently valid. Instead of implementing it, child classes may simply set valid=false (or true) depending on the result of their implementations of RestoreReference();

virtual bool chrono::ChLcpConstraint::IsDisabled (  )  [virtual]

Tells if the constraint is currently turned on or off by the user.

virtual void chrono::ChLcpConstraint::SetDisabled ( bool  mon  )  [virtual]

User can use this to enable/disable the constraint as desired.

virtual bool chrono::ChLcpConstraint::IsRedundant (  )  [virtual]

Tells if the constraint is redundant or singular.

virtual void chrono::ChLcpConstraint::SetRedundant ( bool  mon  )  [virtual]

Solvers may use the following to mark a constraint as redundant.

virtual bool chrono::ChLcpConstraint::IsBroken (  )  [virtual]

Tells if the constraint is broken, for eccess of pulling/pushing.

virtual void chrono::ChLcpConstraint::SetBroken ( bool  mon  )  [virtual]

3rd party software can set the 'broken' status via this method (by default, constraints never break);

virtual bool chrono::ChLcpConstraint::IsUnilateral (  )  [virtual]

Tells if the constraint is unilateral (typical complementarity constraint).

virtual bool chrono::ChLcpConstraint::IsLinear (  )  [virtual]

Tells if the constraint is linear (if non linear, returns false).

Reimplemented in chrono::ChLcpConstraintTwoFriction, chrono::ChLcpConstraintTwoFrictionT, chrono::ChLcpConstraintTwoGPUcontT, and chrono::ChLcpConstraintTwoRollingT.

eChConstraintMode chrono::ChLcpConstraint::GetMode (  ) 

Gets the mode of the constraint: free / lock / complementary A typical constraint has 'lock = true' by default.

void chrono::ChLcpConstraint::SetMode ( eChConstraintMode  mmode  ) 

Sets the mode of the constraint: free / lock / complementary.

virtual bool chrono::ChLcpConstraint::IsActive (  )  [virtual]

A VERY IMPORTANT function! Tells if the constraint is currently active, in general, that is tells if it must be included into the system solver or not. This method cumulates the effect of all flags (so a constraint may be not active either because disabled, or broken, etc)

virtual double chrono::ChLcpConstraint::Compute_c_i (  )  [virtual]

Compute the residual of the constraint using the LINEAR expression c_i= [Cq_i]*q + b_i . For a satisfied bilateral constraint, this residual must be near zero.

double chrono::ChLcpConstraint::Get_c_i (  ) 

Sets the residual 'c_i' of this constraint. // CURRENTLY NOT USED.

This function must update the 'c_i' residual of the constraint. // CURRENTLY NOT USED This function MAY BE OVERRIDDEN by specialized inherited classes! (a possible alternative is not overriding this, and using the Set_c_i() function an all the constraints, from an external procedure, just before calling the solver - if the solver does not need successive evaluations of residuals during the process.) Return the residual 'c_i' of this constraint. // CURRENTLY NOT USED

void chrono::ChLcpConstraint::Set_b_i ( const double  mb  ) 

Sets the known term b_i in [Cq_i]*q + b_i =0, where: c_i= [Cq_i]*q + b_i = 0

double chrono::ChLcpConstraint::Get_b_i (  ) 

Return the known term b_i in [Cq_i]*q + b_i =0, where: c_i= [Cq_i]*q + b_i = 0

void chrono::ChLcpConstraint::Set_cfm_i ( const double  mcfm  ) 

Sets the constraint force mixing term (default=0). Adds artificial 'elasticity' to the constraint, as: c_i= [Cq_i]*q + b_i + cfm*l_i =0;

double chrono::ChLcpConstraint::Get_cfm_i (  ) 

Returns the constraint force mixing term.

virtual void chrono::ChLcpConstraint::Set_l_i ( double  ml_i  )  [virtual]

Sets the 'l_i' value (constraint reaction, see 'l' vector).

virtual double chrono::ChLcpConstraint::Get_l_i (  )  [virtual]

Return the 'l_i' value (constraint reaction, see 'l' vector).

virtual void chrono::ChLcpConstraint::Update_auxiliary (  )  [virtual]

This function must update jacobians and auxiliary data such as the 'g_i' product. This function is often called by LCP solvers at the beginning of the solution process. This function MUST BE OVERRIDDEN by specialized inherited classes, which have some jacobians!

Reimplemented in chrono::ChLcpConstraintTwoBodies, and chrono::ChLcpConstraintTwoGeneric.

double chrono::ChLcpConstraint::Get_g_i (  ) 

Return the 'g_i' product , that is [Cq_i]*[invM_i]*[Cq_i]' (+cfm).

void chrono::ChLcpConstraint::Set_g_i ( double  m_g_i  ) 

Usually you should not use the Set_g_i function, because g_i should be automatically computed during the Update_auxiliary() .

virtual double chrono::ChLcpConstraint::Compute_Cq_q (  )  [pure virtual]

This function must computes the product between the row-jacobian of this constraint '[Cq_i]' and the vector of variables, 'q'. that is Cq_q=[Cq_i]*q This is used for some iterative LCP solvers. This function MUST BE OVERRIDDEN by specialized inherited classes! (since it will be called frequently, when iterative solvers are used, the implementation of the [Cq_i]*q product must be AS FAST AS POSSIBLE!). It returns the result of the computation.

Implemented in chrono::ChLcpConstraintTwoBodies, chrono::ChLcpConstraintTwoGeneric, chrono::ChLcpConstraintTwoGPUcontN, and chrono::ChLcpConstraintTwoGPUcontT.

virtual void chrono::ChLcpConstraint::Increment_q ( const double  deltal  )  [pure virtual]

This function must increment the vector of variables 'q' with the quantity [invM]*[Cq_i]'*deltal,that is q+=[invM]*[Cq_i]'*deltal This is used for some iterative LCP solvers. This function MUST BE OVERRIDDEN by specialized inherited classes!

Implemented in chrono::ChLcpConstraintTwoBodies, chrono::ChLcpConstraintTwoGeneric, chrono::ChLcpConstraintTwoGPUcontN, and chrono::ChLcpConstraintTwoGPUcontT.

void chrono::ChLcpConstraint::Project (  )  [virtual]

For iterative solvers: project the value of a possible 'l_i' value of constraint reaction onto admissible orthant/set. Default behavior: if constraint is unilateral and l_i<0, reset l_i=0 This function MAY BE OVERRIDDEN by specialized inherited classes! For example, a bilateral constraint can do nothing, a monolateral: l_i= CHmax(0., l_i); a 'boxed constraint': l_i= CHmin(CHmax(min., l_i), max); etc. etc.

Reimplemented in chrono::ChLcpConstraintTwoContact, chrono::ChLcpConstraintTwoContactN, chrono::ChLcpConstraintTwoFrictionApprox, chrono::ChLcpConstraintTwoGPUcontN, chrono::ChLcpConstraintTwoGPUcontT, and chrono::ChLcpConstraintTwoRollingN.

double chrono::ChLcpConstraint::Violation ( double  mc_i  )  [virtual]

Given the residual of the constraint computed as the linear map mc_i = [Cq]*q + b_i + cfm*l_i , returns the violation of the constraint, considering inequalities, etc. For bilateral constraint, violation = mc_i. For unilateral constraint, violation = min(mc_i, 0), For boxed constraints or such, inherited class MAY OVERRIDE THIS!

Reimplemented in chrono::ChLcpConstraintTwoFriction, chrono::ChLcpConstraintTwoFrictionT, chrono::ChLcpConstraintTwoGPUcontT, and chrono::ChLcpConstraintTwoRollingT.

virtual void chrono::ChLcpConstraint::Build_Cq ( ChSparseMatrix storage,
int  insrow 
) [pure virtual]

Puts the jacobian portions into the 'insrow' row of a sparse matrix, where each portion of jacobian is shifted in order to match the offset of the corresponding ChLcpVariable. The same is done on the 'insrow' column, so that the sparse matrix is kept symmetric. This is used only by the ChLcpSimplex solver (iterative solvers don't need to know jacobians explicitly) This function MUST BE OVERRIDDEN by specialized inherited classes!

Implemented in chrono::ChLcpConstraintTwoBodies, chrono::ChLcpConstraintTwoGeneric, chrono::ChLcpConstraintTwoGPUcontN, and chrono::ChLcpConstraintTwoGPUcontT.

virtual bool chrono::ChLcpConstraint::IsGPUcompatible (  )  [virtual]

Return true only if this constraint can be used by the special GPU solver (it's a constraint with two jacobians of 6 elements each). This function returns true only in the case of ChLcpConstraintTwoBodies and children classes.

Reimplemented in chrono::ChLcpConstraintTwoBodies.

void chrono::ChLcpConstraint::StreamIN ( ChStreamInBinary mstream  )  [virtual]

Method to allow deserializing a persistent binary archive (ex: a file) into transient data.

Reimplemented in chrono::ChLcpConstraintTwo, chrono::ChLcpConstraintTwoBodies, chrono::ChLcpConstraintTwoContact, chrono::ChLcpConstraintTwoContactN, chrono::ChLcpConstraintTwoFriction, chrono::ChLcpConstraintTwoFrictionApprox, chrono::ChLcpConstraintTwoFrictionT, chrono::ChLcpConstraintTwoGeneric, chrono::ChLcpConstraintTwoGPUcontN, chrono::ChLcpConstraintTwoGPUcontT, chrono::ChLcpConstraintTwoRollingN, and chrono::ChLcpConstraintTwoRollingT.

void chrono::ChLcpConstraint::StreamOUT ( ChStreamOutBinary mstream  )  [virtual]

Method to allow serializing transient data into a persistent binary archive (ex: a file).

Reimplemented in chrono::ChLcpConstraintTwo, chrono::ChLcpConstraintTwoBodies, chrono::ChLcpConstraintTwoContact, chrono::ChLcpConstraintTwoContactN, chrono::ChLcpConstraintTwoFriction, chrono::ChLcpConstraintTwoFrictionApprox, chrono::ChLcpConstraintTwoFrictionT, chrono::ChLcpConstraintTwoGeneric, chrono::ChLcpConstraintTwoGPUcontN, chrono::ChLcpConstraintTwoGPUcontT, chrono::ChLcpConstraintTwoRollingN, and chrono::ChLcpConstraintTwoRollingT.


Member Data Documentation

double chrono::ChLcpConstraint::c_i [protected]

The 'c_i' residual of the constraint (if satisfied, c must be =0).

double chrono::ChLcpConstraint::l_i [protected]

The 'l_i' lagrangian multiplier (reaction).

double chrono::ChLcpConstraint::b_i [protected]

The 'b_i' right term in [Cq_i]*q+b_i=0 , note: c_i= [Cq_i]*q + b_i.

double chrono::ChLcpConstraint::cfm_i [protected]

The constraint force mixing, if needed (usually is zero) to add some numerical 'elasticity' in the constraint, that is the equation becomes: c_i= [Cq_i]*q + b_i + cfm*l_i =0;

bool chrono::ChLcpConstraint::valid [protected]

Flag: the link has no formal problems (references restored correctly, etc).

bool chrono::ChLcpConstraint::disabled [protected]

Flag: the user can turn on/off the link easily.

bool chrono::ChLcpConstraint::redundant [protected]

Flag: the constraint is redundant or singular.

bool chrono::ChLcpConstraint::broken [protected]

Flag: the constraint is broken (someone pulled too much..).

eChConstraintMode chrono::ChLcpConstraint::mode [protected]

The mode of the constraint: free / lock / complementar.

double chrono::ChLcpConstraint::g_i [protected]

The 'g_i' product [Cq_i]*[invM_i]*[Cq_i]' (+cfm).


CHRONO::ENGINE
C++ library for multibody simulation, (C) Alessandro Tasora
This API documentation has been generated on 17 Jul 2009 by Doxygen