MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / create_vector

Function create_vector

python/dolfinx/fem/assemble.py:98–111  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

96
97
98def 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
114def create_matrix(a: Form, block_mode: la.BlockMode | None = None) -> la.MatrixCSR:

Callers 1

_assemble_vector_formFunction · 0.70

Calls 1

vectorMethod · 0.80

Tested by

no test coverage detected