Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #202 from firedrakeproject/default_spectral
Browse files Browse the repository at this point in the history
Default spectral
  • Loading branch information
dham authored Nov 28, 2019
2 parents e984c90 + 7abd5e9 commit e1a2c17
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/test_create_fiat_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def test_tensor_prod_simple(ufl_A, ufl_B):


@pytest.mark.parametrize(('family', 'expected_cls'),
[('P', FIAT.Lagrange),
('DP', FIAT_DiscontinuousLagrange),
('DP L2', FIAT_DiscontinuousLagrange)])
[('P', FIAT.GaussLobattoLegendre),
('DP', FIAT.GaussLegendre),
('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)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_create_finat_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def test_tensor_prod_simple(ufl_A, ufl_B):


@pytest.mark.parametrize(('family', 'expected_cls'),
[('P', finat.Lagrange),
('DP', finat.DiscontinuousLagrange),
('DP L2', finat.DiscontinuousLagrange)])
[('P', finat.GaussLobattoLegendre),
('DP', finat.GaussLegendre),
('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)
Expand Down
2 changes: 1 addition & 1 deletion tsfc/fiatinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,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':
Expand Down
3 changes: 1 addition & 2 deletions tsfc/finatinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,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':
Expand All @@ -144,7 +144,6 @@ def convert_finiteelement(element, **kwargs):
else:
raise ValueError("Variant %r not supported on %s" % (kind, element.cell()))
elif element.family() in ["Discontinuous Lagrange", "Discontinuous Lagrange L2"]:
kind = element.variant() or 'equispaced'
if kind == 'equispaced':
lmbda = finat.DiscontinuousLagrange
elif kind == 'spectral' and element.cell().cellname() == 'interval':
Expand Down

0 comments on commit e1a2c17

Please sign in to comment.