-
Notifications
You must be signed in to change notification settings - Fork 92
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
Higher order gradients in CellValues #938
Conversation
Just posting idea from Slack here for a type-stable struct ValuesUpdateFlags{FunDiffOrder, GeoDiffOrder, DetJdV} end
function ValuesUpdateFlags(ip_fun; update_gradients, update_hessians, update_detJdV)
if update_gradients === update_hessians === update_detJdV === nothing
return ValuesUpdateFlags{1, required_geo_diff_order(mapping_type(ip_fun), 1), true}() # default input till `CellValues`
else
FunDiffOrder = update_hessians ? 2 : (update_gradients ? 1 : 0)
GeoDiffOrder = max(required_geo_diff_order(mapping_type(ip_fun), FunDiffOrder), update_detJdV)
return ValuesUpdateFlags{FunDiffOrder, GeoDiffOrder, update_detJdV}()
end
end |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #938 +/- ##
==========================================
- Coverage 93.71% 93.69% -0.03%
==========================================
Files 36 36
Lines 5313 5438 +125
==========================================
+ Hits 4979 5095 +116
- Misses 334 343 +9 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked the derivations - nice job! Didn't spot anything being off. Only a few suggestions for a bit clearer formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice @lijas.
Co-authored-by: Knut Andreas Meyer <[email protected]>
Co-authored-by: Knut Andreas Meyer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after fixing these comments + the CI format/imports complaints 🚀
I suggest documenting this option as experimental simply to be a bit defensive on committing to the keyword interface before we have tested that a bit in practice (since it inevitabily leads to a type-unstable constructor when provided). But perhaps I'm overly careful here?
src/FEValues/CellValues.jl
Outdated
@@ -1,5 +1,5 @@ | |||
""" | |||
CellValues([::Type{T},] quad_rule::QuadratureRule, func_interpol::Interpolation, [geom_interpol::Interpolation]) | |||
CellValues([::Type{T},] quad_rule::QuadratureRule, func_interpol::Interpolation, [geom_interpol::Interpolation]; update_detJdV=true, update_gradients=true, update_hessians=false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CellValues([::Type{T},] quad_rule::QuadratureRule, func_interpol::Interpolation, [geom_interpol::Interpolation]; update_detJdV=true, update_gradients=true, update_hessians=false) | |
CellValues([::Type{T},] quad_rule::QuadratureRule, func_interpol::Interpolation, [geom_interpol::Interpolation]) |
Co-authored-by: Knut Andreas Meyer <[email protected]>
test/test_facevalues.jl
Outdated
end | ||
@test function_value(fv, i, u_vector) ≈ (@test_deprecated function_value(fv, i, u)) | ||
function_value(fv, i, ue_vec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gives a warning because it is deprecated, why is this teste removed and there is just a function call?
New version of #891 so that I can see preview of docs. I also needed to rebase on master
Implementation of higher order gradients in CellValues. This was quite easy to do thanks to Knuts new FunctionValues and GeometryMapping.