From 56ae7911ef66f2ab6d17256f3b867eeaf968abd6 Mon Sep 17 00:00:00 2001 From: cyruscycheng21 Date: Thu, 30 May 2019 16:23:05 +0100 Subject: [PATCH 1/9] removed ufl cell transformation --- tsfc/fiatinterface.py | 14 ++------------ tsfc/finatinterface.py | 14 ++------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index e0c70f78..0a2787f3 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -53,6 +53,8 @@ "HDiv Trace": FIAT.HDivTrace, "Regge": FIAT.Regge, "Hellan-Herrmann-Johnson": FIAT.HellanHerrmannJohnson, + "DPC": FIAT.DPC, + "S": FIAT.Serendipity # These require special treatment below "DQ": None, "Q": None, @@ -60,8 +62,6 @@ "RTCF": None, "NCE": None, "NCF": None, - "DPC": FIAT.DPC, - "S": FIAT.Serendipity } """A :class:`.dict` mapping UFL element family names to their FIAT-equivalent constructors. If the value is ``None``, the UFL @@ -140,16 +140,6 @@ def convert_finiteelement(element, vector_is_mixed): lmbda = FIAT.GaussLegendre else: raise ValueError("Variant %r not supported on %s" % (kind, element.cell())) - elif element.family() == "DPC": - if element.cell().geometric_dimension() == 2: - element = element.reconstruct(cell=ufl.hypercube(2)) - elif element.cell.geometric_dimension() == 3: - element = element.reconstruct(cell=ufl.hypercube(3)) - elif element.family() == "S": - if element.cell().geometric_dimension() == 2: - element = element.reconstruct(cell=ufl.hypercube(2)) - elif element.cell().geometric_dimension() == 3: - element = element.reconstruct(cell=ufl.hypercube(3)) return lmbda(cell, element.degree()) diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index d371605f..818c387c 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -57,6 +57,8 @@ "Nedelec 2nd kind H(curl)": finat.NedelecSecondKind, "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, + "DPC": finat.DPC, + "S": finat.Serendipity # These require special treatment below "DQ": None, "Q": None, @@ -65,8 +67,6 @@ "NCE": None, "NCF": None, "Real": finat.DiscontinuousLagrange, - "DPC": finat.DPC, - "S": finat.Serendipity } """A :class:`.dict` mapping UFL element family names to their FInAT-equivalent constructors. If the value is ``None``, the UFL @@ -153,16 +153,6 @@ def convert_finiteelement(element, **kwargs): return finat.RuntimeTabulated(cell, degree, variant=kind, shift_axes=shift_axes, restriction=restriction, continuous=False), deps else: raise ValueError("Variant %r not supported on %s" % (kind, element.cell())) - elif element.family() == "DPC": - if element.cell().geometric_dimension() == 2: - element = element.reconstruct(cell=ufl.cell.hypercube(2)) - elif element.cell().geometric_dimension() == 3: - element = element.reconstruct(cell=ufl.cell.hypercube(3)) - elif element.family() == "S": - if element.cell().geometric_dimension() == 2: - element = element.reconstruct(cell=ufl.cell.hypercube(2)) - elif element.cell().geometric_dimension() == 3: - element = element.reconstruct(cell=ufl.cell.hypercube(3)) return lmbda(cell, element.degree()), set() From a7842339572b5454da33c61fc5aa3206302ad8a9 Mon Sep 17 00:00:00 2001 From: cyruscycheng21 Date: Thu, 30 May 2019 16:25:08 +0100 Subject: [PATCH 2/9] fixed syntax --- tsfc/fiatinterface.py | 4 ++-- tsfc/finatinterface.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index 0a2787f3..79903daf 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -54,14 +54,14 @@ "Regge": FIAT.Regge, "Hellan-Herrmann-Johnson": FIAT.HellanHerrmannJohnson, "DPC": FIAT.DPC, - "S": FIAT.Serendipity + "S": FIAT.Serendipity, # These require special treatment below "DQ": None, "Q": None, "RTCE": None, "RTCF": None, "NCE": None, - "NCF": None, + "NCF": None } """A :class:`.dict` mapping UFL element family names to their FIAT-equivalent constructors. If the value is ``None``, the UFL diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index 818c387c..8a8047f2 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -58,7 +58,7 @@ "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, "DPC": finat.DPC, - "S": finat.Serendipity + "S": finat.Serendipity, # These require special treatment below "DQ": None, "Q": None, @@ -66,7 +66,7 @@ "RTCF": None, "NCE": None, "NCF": None, - "Real": finat.DiscontinuousLagrange, + "Real": finat.DiscontinuousLagrange } """A :class:`.dict` mapping UFL element family names to their FInAT-equivalent constructors. If the value is ``None``, the UFL From 573e96724af68851659e3eae9a53930e97807227 Mon Sep 17 00:00:00 2001 From: cyruscycheng21 Date: Thu, 27 Jun 2019 16:34:26 +0100 Subject: [PATCH 3/9] register BDMCE element --- tsfc/fiatinterface.py | 1 + tsfc/finatinterface.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index 79903daf..85c4e4cf 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -54,6 +54,7 @@ "Regge": FIAT.Regge, "Hellan-Herrmann-Johnson": FIAT.HellanHerrmannJohnson, "DPC": FIAT.DPC, + "BDMCE": FIAT.BrezziDouglasMariniCube, "S": FIAT.Serendipity, # These require special treatment below "DQ": None, diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index 8a8047f2..bd54ba95 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -58,6 +58,7 @@ "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, "DPC": finat.DPC, + "BDMCE": finat.BrezziDouglasMariniCube, "S": finat.Serendipity, # These require special treatment below "DQ": None, From 14c59021fce9949ac598b5db244dfd3317173330 Mon Sep 17 00:00:00 2001 From: cyruscycheng21 Date: Fri, 12 Jul 2019 11:34:39 +0100 Subject: [PATCH 4/9] register bdmc elements --- tsfc/fiatinterface.py | 3 ++- tsfc/finatinterface.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index 85c4e4cf..377d7dec 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -54,7 +54,8 @@ "Regge": FIAT.Regge, "Hellan-Herrmann-Johnson": FIAT.HellanHerrmannJohnson, "DPC": FIAT.DPC, - "BDMCE": FIAT.BrezziDouglasMariniCube, + "BDMCE": FIAT.BrezziDouglasMariniCubeEdge, + "BDMCF": FIAT.BrezziDouglasMariniCubeFace, "S": FIAT.Serendipity, # These require special treatment below "DQ": None, diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index bd54ba95..eaba84bf 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -58,7 +58,8 @@ "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, "DPC": finat.DPC, - "BDMCE": finat.BrezziDouglasMariniCube, + "BDMCE": finat.BrezziDouglasMariniCubeEdge, + "BDMCF": finat.BrezziDouglasMariniCubeFace, "S": finat.Serendipity, # These require special treatment below "DQ": None, From 4e12b53792d7e168d4d557e1468cad8329c05434 Mon Sep 17 00:00:00 2001 From: cyruscycheng21 Date: Thu, 15 Aug 2019 13:29:06 +0100 Subject: [PATCH 5/9] name correction --- tsfc/fiatinterface.py | 4 ++-- tsfc/finatinterface.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index 377d7dec..953145d3 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -54,8 +54,8 @@ "Regge": FIAT.Regge, "Hellan-Herrmann-Johnson": FIAT.HellanHerrmannJohnson, "DPC": FIAT.DPC, - "BDMCE": FIAT.BrezziDouglasMariniCubeEdge, - "BDMCF": FIAT.BrezziDouglasMariniCubeFace, + "BDMCE": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeEdge, + "BDMCF": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeFace, "S": FIAT.Serendipity, # These require special treatment below "DQ": None, diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index eaba84bf..30f0c673 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -58,8 +58,8 @@ "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, "DPC": finat.DPC, - "BDMCE": finat.BrezziDouglasMariniCubeEdge, - "BDMCF": finat.BrezziDouglasMariniCubeFace, + "BDMCE": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeEdge, + "BDMCF": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeFace, "S": finat.Serendipity, # These require special treatment below "DQ": None, From 8bfcd8b41c7e8147a47f5c3583f9c91b6fef663a Mon Sep 17 00:00:00 2001 From: cyruscycheng21 Date: Thu, 15 Aug 2019 13:37:00 +0100 Subject: [PATCH 6/9] register bdmc --- tsfc/fiatinterface.py | 4 ++-- tsfc/finatinterface.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index 953145d3..377d7dec 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -54,8 +54,8 @@ "Regge": FIAT.Regge, "Hellan-Herrmann-Johnson": FIAT.HellanHerrmannJohnson, "DPC": FIAT.DPC, - "BDMCE": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeEdge, - "BDMCF": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeFace, + "BDMCE": FIAT.BrezziDouglasMariniCubeEdge, + "BDMCF": FIAT.BrezziDouglasMariniCubeFace, "S": FIAT.Serendipity, # These require special treatment below "DQ": None, diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index 30f0c673..cdf9a337 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -58,8 +58,8 @@ "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, "DPC": finat.DPC, - "BDMCE": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeEdge, - "BDMCF": FIAT.BrezziDouglasMariniCube.BrezziDouglasMariniCubeFace, + "BDMCE": FIAT.BrezziDouglasMariniCubeEdge, + "BDMCF": FIAT.BrezziDouglasMariniCubeFace, "S": finat.Serendipity, # These require special treatment below "DQ": None, From 6ada0ae8d21ed71993428701e35f6062bc9e0082 Mon Sep 17 00:00:00 2001 From: cyruscycheng21 Date: Thu, 15 Aug 2019 13:38:53 +0100 Subject: [PATCH 7/9] register bdmc --- tsfc/finatinterface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index cdf9a337..eaba84bf 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -58,8 +58,8 @@ "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, "DPC": finat.DPC, - "BDMCE": FIAT.BrezziDouglasMariniCubeEdge, - "BDMCF": FIAT.BrezziDouglasMariniCubeFace, + "BDMCE": finat.BrezziDouglasMariniCubeEdge, + "BDMCF": finat.BrezziDouglasMariniCubeFace, "S": finat.Serendipity, # These require special treatment below "DQ": None, From 3fe6bbe93b013c81ee63530fbbb91a38aeadc6a3 Mon Sep 17 00:00:00 2001 From: Tom Bendall Date: Wed, 26 Jul 2023 13:19:01 +0100 Subject: [PATCH 8/9] update bdmc to ensure we are only adding BDMC spaces --- tsfc/finatinterface.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index d287ffcc..714d413e 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -44,7 +44,6 @@ "Discontinuous Raviart-Thomas": lambda c, d: finat.DiscontinuousElement(finat.RaviartThomas(c, d)), "Discontinuous Taylor": finat.DiscontinuousTaylor, "Gauss-Legendre": finat.GaussLegendre, - "Gauss-Legendre L2": finat.GaussLegendre, "Gauss-Lobatto-Legendre": finat.GaussLobattoLegendre, "HDiv Trace": finat.HDivTrace, "Hellan-Herrmann-Johnson": finat.HellanHerrmannJohnson, @@ -61,12 +60,8 @@ "Nedelec 2nd kind H(curl)": finat.NedelecSecondKind, "Raviart-Thomas": finat.RaviartThomas, "Regge": finat.Regge, - "DPC": finat.DPC, - "DPC L2": finat.DPC, "BDMCE": finat.BrezziDouglasMariniCubeEdge, "BDMCF": finat.BrezziDouglasMariniCubeFace, - "S": finat.Serendipity, - "Real": finat.DiscontinuousLagrange, # These require special treatment below "DQ": None, "Q": None, @@ -74,7 +69,7 @@ "RTCF": None, "NCE": None, "NCF": None, - "Real": finat.Real, + "Real": finat.DiscontinuousLagrange, "DPC": finat.DPC, "S": finat.Serendipity, "SminusF": finat.TrimmedSerendipityFace, @@ -195,6 +190,16 @@ def convert_finiteelement(element, **kwargs): return finat.RuntimeTabulated(cell, degree, variant=kind, shift_axes=shift_axes, restriction=restriction, continuous=False), deps else: raise ValueError("Variant %r not supported on %s" % (kind, element.cell())) + elif element.family() == ["DPC", "DPC L2"]: + if element.cell().geometric_dimension() == 2: + element = element.reconstruct(cell=ufl.cell.hypercube(2)) + elif element.cell().geometric_dimension() == 3: + element = element.reconstruct(cell=ufl.cell.hypercube(3)) + elif element.family() == "S": + if element.cell().geometric_dimension() == 2: + element = element.reconstruct(cell=ufl.cell.hypercube(2)) + elif element.cell().geometric_dimension() == 3: + element = element.reconstruct(cell=ufl.cell.hypercube(3)) return lmbda(cell, element.degree()), set() From a52e03f18b295edd695e4c04abbc367205754509 Mon Sep 17 00:00:00 2001 From: Tom Bendall Date: Wed, 26 Jul 2023 13:20:20 +0100 Subject: [PATCH 9/9] further minimise changes from this PR --- tsfc/finatinterface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index 714d413e..fb4e9cef 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -40,7 +40,6 @@ "FacetBubble": finat.FacetBubble, "Crouzeix-Raviart": finat.CrouzeixRaviart, "Discontinuous Lagrange": finat.DiscontinuousLagrange, - "Discontinuous Lagrange L2": finat.DiscontinuousLagrange, "Discontinuous Raviart-Thomas": lambda c, d: finat.DiscontinuousElement(finat.RaviartThomas(c, d)), "Discontinuous Taylor": finat.DiscontinuousTaylor, "Gauss-Legendre": finat.GaussLegendre, @@ -69,7 +68,7 @@ "RTCF": None, "NCE": None, "NCF": None, - "Real": finat.DiscontinuousLagrange, + "Real": finat.Real, "DPC": finat.DPC, "S": finat.Serendipity, "SminusF": finat.TrimmedSerendipityFace, @@ -200,6 +199,7 @@ def convert_finiteelement(element, **kwargs): element = element.reconstruct(cell=ufl.cell.hypercube(2)) elif element.cell().geometric_dimension() == 3: element = element.reconstruct(cell=ufl.cell.hypercube(3)) + return lmbda(cell, element.degree()), set()