chrono::ChKblock Class Referenceabstract

## Description

Base class for representing items which introduce block-sparse matrices, that is blocks that connect some 'variables' and build a matrix K in a sparse variational inequality VI(Z*x-d,K):

| M+K -Cq'|*|q|- | f|= |0| , l Y, C Ny, normal cone to Y | Cq -E | |l| |-b| |c|

Also Z symmetric by flipping sign of l_i: |M+K Cq'|*| q|-| f|=|0| |Cq E | |-l| |-b| |c|

• case linear problem: all Y_i = R, Ny=0, ex. all bilaterals
• case LCP: all Y_i = R+: c>=0, l>=0, l*c=0
• case CCP: Y_i are friction cones Note that K blocks often have a physical interpretation as stiffness, but not always, for example they can represent hessians. Note that all blocks in K, all masses and constraint jacobians Cq are not really assembled in large matrices, so to exploit sparsity.

#include <ChKblock.h>

Inheritance diagram for chrono::ChKblock:

## Public Member Functions

virtual size_t GetNvars () const =0
Returns the number of referenced ChVariables items.

virtual ChMatrix< double > * Get_K ()=0
Access the K stiffness matrix as a single block, referring only to the referenced ChVariable objects.

virtual void MultiplyAndAdd (ChMatrix< double > &result, const ChMatrix< double > &vect) const =0
Computes the product of the corresponding blocks in the system matrix (ie. More...

virtual void DiagonalAdd (ChMatrix< double > &result)=0
Add the diagonal of the stiffness matrix block(s) as a column vector to 'result'. More...

virtual void Build_K (ChSparseMatrix &storage, bool add=true)=0
Writes (and adds) the K matrix associated to these variables into a global 'storage' matrix, at the offsets of variables. More...

## Member Function Documentation

 virtual void chrono::ChKblock::Build_K ( ChSparseMatrix & storage, bool add = true )
pure virtual

Writes (and adds) the K matrix associated to these variables into a global 'storage' matrix, at the offsets of variables.

Most solvers do not need this: the sparse 'storage' matrix is used for testing, for direct solvers, for dumping full matrix to Matlab for checks, etc.

Implemented in chrono::ChKblockGeneric.

 virtual void chrono::ChKblock::DiagonalAdd ( ChMatrix< double > & result )
pure virtual

Add the diagonal of the stiffness matrix block(s) as a column vector to 'result'.

NOTE: the 'result' vector must already have the size of system unknowns, ie the size of the total variables&constraints in the system; the procedure will use the ChVariable offsets (that must be already updated) as index.

Implemented in chrono::ChKblockGeneric.

 virtual void chrono::ChKblock::MultiplyAndAdd ( ChMatrix< double > & result, const ChMatrix< double > & vect ) const
pure virtual

Computes the product of the corresponding blocks in the system matrix (ie.

the K matrix blocks) by 'vect', and add to 'result'. NOTE: the 'vect' and 'result' vectors must already have the size of the total variables&constraints in the system; the procedure will use the ChVariable offsets (that must be already updated) to know the indexes in result and vect.

Implemented in chrono::ChKblockGeneric.