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 the FormSum!? #3897

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Fix the FormSum!? #3897

wants to merge 5 commits into from

Conversation

Ig-dolci
Copy link
Contributor

@Ig-dolci Ig-dolci commented Nov 28, 2024

Description

No.

Copy link

github-actions bot commented Nov 28, 2024

TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake complex8125 ran6527 passed1585 skipped13 failed

Copy link

github-actions bot commented Nov 28, 2024

TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake real8131 ran7331 passed786 skipped14 failed

@JHopeCollins
Copy link
Member

Oh dear, if this fixes the issue then that interface could do with updating!

I think that the traversal method is taking advantage of the behaviour described here: #3348 (comment)

This behaviour is not widely known and is quite unintuitive - it's usually considered a bug. It might be best to change this method signature (and the preorder traversal method) to use visited=None as the kwarg, and use a self._visited dict with visited = visited if visited else self._visited

@Ig-dolci
Copy link
Contributor Author

Oh dear, if this fixes the issue then that interface could do with updating!

I think that the traversal method is taking advantage of the behaviour described here: #3348 (comment)

This behaviour is not widely known and is quite unintuitive - it's usually considered a bug. It might be best to change this method signature (and the preorder traversal method) to use visited=None as the kwarg, and use a self._visited dict with visited = visited if visited else self._visited

No. This does not fix it. I am still debugging.

@JHopeCollins
Copy link
Member

No. This does not fix it. I am still debugging.

Shame it wasn't so simple! It may still be good to change the signatures to avoid that behaviour though

@Ig-dolci
Copy link
Contributor Author

Oh dear, if this fixes the issue then that interface could do with updating!

I think that the traversal method is taking advantage of the behaviour described here: #3348 (comment)

This behaviour is not widely known and is quite unintuitive - it's usually considered a bug. It might be best to change this method signature (and the preorder traversal method) to use visited=None as the kwarg, and use a self._visited dict with visited = visited if visited else self._visited

I see. I gonna try visited=None.

@@ -584,7 +583,8 @@ def update_tensor(assembled_base_form, tensor):
raise NotImplementedError("Cannot update tensor of type %s" % type(tensor))

@staticmethod
def base_form_postorder_traversal(expr, visitor, visited={}):
def base_form_postorder_traversal(expr, visitor, visited=None):
visited = visited if visited is not None else {}
Copy link
Member

Choose a reason for hiding this comment

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

To have the same caching behaviour as before, without the {} default kwarg, this should stash visited as an attribute so it get's reused unless the user passes visited, e.g.

visited = visited if visited is not None else self._visited

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