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

Transform global derivatives of Jacobian to reference derivatives in preprocessed_form #63

Merged
merged 11 commits into from
Jul 7, 2021

Conversation

jpdean
Copy link
Member

@jpdean jpdean commented Jul 5, 2021

This PR fixes #62 and FEniCS/ffcx#373.

@@ -593,6 +591,25 @@ def _grad(self, o):
# 1) n = count number of Grads, get f
# 2) if not f.has_derivatives(n): return zero(...)

def _grad_to_reference_grad(self, o, K):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick, this function doesn't need self I think, so could it just be a free function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! I put it there because it is only used by the GradRuleset class, but I'm happy to move it

Override for specific types if other behaviour is needed."""
if is_cellwise_constant(o):
return self.independent_terminal(o)
else:
# TODO: Which types does this involve? I don't think the
# form compilers will handle this.
return Grad(o)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can also remove the TODO comment?

Copy link
Collaborator

@wence- wence- left a comment

Choose a reason for hiding this comment

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

Thanks! Modulo minor comments I think this looks right.

@garth-wells garth-wells merged commit 94badf8 into main Jul 7, 2021
@garth-wells garth-wells deleted the jpdean/jacobian_deriv_fix branch July 7, 2021 16:03
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.

preprocessed_form contains global derivatives of the Jacobian
3 participants