-
Notifications
You must be signed in to change notification settings - Fork 177
Open
Labels
Description
Describe the current issue
In some parts of the code (e.g. interpolation-based (native) multigrid transfers) we need to detect whether an element has been defined using point evaluation degrees of freedom. Currently, we rely on hard-coded lists of the families and variants that are defined in such way, and we test UFL element attributes to verify this condition.
Describe the solution you'd like
An automated approach is to query the dual basis of a FInAT element as it is done in bddc.py
firedrake/firedrake/preconditioners/bddc.py
Lines 179 to 198 in 125d076
| def is_lagrange(finat_element): | |
| """Returns whether finat_element.dual_basis consists only of point evaluation dofs.""" | |
| try: | |
| Q, ps = finat_element.dual_basis | |
| except NotImplementedError: | |
| return False | |
| # Inspect the weight matrix | |
| # Lagrange elements have gem.Delta as the only terminal nodes | |
| children = [Q] | |
| while children: | |
| nodes = [] | |
| for c in children: | |
| if isinstance(c, gem.Delta): | |
| pass | |
| elif isinstance(c, gem.gem.Terminal): | |
| return False | |
| else: | |
| nodes.extend(c.children) | |
| children = nodes | |
| return True |
We should consider moving this code to FInAT for conveninence.