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 wrong usage of shape_value_type #1160

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

Conversation

KnutAM
Copy link
Member

@KnutAM KnutAM commented Feb 24, 2025

Want to see test coverage first, and then should add test that catches this (unless I thought something wrong here - could you check @lijas?)

Minor additions to interpolation testing
Copy link

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.75%. Comparing base (6eead25) to head (5f0b0f8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1160   +/-   ##
=======================================
  Coverage   93.74%   93.75%           
=======================================
  Files          39       39           
  Lines        6238     6240    +2     
=======================================
+ Hits         5848     5850    +2     
  Misses        390      390           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lijas
Copy link
Collaborator

lijas commented Feb 25, 2025

The function shape_value_type and your newly added _function_value_type does basically the same thing, so i dont understand what this fixes?

@KnutAM
Copy link
Member Author

KnutAM commented Feb 25, 2025

The way I understand is that

  • shape_value_type(ip, T): "Return the type of shape_value(ip::Interpolation, ξ::Vec, ib::Int)." (from docstring, should be reference_shape_value and ξ::Vec{rdim, T} AFAIU)
  • _function_value_type: Returns the type of sum(i -> reference_shape_value(ip, ξ, i) * u[i], 1:getnbasefunctions(ip))

So the difference would occur if the eltype of u would be a tensor, because shape_value_type(ip::ScalarInterpolation, T::Type{<:AbstractTensor}) is not defined, while function_value_type(ip::ScalarInterpolation, ::AbstractVector{<:AbstractTensor}) is.

I was surprised so perhaps we are never supposed reach this case in the code here (discovered it when working with #1161 where such a function became useful for the same purpose as used here).

@lijas
Copy link
Collaborator

lijas commented Feb 26, 2025

Ah I see, _evaluate_at_grid_nodes can evaluate with tensors also (not only the solution vector). Yes, then this makes sense.

@fredrikekre
Copy link
Member

Can function_value_init be used?

Copy link
Member Author

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

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

@fredrikekre's review comments

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.

3 participants