Assemble bilinear form into a matrix. Args: a: The bilinear form assemble. bcs: Boundary conditions that affect the assembled matrix. Degrees-of-freedom constrained by a boundary condition will have their rows/columns zeroed and the value ``diagonal``
(
a: typing.Any,
bcs: Sequence[DirichletBC] | None = None,
diag: float = 1.0,
constants: npt.NDArray | None = None,
coeffs: dict[tuple[IntegralType, int], npt.NDArray] | None = None,
block_mode: la.BlockMode | None = None,
)
| 255 | |
| 256 | @functools.singledispatch |
| 257 | def assemble_matrix( |
| 258 | a: typing.Any, |
| 259 | bcs: Sequence[DirichletBC] | None = None, |
| 260 | diag: float = 1.0, |
| 261 | constants: npt.NDArray | None = None, |
| 262 | coeffs: dict[tuple[IntegralType, int], npt.NDArray] | None = None, |
| 263 | block_mode: la.BlockMode | None = None, |
| 264 | ) -> la.MatrixCSR: |
| 265 | """Assemble bilinear form into a matrix. |
| 266 | |
| 267 | Args: |
| 268 | a: The bilinear form assemble. |
| 269 | bcs: Boundary conditions that affect the assembled matrix. |
| 270 | Degrees-of-freedom constrained by a boundary condition will |
| 271 | have their rows/columns zeroed and the value ``diagonal`` |
| 272 | set on on the matrix diagonal. |
| 273 | diag: Value to set on the matrix diagonal for Dirichlet |
| 274 | boundary condition constrained degrees-of-freedom belonging |
| 275 | to the same trial and test space. |
| 276 | constants: Constants that appear in the form. If ``None``, |
| 277 | any required constants will be computed. |
| 278 | coeffs: Coefficients that appear in the form. If not provided, |
| 279 | any required coefficients will be computed. |
| 280 | block_mode: Block size mode for the returned space matrix. If |
| 281 | ``None``, default is used. |
| 282 | |
| 283 | Returns: |
| 284 | Matrix representation of the bilinear form ``a``. |
| 285 | |
| 286 | Note: |
| 287 | The returned matrix is not finalised, i.e. ghost values are not |
| 288 | accumulated. |
| 289 | """ |
| 290 | bcs = [] if bcs is None else bcs |
| 291 | A: la.MatrixCSR = create_matrix(a, block_mode) |
| 292 | _assemble_matrix_csr(A, a, bcs, diag, constants, coeffs) |
| 293 | return A |
| 294 | |
| 295 | |
| 296 | @assemble_matrix.register |
nothing calls this directly
no test coverage detected