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

Implement interpolation for quadrature elements #2878

Merged
merged 14 commits into from
Nov 22, 2023

Conversation

mscroggs
Copy link
Member

@mscroggs mscroggs commented Nov 7, 2023

Requires FEniCS/ffcx#634.

Resolves #1546.

Progress towards #2872

Copy link
Member

@jorgensd jorgensd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Should we maybe add an x-fail test for the case where one uses multiple quadrature elements (with different schemes) in the same code?

@chrisrichardson
Copy link
Contributor

I am a bit confused by the complexity of it - it seems to be adding more generated code (which we generally try to avoid) to pass data from basix via ffcx back to dolfinx. Is this avoidable?

@mscroggs
Copy link
Member Author

mscroggs commented Nov 7, 2023

I am a bit confused by the complexity of it - it seems to be adding more generated code (which we generally try to avoid) to pass data from basix via ffcx back to dolfinx. Is this avoidable?

Writing the quadrature rules into the generated code is definitely necessary.

We could avoid writing the map type into generated code if we make the assumption that elements with custom quadrature always use an identity pullback. This feels dangerous though.

The key issue is that quadrature elements are only defined in Python, so we need to write what we need into the generated code so that C++ can get hold of it

@jorgensd
Copy link
Member

jorgensd commented Nov 7, 2023

We could avoid writing the map type into generated code if we make the assumption that elements with custom quadrature always use an identity pullback. This feels dangerous though.

I'm not sure it is dangerous. QuadratureElements isn't really a finite element (as discussed earlier), and is a way of representing data at points. Having a pull back != identity on point data seems strange.

@mscroggs
Copy link
Member Author

mscroggs commented Nov 7, 2023

We could avoid writing the map type into generated code if we make the assumption that elements with custom quadrature always use an identity pullback. This feels dangerous though.

I'm not sure it is dangerous. QuadratureElements isn't really a finite element (as discussed earlier), and is a way of representing data at points. Having a pull back != identity on point data seems strange.

The danger I'm worried about it that we're not checking if it's a quadrature element, we're checking if there's a custom quadrature rule. If at some point in the future we decided to implement (eg) a Nedelec-style element that has a custom quadrature rule (for whatever reason), this would lead to odd behaviour.

@mscroggs
Copy link
Member Author

mscroggs commented Nov 7, 2023

We could avoid writing the map type into generated code if we make the assumption that elements with custom quadrature always use an identity pullback. This feels dangerous though.

I'm not sure it is dangerous. QuadratureElements isn't really a finite element (as discussed earlier), and is a way of representing data at points. Having a pull back != identity on point data seems strange.

The danger I'm worried about it that we're not checking if it's a quadrature element, we're checking if there's a custom quadrature rule. If at some point in the future we decided to implement (eg) a Nedelec-style element that has a custom quadrature rule (for whatever reason), this would lead to odd behaviour.

I've changed it to check whether the element is a quadrature element directly, so no longer any need to worry about possible other future uses of custom quadrature

@jorgensd
Copy link
Member

Could we merge this?

@mscroggs mscroggs added this pull request to the merge queue Nov 22, 2023
Merged via the queue into main with commit b332d37 Nov 22, 2023
20 checks passed
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.

Interpolation into Quadrature (non-basix) element
4 participants