Fix distance threshold bug ScalarInterp#2010
Open
dragos-ana wants to merge 1 commit into4C-multiphysics:mainfrom
Open
Fix distance threshold bug ScalarInterp#2010dragos-ana wants to merge 1 commit into4C-multiphysics:mainfrom
dragos-ana wants to merge 1 commit into4C-multiphysics:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes scalar interpolation weight normalization when the interpolation location is (nearly) coincident with a reference location by ensuring a single reference gets weight 1.0 and all others are reset to 0.0.
Changes:
- Update
calculate_normalized_weights()to reset all weights to0.0and stop processing as soon as a reference point is withindistance_threshold. - Remove the post-pass that tried to detect
weight == 1.0after the fact. - Add unit tests covering the “at reference location” behavior for inverse-distance and exponential weighting.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/core/linalg/tests/4C_linalg_utils_scalar_interpolation_test.cpp | Adds new tests that assert exactly one unit weight when interpolating at reference locations. |
| src/core/linalg/src/dense/4C_linalg_utils_scalar_interpolation.hpp | Clarifies the intended semantics of distance_threshold in the parameter struct. |
| src/core/linalg/src/dense/4C_linalg_utils_scalar_interpolation.cpp | Implements the corrected “coincident point => one-hot weights” logic inside the weighting loops. |
Fixed calculation of normalized weights within the scalar interpolation framework, if the interpolation location is within a distance threshold wrt a reference location. In that case, the weight at the specific location is directly set to 1.0 AND the other weights are reset to 0.0. The previous approach also enabled multiple 1.0 weights, and only the first detected 1.0 was kept. Unit tests were added to test the bugfix; these tests would have previously failed.
b23648c to
c631e0b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed calculation of normalized weights within the scalar interpolation framework, if the interpolation location is within a distance threshold wrt a reference location.
In that case, the weight of that specific reference point is directly set to 1.0 AND the other weights are reset to 0.0. The previous approach also enabled multiple 1.0 weights, and only the first detected 1.0 was kept.
Unit tests were added to test the bugfix; these tests would have previously failed because the weights would have always been {1.0, 0.0} regardless of the interpolation location 0.0 or 1.0.