Skip to content

Fix extract_subelement_component#122

Merged
dham merged 11 commits intoreleasefrom
pbrubeck/fix/subelement
Feb 5, 2026
Merged

Fix extract_subelement_component#122
dham merged 11 commits intoreleasefrom
pbrubeck/fix/subelement

Conversation

@pbrubeck
Copy link
Copy Markdown

@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.

Fixes #105

@angus-g
Copy link
Copy Markdown

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
@pbrubeck pbrubeck changed the base branch from master to release July 19, 2025 21:37
@pbrubeck pbrubeck force-pushed the pbrubeck/fix/subelement branch from 37c19ce to 1c0dd09 Compare February 5, 2026 12:04
@pbrubeck pbrubeck force-pushed the pbrubeck/fix/subelement branch from 1c0dd09 to c9704c3 Compare February 5, 2026 14:08
@dham dham merged commit 273dfa8 into release Feb 5, 2026
8 checks passed
@dham dham deleted the pbrubeck/fix/subelement branch February 5, 2026 16: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.

MixedElement broken by recent UFL changes

3 participants