Description
Sparse blocks loaded into the KRM global matrix, associated with a set of variables.
See ChSystemDescriptor for more information about the overall problem and data representation.
Notes:
- KRM blocks often have a physical interpretation as stiffness or damping, but not always, for example they can also represent Hessians.
- KRM blocks, together with all masses and constraint Jacobians, are not always assembled in a system-level matrix. That is usually done only when using direct sparse solvers or else for debugging/reporting purposes.
#include <ChKRMBlock.h>
Public Member Functions | |
ChKRMBlock (std::vector< ChVariables * > mvariables) | |
ChKRMBlock (ChVariables *mvariableA, ChVariables *mvariableB) | |
ChKRMBlock & | operator= (const ChKRMBlock &other) |
Assignment operator: copy from other object. | |
void | SetVariables (std::vector< ChVariables * > mvariables) |
Set references to the constrained objects, each of ChVariables type. More... | |
size_t | GetNumVariables () const |
Returns the number of referenced ChVariables items. | |
ChVariables * | GetVariable (unsigned int m) const |
Access the m-th vector variable object. | |
ChMatrixRef | GetMatrix () |
Access the KRM matrix as a single block, corresponding to the referenced ChVariable objects. | |
void | AddMatrixTimesVectorInto (ChVectorRef result, ChVectorConstRef vect) const |
Add the product of the block matrix by a given vector and add to result. More... | |
void | DiagonalAdd (ChVectorRef result) const |
Add the diagonal of the stiffness matrix block(s) as a column vector to 'result'. More... | |
void | PasteMatrixInto (ChSparseMatrix &mat, unsigned int start_row, unsigned int start_col, bool overwrite) const |
Write the KRM matrix into the specified global matrix at the offsets of the referenced ChVariable objects. More... | |
Member Function Documentation
◆ AddMatrixTimesVectorInto()
void chrono::ChKRMBlock::AddMatrixTimesVectorInto | ( | ChVectorRef | result, |
ChVectorConstRef | vect | ||
) | const |
Add the product of the block matrix by a given vector and add to result.
Note: 'result' and 'vect' are system-level vectors of appropriate size. This function must index into these vectors using the offsets of the associated variables variable.
◆ DiagonalAdd()
void chrono::ChKRMBlock::DiagonalAdd | ( | ChVectorRef | result | ) | const |
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).
◆ PasteMatrixInto()
void chrono::ChKRMBlock::PasteMatrixInto | ( | ChSparseMatrix & | mat, |
unsigned int | start_row, | ||
unsigned int | start_col, | ||
bool | overwrite | ||
) | const |
Write the KRM matrix into the specified global matrix at the offsets of the referenced ChVariable objects.
Additional offsets can be specified to place the submatrix into a different position of the global matrix. If the ovewrite parameters is set to true, the submatrix overwrites the existing values in the global matrix, otherwise the values are summed. Assembling the system-level sparse matrix is required only if using a direct sparse solver or for debugging/reporting purposes.
◆ SetVariables()
void chrono::ChKRMBlock::SetVariables | ( | std::vector< ChVariables * > | mvariables | ) |
Set references to the constrained objects, each of ChVariables type.
This automatically creates and resizes the KRM matrix, as needed.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/solver/ChKRMBlock.h
- /builds/uwsbel/chrono/src/chrono/solver/ChKRMBlock.cpp