From d17c52c50ddef8972dea0026e0026a1cfb15e1d6 Mon Sep 17 00:00:00 2001 From: dr-robertk Date: Thu, 7 Apr 2022 12:58:06 +0200 Subject: [PATCH] [feature][ElementTypes] Added 4d types pentatope (4d simplex) and tesseract (4d cube). --- ufl/cell.py | 15 +++++++++++---- ufl/finiteelement/elementlist.py | 7 ++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ufl/cell.py b/ufl/cell.py index 2f5c95905..2b0068e22 100644 --- a/ufl/cell.py +++ b/ufl/cell.py @@ -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 @@ -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()) @@ -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()]) @@ -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): diff --git a/ufl/finiteelement/elementlist.py b/ufl/finiteelement/elementlist.py index eaf3e7722..372a9fea7 100644 --- a/ufl/finiteelement/elementlist.py +++ b/ufl/finiteelement/elementlist.py @@ -12,6 +12,7 @@ # Modified by Marie E. Rognes , 2010 # Modified by Lizao Li , 2015, 2016 # Modified by Massimiliano Leoni, 2016 +# Modified by Robert Kloefkorn, 2022 from numpy import asarray @@ -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