Create a Vector that is compatible with the given function space. Args: V: A function space. dtype: Data type of the vector. Returns: A vector compatible with the function space.
(V: FunctionSpace, dtype: npt.DTypeLike = default_scalar_type)
| 96 | |
| 97 | |
| 98 | def create_vector(V: FunctionSpace, dtype: npt.DTypeLike = default_scalar_type) -> la.Vector: |
| 99 | """Create a Vector that is compatible with the given function space. |
| 100 | |
| 101 | Args: |
| 102 | V: A function space. |
| 103 | dtype: Data type of the vector. |
| 104 | |
| 105 | Returns: |
| 106 | A vector compatible with the function space. |
| 107 | """ |
| 108 | # Can just take the first dofmap here, since all dof maps have the same |
| 109 | # index map in mixed-topology meshes |
| 110 | dofmap = V.dofmaps[0] # type: ignore[attr-defined] |
| 111 | return la.vector(dofmap.index_map, dofmap.index_map_bs, dtype=dtype) |
| 112 | |
| 113 | |
| 114 | def create_matrix(a: Form, block_mode: la.BlockMode | None = None) -> la.MatrixCSR: |
no test coverage detected