warp.fem.project_system_matrix#
- warp.fem.project_system_matrix(
- system_matrix,
- projector_matrix,
- projector_structure='general',
Projects the left-hand-side of a linear system to enforce Dirichlet boundary conditions
system = (I - projector) * system * (I - projector) + projectorBy default, the projection uses general sparse matrix products, which support any projector but allocate temporary storage and read back block counts. Dirichlet projectors assembled with
assembly="nodal"are block-diagonal: every block of the result then only depends on the matching block ofsystem_matrixand on the projector’s diagonal blocks, and passingprojector_structure="block_diagonal"projectssystem_matrixin place with a single kernel, keeping its sparsity pattern.- Parameters:
system_matrix (BsrMatrix) – Square system matrix, modified in place.
projector_matrix (BsrMatrix) – Square projector matrix with the same block shape as
system_matrix.projector_structure (Literal['general', 'block_diagonal']) –
How to project the system matrix.
"general"uses general sparse matrix products, which also support projectors with off-diagonal blocks."block_diagonal"uses the single-kernel projection. It does not allocate or read back, so it can be used during graph capture. The projector must be block-diagonal, andsystem_matrixmust store a diagonal block in every row where the projector is nonzero: off-diagonal projector blocks are ignored, and a row where the projector is nonzero butsystem_matrixhas no diagonal block does not get its projector block added.