From c0fd0fa4ccafe5b42efb159da3a567c75cbfa885 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Fri, 14 Feb 2025 13:52:54 +0000 Subject: [PATCH] handle "vertex" --- ffcx/ir/representation.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 )