Skip to content

Commit e51eacc

Browse files
committed
Add typing generics to finiteelement
1 parent 37b3898 commit e51eacc

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

python/dolfinx/fem/element.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def _(e: basix.finite_element.FiniteElement) -> CoordinateElement:
159159
return CoordinateElement(_cpp.fem.CoordinateElement_float64(e._e))
160160

161161

162-
class FiniteElement:
162+
class FiniteElement(Generic[_T]):
163163
"""A finite element."""
164164

165165
_cpp_object: _cpp.fem.FiniteElement_float32 | _cpp.fem.FiniteElement_float64
@@ -213,7 +213,7 @@ def value_shape(self) -> npt.NDArray[np.integer]:
213213
return self._cpp_object.value_shape
214214

215215
@property
216-
def interpolation_points(self) -> npt.NDArray[np.floating]:
216+
def interpolation_points(self) -> npt.NDArray[_T]:
217217
"""Points at which to evaluate the function to be interpolated.
218218
219219
Interpolation point coordinates on the reference cell, returning
@@ -271,7 +271,7 @@ def signature(self) -> str:
271271
return self._cpp_object.signature
272272

273273
def T_apply(
274-
self, x: npt.NDArray[np.floating], cell_permutations: npt.NDArray[np.uint32], dim: int
274+
self, x: npt.NDArray[_T], cell_permutations: npt.NDArray[np.uint32], dim: int
275275
) -> None:
276276
"""Transform basis from reference to physical ordering/orientation.
277277
@@ -294,7 +294,7 @@ def T_apply(
294294
self._cpp_object.T_apply(x, cell_permutations, dim)
295295

296296
def Tt_apply(
297-
self, x: npt.NDArray[np.floating], cell_permutations: npt.NDArray[np.uint32], dim: int
297+
self, x: npt.NDArray[_T], cell_permutations: npt.NDArray[np.uint32], dim: int
298298
) -> None:
299299
"""Apply the transpose of the operator applied by T_apply().
300300
@@ -308,7 +308,7 @@ def Tt_apply(
308308
self._cpp_object.Tt_apply(x, cell_permutations, dim)
309309

310310
def Tt_inv_apply(
311-
self, x: npt.NDArray[np.floating], cell_permutations: npt.NDArray[np.uint32], dim: int
311+
self, x: npt.NDArray[_T], cell_permutations: npt.NDArray[np.uint32], dim: int
312312
) -> None:
313313
"""Apply the inverse transpose of T_apply().
314314
@@ -325,7 +325,7 @@ def Tt_inv_apply(
325325
def finiteelement(
326326
cell_type: _cpp.mesh.CellType,
327327
ufl_e: basix.ufl._ElementBase,
328-
FiniteElement_dtype: np.dtype,
328+
FiniteElement_dtype: npt.DTypeLike,
329329
) -> FiniteElement:
330330
"""Create a DOLFINx element from a basix.ufl element.
331331

0 commit comments

Comments
 (0)