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 #332 from firedrakeproject/pbrubeck/fix/variants
Browse files Browse the repository at this point in the history
Clean up variants
  • Loading branch information
pbrubeck authored Nov 25, 2024
2 parents 31cca14 + 5c6680c commit 796c0e8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tsfc/finatinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def convert_finiteelement(element, **kwargs):
finat_elem, deps = _create_element(element, **kwargs)
return finat.FlattenedDimensions(finat_elem), deps

kw = {}
finat_kwargs = {}
kind = element.variant()
if kind is None:
kind = 'spectral' # default variant
Expand All @@ -182,9 +182,9 @@ def convert_finiteelement(element, **kwargs):
lmbda = finat.GaussLobattoLegendre
elif element.cell.cellname() == "interval" and kind in cg_interval_variants:
lmbda = cg_interval_variants[kind]
elif kind.startswith('integral') or kind in ['demkowicz', 'fdm']:
elif any(map(kind.startswith, ['integral', 'demkowicz', 'fdm'])):
lmbda = finat.IntegratedLegendre
kw["variant"] = kind
finat_kwargs["variant"] = kind
elif kind in ['mgd', 'feec', 'qb', 'mse']:
degree = element.degree()
shift_axes = kwargs["shift_axes"]
Expand All @@ -194,16 +194,16 @@ def convert_finiteelement(element, **kwargs):
else:
# Let FIAT handle the general case
lmbda = finat.Lagrange
kw["variant"] = kind
finat_kwargs["variant"] = kind

elif element.family() in ["Discontinuous Lagrange", "Discontinuous Lagrange L2"]:
if kind == 'spectral':
lmbda = finat.GaussLegendre
elif element.cell.cellname() == "interval" and kind in dg_interval_variants:
lmbda = dg_interval_variants[kind]
elif kind.startswith('integral') or kind in ['demkowicz', 'fdm']:
elif any(map(kind.startswith, ['integral', 'demkowicz', 'fdm'])):
lmbda = finat.Legendre
kw["variant"] = kind
finat_kwargs["variant"] = kind
elif kind in ['mgd', 'feec', 'qb', 'mse']:
degree = element.degree()
shift_axes = kwargs["shift_axes"]
Expand All @@ -213,12 +213,12 @@ def convert_finiteelement(element, **kwargs):
else:
# Let FIAT handle the general case
lmbda = finat.DiscontinuousLagrange
kw["variant"] = kind
finat_kwargs["variant"] = kind

elif element.variant() is not None:
kw["variant"] = element.variant()
finat_kwargs["variant"] = element.variant()

return lmbda(cell, element.degree(), **kw), set()
return lmbda(cell, element.degree(), **finat_kwargs), set()


# Element modifiers and compound element types
Expand Down

0 comments on commit 796c0e8

Please sign in to comment.