diff --git a/python/basix/_basixcpp.pyi b/python/basix/_basixcpp.pyi index 9f1dda392..e78e5d913 100644 --- a/python/basix/_basixcpp.pyi +++ b/python/basix/_basixcpp.pyi @@ -481,6 +481,8 @@ def restriction(arg0: PolysetType, arg1: CellType, arg2: CellType, /) -> Polyset def sobolev_space_intersection(arg0: SobolevSpace, arg1: SobolevSpace, /) -> SobolevSpace: ... +def subentity_types(arg: CellType, /) -> list[list[CellType]]: ... + def sub_entity_connectivity(arg: CellType, /) -> list[list[list[list[int]]]]: ... def sub_entity_geometry(arg0: CellType, arg1: int, arg2: int, /) -> Annotated[ArrayLike, dict(dtype='float64', )]: ... diff --git a/python/basix/cell.py b/python/basix/cell.py index dc614a982..4fd13f300 100644 --- a/python/basix/cell.py +++ b/python/basix/cell.py @@ -15,11 +15,13 @@ from basix._basixcpp import cell_facet_reference_volumes as _frv from basix._basixcpp import cell_volume as _v from basix._basixcpp import geometry as _geometry +from basix._basixcpp import subentity_types as _sut from basix._basixcpp import sub_entity_connectivity as _sec from basix._basixcpp import topology as _topology __all__ = [ "sub_entity_connectivity", + "subentity_types", "volume", "facet_jacobians", "facet_normals", @@ -143,3 +145,15 @@ def topology(celltype: CellType) -> list[list[list[int]]]: Vertex indices for each sub-entity of the cell. """ return _topology(celltype) + + +def subentity_types(celltype: CellType) -> list[list[CellType]]: + """Get the types of the subentities of a reference cell. + + Args: + celltype: Cell type. + + Returns: + Cell types for each sub-entity of the cell. Indices are (tdim, entity). + """ + return _sut(celltype) diff --git a/python/wrapper.cpp b/python/wrapper.cpp index 25f8b2187..075ad7ab6 100644 --- a/python/wrapper.cpp +++ b/python/wrapper.cpp @@ -432,7 +432,7 @@ NB_MODULE(_basixcpp, m) return as_nbarrayp( cell::sub_entity_geometry(celltype, dim, index)); }); - + m.def("subentity_types", &cell::subentity_types); m.def("sobolev_space_intersection", &sobolev::space_intersection); nb::enum_(m, "LatticeType", nb::is_arithmetic(),