Description
Class that represent nxn sparse blocks to put into K global matrix, that is blocks that connect N 'variables' and build a matrix K in a sparse variational inequality VI(Z*xd,K):
See ChSystemDescriptor for more information about the overall problem and data representation.
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 <ChKblockGeneric.h>
Public Member Functions  
ChKblockGeneric (std::vector< ChVariables * > mvariables)  
ChKblockGeneric (ChVariables *mvariableA, ChVariables *mvariableB)  
ChKblockGeneric &  operator= (const ChKblockGeneric &other) 
Assignment operator: copy from other object.  
void  SetVariables (std::vector< ChVariables * > mvariables) 
Set references to the constrained objects, each of ChVariables type, automatically creating/resizing K matrix if needed. More...  
virtual size_t  GetNvars () const override 
Returns the number of referenced ChVariables items.  
ChVariables *  GetVariableN (unsigned int m_var) const 
Access the mth vector variable object.  
virtual ChMatrix< double > *  Get_K () override 
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 override 
Computes the product of the corresponding blocks in the system matrix (ie. More...  
virtual void  DiagonalAdd (ChMatrix< double > &result) override 
Add the diagonal of the stiffness matrix block(s) as a column vector to 'result'. More...  
virtual void  Build_K (ChSparseMatrix &storage, bool add) override 
Writes the K matrix associated to these variables into a global 'storage' matrix, at the offsets of variables. More...  
Member Function Documentation

overridevirtual 
Writes 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.
Implements chrono::ChKblock.

overridevirtual 
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.
Implements chrono::ChKblock.

overridevirtual 
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.
Implements chrono::ChKblock.
void chrono::ChKblockGeneric::SetVariables  (  std::vector< ChVariables * >  mvariables  ) 
Set references to the constrained objects, each of ChVariables type, automatically creating/resizing K matrix if needed.