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

Fold Ferrite.value into methods of shape_value #721

Merged
merged 1 commit into from
May 22, 2023

Conversation

fredrikekre
Copy link
Member

This patch deprecates Ferrite.value(ip::Interpolation, i::Int, ξ::Vec) in favor of shape_value(ip::Interpolation, ξ::Vec, i::Int). Note that the argument order is flipped to resemble the (Cell|Face)Values API more. Compare e.g. shape_value(ip, ξ, i) with shape_value(cv, qp, i): the second argument becomes the "quadrature point" argument (ξ ~ qp), and the third argument is the shape function index, in both cases.

Since shape_value is exported this introduces new (public) functionality to users -- for some applications it is nice to be able to evaluate the shape functions in the reference domain without having to go through CellValues. For the same reason this patch also adds the method shape_gradient(ip::Interpolation, ξ::Vec, i::Int) which falls back to AD from Tensors.jl.

Fixes #609.

Copy link
Collaborator

@lijas lijas left a comment

Choose a reason for hiding this comment

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

I think this is a good change. For example in problems with contact or mortar methods I think it is common to eval the shape functions directly (and to not pre-compute the shape functions using e.g CellValues)

src/interpolations.jl Outdated Show resolved Hide resolved
src/interpolations.jl Show resolved Hide resolved
This patch deprecates `Ferrite.value(ip::Interpolation, i::Int, ξ::Vec)`
in favor of `shape_value(ip::Interpolation, ξ::Vec, i::Int)`. Note that
the argument order is flipped to resemble the `(Cell|Face)Values` API
more. Compare e.g. `shape_value(ip, ξ, i)` with `shape_value(cv, qp,
i)`: the second argument becomes the "quadrature point" argument (`ξ` ~
`qp`), and the third argument is the shape function index, in both
cases.

Since `shape_value` is exported this introduces new (public)
functionality to users -- for some applications it is nice to be able to
evaluate the shape functions in the reference domain without having to
go through `CellValues`. For the same reason this patch also adds the
method `shape_gradient(ip::Interpolation, ξ::Vec, i::Int)` which falls
back to AD from Tensors.jl.

Fixes #609.
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.33 ⚠️

Comparison is base (240cd94) 92.24% compared to head (30a144c) 91.92%.

❗ Current head 30a144c differs from pull request most recent head bdbcbca. Consider uploading reports for the commit bdbcbca to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #721      +/-   ##
==========================================
- Coverage   92.24%   91.92%   -0.33%     
==========================================
  Files          30       30              
  Lines        4529     4530       +1     
==========================================
- Hits         4178     4164      -14     
- Misses        351      366      +15     
Impacted Files Coverage Δ
src/deprecations.jl 52.00% <ø> (+0.34%) ⬆️
src/FEValues/cell_values.jl 100.00% <100.00%> (ø)
src/FEValues/face_values.jl 100.00% <100.00%> (ø)
src/PointEval/PointEvalHandler.jl 91.17% <100.00%> (-0.59%) ⬇️
src/PointEval/point_values.jl 97.36% <100.00%> (ø)
src/interpolations.jl 97.89% <100.00%> (+<0.01%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fredrikekre fredrikekre merged commit 02e20df into master May 22, 2023
@fredrikekre fredrikekre deleted the fe/value-to-shape_value branch May 22, 2023 15:28
@KnutAM
Copy link
Member

KnutAM commented May 22, 2023

Not sure if it makes sense, but at least worth considering IMO;
should we then also support the remaining

  • shape_symmetric_gradient
  • shape_divergence
  • shape_curl

with the same interface? The current implementation could just be on top using the tensor operations, but it might be possible to have some optimized implementations in the future.

@fredrikekre
Copy link
Member Author

Maybe, note that these return unmapped values, so not sure how useful it is?

@fredrikekre
Copy link
Member Author

Perhaps this should have been shape_reference_value so that we can have methods for queruing the same on FEValues

fredrikekre added a commit that referenced this pull request Jun 28, 2024
…lue`

This patch is a follow up to #721 and replaces `shape_value`,
`shape_gradient` etc for interpolations, which return evaluations in the
reference domain, with new functions `reference_shape_value`,
`reference_shape_gradient`, etc. The new functions are public but not
exported.

Separating these functions make it possible to support
`reference_shape_value` etc for `CellValues` too in the future.
fredrikekre added a commit that referenced this pull request Jun 28, 2024
…lue` (#997)

This patch is a follow up to #721 and replaces `shape_value`,
`shape_gradient` etc for interpolations, which return evaluations in the
reference domain, with new functions `reference_shape_value`,
`reference_shape_gradient`, etc. The new functions are public but not
exported.

Separating these functions make it possible to support
`reference_shape_value` etc for `CellValues` too in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename Ferrite.value and Ferrite.derivative
4 participants