Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature][ElementTypes] Added 4d element types #95

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <meg@simula.no>, 2010
# Modified by Lizao Li <lzlarryli@gmail.com>, 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
Loading