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 1 commit
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
15 changes: 11 additions & 4 deletions ufl/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Modified by Marie E. Rognes 2012
# Modified by Andrew T. T. McRae, 2014
# Modified by Massimiliano Leoni, 2016
# Modified by Robert Kloefkorn, 2022

import numbers
import functools
Expand Down Expand Up @@ -88,7 +89,9 @@ def __lt__(self, other):
"tetrahedron": (4, 6, 4, 1),
"prism": (6, 9, 5, 1),
"pyramid": (5, 8, 5, 1),
"hexahedron": (8, 12, 6, 1)}
"hexahedron": (8, 12, 6, 1),
"pentatope": (5, 10, 10, 5, 1),
"tesseract": (16, 32, 24, 8, 1)}

# Mapping from cell name to topological dimension
cellname2dim = dict((k, len(v) - 1) for k, v in num_cell_entities.items())
Expand Down Expand Up @@ -164,7 +167,9 @@ def facet_types(self):
"quadrilateral": ("interval",),
"tetrahedron": ("triangle",),
"hexahedron": ("quadrilateral",),
"prism": ("triangle", "quadrilateral")}
"prism": ("triangle", "quadrilateral"),
"pentatope": ("tetrahedron",),
"tesseract": ("hexahedron",)}
return tuple(ufl.Cell(facet_name, self.geometric_dimension())
for facet_name in facet_type_names[self.cellname()])

Expand Down Expand Up @@ -279,14 +284,16 @@ def _ufl_hash_data_(self):
_simplex_dim2cellname = {0: "vertex",
1: "interval",
2: "triangle",
3: "tetrahedron"}
3: "tetrahedron",
4: "pentatope"}

# Mapping from topological dimension to reference cell name for
# hypercubes
_hypercube_dim2cellname = {0: "vertex",
1: "interval",
2: "quadrilateral",
3: "hexahedron"}
3: "hexahedron",
4: "tesseract"}


def simplex(topological_dimension, geometric_dimension=None):
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

from numpy import asarray

Expand Down Expand Up @@ -90,12 +91,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