Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extract_subelement_component #122

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

pbrubeck
Copy link

@pbrubeck pbrubeck commented Dec 19, 2024

Some under-used methods for ufl elements broke after the gdim / value_shape ufl API changes.

Here we fix (and test) these methods, with an optional domain kwarg.

This includes ufl_element.value_shape(domain). Note that value_shape used to be an attribute, and now passing domain=None should work fine for non-Piola mapped elements.

@angus-g
Copy link

angus-g commented Jan 15, 2025

I think this still needs the tweak to value_shape (I don't really understand how value_shape(gdim) and reference_value_shape differ, other than the former no longer existing):

  File "/home/firedrake/g-adopt/gadopt/utility.py", line 163, in is_continuous
    sub_element_index, _ = elem.extract_subelement_component(mesh, int(expr.ufl_operands[1][0]))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/firedrake/firedrake/src/fiat/finat/ufl/mixedelement.py", line 145, in extract_subelement_component
    self._check_component(domain, i)
  File "/home/firedrake/firedrake/src/fiat/finat/ufl/finiteelementbase.py", line 146, in _check_component
    sh = self.value_shape(domain.geometric_dimension())
         ^^^^^^^^^^^^^^^^
AttributeError: 'MixedElement' object has no attribute 'value_shape'

@pbrubeck pbrubeck force-pushed the pbrubeck/fix/subelement branch from 3434ebe to 2497ade Compare January 15, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants