Skip to content

Commit

Permalink
[feature][ElementTypes] Added 4d types pentatope (4d simplex) and tes…
Browse files Browse the repository at this point in the history
…seract (4d cube). (#95)

Co-authored-by: Jack S. Hale <[email protected]>
Co-authored-by: David A. Ham <[email protected]>
Co-authored-by: Matthew Scroggs <[email protected]>
  • Loading branch information
4 people authored Aug 9, 2023
1 parent a49736c commit ef3c7ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 9 additions & 1 deletion ufl/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def num_facets(self) -> int:

def num_ridges(self) -> int:
"""Get the number of ridges.
Ridges are entities of dimension tdim-2.
"""
tdim = self.topological_dimension()
Expand Down Expand Up @@ -196,6 +196,10 @@ def peak_types(self) -> typing.Tuple[AbstractCell, ...]:
("triangle", "quadrilateral", "quadrilateral", "quadrilateral", "triangle"), ("prism", )],
"pyramid": [tuple("vertex" for i in range(5)), tuple("interval" for i in range(8)),
("quadrilateral", "triangle", "triangle", "triangle", "triangle"), ("pyramid", )],
"pentatope": [tuple("vertex" for i in range(5)), tuple("interval" for i in range(10)),
tuple("triangle" for i in range(10)), tuple("tetrahedron" for i in range(5), ("pentatope", ))],
"tesseract": [tuple("vertex" for i in range(16)), tuple("interval" for i in range(32)),
tuple("quadrilateral" for i in range(24)), tuple("hexahedron" for i in range(8)), ("tesseract", )],
}


Expand Down Expand Up @@ -422,6 +426,8 @@ def simplex(topological_dimension: int, geometric_dimension: typing.Optional[int
return Cell("triangle", geometric_dimension)
if topological_dimension == 3:
return Cell("tetrahedron", geometric_dimension)
if topological_dimension == 4:
return Cell("pentatope", geometric_dimension)
raise ValueError(f"Unsupported topological dimension for simplex: {topological_dimension}")


Expand All @@ -435,6 +441,8 @@ def hypercube(topological_dimension, geometric_dimension=None):
return Cell("quadrilateral", geometric_dimension)
if topological_dimension == 3:
return Cell("hexahedron", geometric_dimension)
if topological_dimension == 4:
return Cell("tesseract", geometric_dimension)
raise ValueError(f"Unsupported topological dimension for hypercube: {topological_dimension}")


Expand Down
7 changes: 4 additions & 3 deletions ufl/finiteelement/elementlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Modified by Marie E. Rognes <[email protected]>, 2010
# Modified by Lizao Li <[email protected]>, 2015, 2016
# Modified by Massimiliano Leoni, 2016
# Modified by Robert Kloefkorn, 2022

import warnings
from numpy import asarray
Expand Down Expand Up @@ -82,12 +83,12 @@ def show_elements():
# the future, add mapping name as another element property.

# Cell groups
simplices = ("interval", "triangle", "tetrahedron")
cubes = ("interval", "quadrilateral", "hexahedron")
simplices = ("interval", "triangle", "tetrahedron", "pentatope")
cubes = ("interval", "quadrilateral", "hexahedron", "tesseract")
any_cell = (None,
"vertex", "interval",
"triangle", "tetrahedron", "prism",
"pyramid", "quadrilateral", "hexahedron")
"pyramid", "quadrilateral", "hexahedron", "pentatope", "tesseract")

# Elements in the periodic table # TODO: Register these as aliases of
# periodic table element description instead of the other way around
Expand Down

0 comments on commit ef3c7ae

Please sign in to comment.