From 30dcab13be9909698cc53d67cafaa4d3ce7f7f51 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Thu, 21 Mar 2019 14:19:26 +0100
Subject: [PATCH] Register PDELab finite elements into UFL

---
 python/dune/codegen/__init__.py          |  3 ++
 python/dune/codegen/ufl/finiteelement.py | 43 ++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 python/dune/codegen/ufl/finiteelement.py

diff --git a/python/dune/codegen/__init__.py b/python/dune/codegen/__init__.py
index e892baf4..19641978 100644
--- a/python/dune/codegen/__init__.py
+++ b/python/dune/codegen/__init__.py
@@ -10,3 +10,6 @@ import dune.codegen.loopy.symbolic  # noqa
 import dune.codegen.pdelab  # noqa
 import dune.codegen.sumfact  # noqa
 import dune.codegen.blockstructured  # noqa
+
+# Trigger imports that register finite elements in UFL
+import dune.codegen.ufl.finiteelement  # noqa
diff --git a/python/dune/codegen/ufl/finiteelement.py b/python/dune/codegen/ufl/finiteelement.py
new file mode 100644
index 00000000..ae0ef35f
--- /dev/null
+++ b/python/dune/codegen/ufl/finiteelement.py
@@ -0,0 +1,43 @@
+""" Registering finite elements that we have, but FEniCS does not """
+
+from ufl import register_element, L2
+
+
+register_element("Discontinuous Gauss-Lobatto-Legendre",
+                 "DGLL",
+                 0,
+                 L2,
+                 "identity",
+                 (0, None),
+                 ('interval',),
+                 )
+
+
+register_element("Monomials",
+                 "Monom",
+                 0,
+                 L2,
+                 "identity",
+                 (0, None),
+                 ('interval',),
+                 )
+
+
+register_element("L2-Orthonormal Polynomials",
+                 "OPB",
+                 0,
+                 L2,
+                 "identity",
+                 (0, None),
+                 ('interval',),
+                 )
+
+
+register_element("Rannacher-Turek",
+                 "RaTu",
+                 0,
+                 L2,
+                 "identity",
+                 (1, 1),
+                 ('quadrilateral', 'hexahedron'),
+                 )
-- 
GitLab