Repository navigation
Interpolate - #515
Draft
schnellerhase wants to merge 4 commits into
Draft
Interpolate#515schnellerhase wants to merge 4 commits into
schnellerhase wants to merge 4 commits into
Conversation
pbrubeck
reviewed
Sep 20, 2026
Comment on lines
+161
to
+168
| def target_space(self) -> AbstractFunctionSpace: | ||
| """Return the function space that the expression is interpolated into. | ||
|
|
||
| Unlike `ufl_function_space` this does not depend on the argument | ||
| numbering, so it stays correct when the interpolated expression holds an | ||
| argument of the enclosing form. | ||
| """ | ||
| return self._function_space |
Contributor
There was a problem hiding this comment.
What does this mean for the adjoint, i.e. Interpolate(Argument, Cofunction)?
pbrubeck
reviewed
Sep 20, 2026
| raise ValueError("Same argument numbers in first and second operands to interpolate.") | ||
| if expr_arg_numbers | dual_arg_numbers not in [set(), {0}, {0, 1}]: | ||
| argument_numbers = expr_arg_numbers | dual_arg_numbers | ||
| if argument_numbers and argument_numbers != set(range(len(argument_numbers))): |
Contributor
There was a problem hiding this comment.
why do we need this check? I think the main purpose is to ensure unique argument numbers, but we should not be constraining the arguments to always start from 0 and be contiguous.
pbrubeck
reviewed
Sep 20, 2026
| n = 1 if expr_arg_numbers == {0} else 0 | ||
| # Take the lowest free number, so that an expression linear in | ||
| # several arguments stays representable. | ||
| n = min(set(range(len(expr_arg_numbers) + 1)) - expr_arg_numbers) |
Contributor
There was a problem hiding this comment.
We should add tests for this
pbrubeck
reviewed
Sep 20, 2026
| of its target space, and the expression it interpolates is evaluated | ||
| separately. | ||
| """ | ||
| return expr._ufl_is_terminal_ or isinstance(expr, Interpolate) |
Contributor
There was a problem hiding this comment.
this pattern repeats through other files. I don't agree with the name. In which sense are terminals "modifiable"?
pbrubeck
reviewed
Sep 20, 2026
| operator is linear in it, instead of recording the derivative as an | ||
| action to be assembled separately. This composes to higher | ||
| derivatives and keeps the result an ordinary form, which a form | ||
| compiler that evaluates the operator cell-locally needs. |
Contributor
There was a problem hiding this comment.
Is this needed to enable derivative(interpolate(u, V1)*dx, u)? Should this be the default?
4 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supporting FEniCS/ffcx#881.