Skip to content

Commit

Permalink
store degree of quadrature rule if one it input
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Sep 6, 2023
1 parent 6b3fd6d commit e4b691a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/basix/ufl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,15 +1203,19 @@ class _QuadratureElement(_ElementBase):
"""A quadrature element."""

def __init__(self, cell: _basix.CellType, value_shape: _typing.Tuple[int, ...],
points: _npt.NDArray[_np.float64], weights: _npt.NDArray[_np.float64], mapname: str):
points: _npt.NDArray[_np.float64], weights: _npt.NDArray[_np.float64],
degree: _typing.Optional[int] = None, mapname: str):
"""Initialise the element."""
self._points = points
self._weights = weights
repr = f"QuadratureElement({cell.name}, {points!r}, {weights!r}, {mapname})".replace("\n", "")
self._cell_type = cell
self._entity_counts = [len(i) for i in _basix.topology(cell)]

super().__init__(repr, "quadrature element", cell.name, value_shape, len(points), mapname=mapname)
if degree is None:
degree = len(points)

super().__init__(repr, "quadrature element", cell.name, value_shape, degree, mapname=mapname)

def basix_sobolev_space(self):
"""Return the underlying Sobolev space."""
Expand Down Expand Up @@ -1824,7 +1828,7 @@ def quadrature_element(
assert points is not None
assert weights is not None

return _QuadratureElement(cell, value_shape, points, weights, mapname)
return _QuadratureElement(cell, value_shape, points, weights, degree, mapname)


def real_element(
Expand Down

0 comments on commit e4b691a

Please sign in to comment.