16 #ifndef SURGSIM_PHYSICS_FEMELEMENT_INL_H 17 #define SURGSIM_PHYSICS_FEMELEMENT_INL_H 30 template <
typename T,
int Opt,
typename StorageIndex>
32 const std::vector<size_t>& blockIds,
size_t blockSize, Eigen::SparseMatrix<T, Opt, StorageIndex>* matrix)
const 34 using SurgSim::Math::addSubMatrix;
37 const Index numBlocks =
static_cast<Index
>(blockIds.size());
38 for (Index block0 = 0; block0 < numBlocks; block0++)
40 Index subRow =
static_cast<Index
>(blockSize * block0);
41 for (Index block1 = 0; block1 < numBlocks; block1++)
43 Index subCol =
static_cast<Index
>(blockSize * block1);
44 addSubMatrix(subMatrix.block(subRow, subCol, blockSize, blockSize),
45 static_cast<Index
>(blockIds[block0]), static_cast<Index>(blockIds[block1]), matrix);
50 template <
typename T,
int Opt,
typename StorageIndex>
52 const std::vector<size_t>& blockIds,
size_t blockSize, Eigen::SparseMatrix<T, Opt, StorageIndex>* matrix)
const 54 using SurgSim::Math::addSubMatrixNoInitialize;
57 const Index numBlocks =
static_cast<Index
>(blockIds.size());
58 for (Index block0 = 0; block0 < numBlocks; block0++)
60 Index subRow =
static_cast<Index
>(blockSize * block0);
61 for (Index block1 = 0; block1 < numBlocks; block1++)
63 Index subCol =
static_cast<Index
>(blockSize * block1);
64 addSubMatrixNoInitialize(subMatrix.block(subRow, subCol, blockSize, blockSize),
65 static_cast<Index
>(blockIds[block0]), static_cast<Index>(blockIds[block1]), matrix);
74 #endif // SURGSIM_PHYSICS_FEMELEMENT_INL_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
void assembleMatrixBlocksNoInitialize(const Eigen::Ref< const Math::Matrix > &subMatrix, const std::vector< size_t > &blockIds, size_t blockSize, Eigen::SparseMatrix< T, Opt, StorageIndex > *matrix) const
Add a sub-matrix made of squared-blocks into a matrix that is already initialized.
Definition: FemElement-inl.h:51
Definitions of useful sparse matrix functions.
void assembleMatrixBlocks(const Eigen::Ref< const Math::Matrix > &subMatrix, const std::vector< size_t > &blockIds, size_t blockSize, Eigen::SparseMatrix< T, Opt, StorageIndex > *matrix) const
Add a sub-matrix made of squared-blocks into a matrix that could be un-initialized.
Definition: FemElement-inl.h:31
Definitions of small fixed-size square matrix types.