Skip to content

Commit

Permalink
handle "vertex"
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Feb 14, 2025
1 parent 60f4f33 commit c0fd0fa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ffcx/ir/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit c0fd0fa

Please sign in to comment.