From f3b02ab78e687b3eacbfb57db2f2f7c634e8d287 Mon Sep 17 00:00:00 2001 From: David Ham Date: Tue, 30 Apr 2019 11:11:45 +0100 Subject: [PATCH 1/4] Switch to spectral representation by default --- tsfc/fiatinterface.py | 2 +- tsfc/finatinterface.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsfc/fiatinterface.py b/tsfc/fiatinterface.py index e0c70f78..65426c79 100644 --- a/tsfc/fiatinterface.py +++ b/tsfc/fiatinterface.py @@ -124,7 +124,7 @@ def convert_finiteelement(element, vector_is_mixed): kind = element.variant() if kind is None: - kind = 'equispaced' # default variant + kind = 'spectral' if element.cell().cellname() == 'interval' else 'equispaced' # default variant if element.family() == "Lagrange": if kind == 'equispaced': diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index d371605f..b3a30b33 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -124,7 +124,7 @@ def convert_finiteelement(element, **kwargs): kind = element.variant() if kind is None: - kind = 'equispaced' # default variant + kind = 'spectral' if element.cell().cellname() == 'interval' else 'equispaced' # default variant if element.family() == "Lagrange": if kind == 'equispaced': From 41793c8b653c3152ce5348229cd0d53542b722ce Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 2 May 2019 13:51:26 +0100 Subject: [PATCH 2/4] Remove erroneous element variant check --- tsfc/finatinterface.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tsfc/finatinterface.py b/tsfc/finatinterface.py index b3a30b33..45551c17 100644 --- a/tsfc/finatinterface.py +++ b/tsfc/finatinterface.py @@ -140,7 +140,6 @@ def convert_finiteelement(element, **kwargs): else: raise ValueError("Variant %r not supported on %s" % (kind, element.cell())) elif element.family() == "Discontinuous Lagrange": - kind = element.variant() or 'equispaced' if kind == 'equispaced': lmbda = finat.DiscontinuousLagrange elif kind == 'spectral' and element.cell().cellname() == 'interval': From ced88e17a5c16ea635caa84ac02aeb510e6c1851 Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 9 May 2019 10:28:18 +0100 Subject: [PATCH 3/4] Change default variant in tests --- tests/test_create_fiat_element.py | 4 ++-- tests/test_create_finat_element.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_create_fiat_element.py b/tests/test_create_fiat_element.py index c8989733..608a9c66 100644 --- a/tests/test_create_fiat_element.py +++ b/tests/test_create_fiat_element.py @@ -61,8 +61,8 @@ def test_tensor_prod_simple(ufl_A, ufl_B): @pytest.mark.parametrize(('family', 'expected_cls'), - [('P', FIAT.Lagrange), - ('DP', FIAT_DiscontinuousLagrange)]) + [('P', FIAT.GaussLobattoLegendre), + ('DP', FIAT.GaussLegendre)]) def test_interval_variant_default(family, expected_cls): ufl_element = ufl.FiniteElement(family, ufl.interval, 3) assert isinstance(create_element(ufl_element), expected_cls) diff --git a/tests/test_create_finat_element.py b/tests/test_create_finat_element.py index e135576d..f4025554 100644 --- a/tests/test_create_finat_element.py +++ b/tests/test_create_finat_element.py @@ -69,8 +69,8 @@ def test_tensor_prod_simple(ufl_A, ufl_B): @pytest.mark.parametrize(('family', 'expected_cls'), - [('P', finat.Lagrange), - ('DP', finat.DiscontinuousLagrange)]) + [('P', finat.GaussLobattoLegendre), + ('DP', finat.GaussLegendre)]) def test_interval_variant_default(family, expected_cls): ufl_element = ufl.FiniteElement(family, ufl.interval, 3) assert isinstance(create_element(ufl_element), expected_cls) From 7abd5e95e331e204537b4d4512102a108e78618c Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 7 Nov 2019 17:19:40 -0300 Subject: [PATCH 4/4] fix tests --- tests/test_create_fiat_element.py | 2 +- tests/test_create_finat_element.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_create_fiat_element.py b/tests/test_create_fiat_element.py index c1bb5637..0271e8ba 100644 --- a/tests/test_create_fiat_element.py +++ b/tests/test_create_fiat_element.py @@ -63,7 +63,7 @@ def test_tensor_prod_simple(ufl_A, ufl_B): @pytest.mark.parametrize(('family', 'expected_cls'), [('P', FIAT.GaussLobattoLegendre), ('DP', FIAT.GaussLegendre), - ('DP L2', FIAT_DiscontinuousLagrange)]) + ('DP L2', FIAT.GaussLegendre)]) def test_interval_variant_default(family, expected_cls): ufl_element = ufl.FiniteElement(family, ufl.interval, 3) assert isinstance(create_element(ufl_element), expected_cls) diff --git a/tests/test_create_finat_element.py b/tests/test_create_finat_element.py index 55e17804..2f937a86 100644 --- a/tests/test_create_finat_element.py +++ b/tests/test_create_finat_element.py @@ -71,7 +71,7 @@ def test_tensor_prod_simple(ufl_A, ufl_B): @pytest.mark.parametrize(('family', 'expected_cls'), [('P', finat.GaussLobattoLegendre), ('DP', finat.GaussLegendre), - ('DP L2', finat.DiscontinuousLagrange)]) + ('DP L2', finat.GaussLegendre)]) def test_interval_variant_default(family, expected_cls): ufl_element = ufl.FiniteElement(family, ufl.interval, 3) assert isinstance(create_element(ufl_element), expected_cls)