Skip to content

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.

Fixes #105

@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
@pbrubeck pbrubeck changed the base branch from master to release July 19, 2025 21:37
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