diff --git a/ffcx/ir/representation.py b/ffcx/ir/representation.py index 1f615b3bd..ed1f85159 100644 --- a/ffcx/ir/representation.py +++ b/ffcx/ir/representation.py @@ -37,6 +37,13 @@ logger = logging.getLogger("ffcx") +def basix_cell_from_string(string: str) -> basix.CellType: + """Convert a string to a Basix CellType.""" + if string == "vertex": + return basix.CellType.point + return getattr(basix.CellType, string) + + class FormIR(typing.NamedTuple): """Intermediate representation of a form.""" @@ -275,8 +282,8 @@ def _compute_integral_ir( "Explicitly selected vertex quadrature (degree 1), " f"but requested degree is {degree}." ) - points = basix.cell.geometry(getattr(basix.CellType, cellname)) - cell_volume = basix.cell.volume(getattr(basix.CellType, cellname)) + points = basix.cell.geometry(basix_cell_from_string(cellname)) + cell_volume = basix.cell.volume(basix_cell_from_string(cellname)) weights = np.full( points.shape[0], cell_volume / points.shape[0], dtype=points.dtype )