Skip to content

Commit

Permalink
Apparently, there was a off-by-one error issue when interpolating. Th…
Browse files Browse the repository at this point in the history
…is is now fixed.
  • Loading branch information
ThomasCeulemans committed Nov 7, 2024
1 parent a77f195 commit 8a46c7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inline void CollisionPartner ::interpolate_collision_coefficients(const Real tem
if (t == 0) {
Ce_intpld() = Ce[0];
Cd_intpld() = Cd[0];
} else if (t == ntmp - 1) {
} else if (t == ntmp) {
Ce_intpld() = Ce[ntmp - 1];
Cd_intpld() = Cd[ntmp - 1];
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/interpolation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "tools/types.hpp"

/// Binary search for the index of a value right above a value in a list
/// Binary search for the index with value just above the given value
/// @param[in] x: vector of tabulated argument values
/// @param[in] value: value to search for
/// @return index of x table just above value
Expand All @@ -12,7 +12,7 @@ inline Size search(const Real1& x, const Real value) {
Size stop = x.size() - 1;

if (value >= x[stop]) {
return stop;
return stop + 1; // need additional value to indicate out of bounds for max value
} else if (value <= x[start]) {
return start;
}
Expand Down

0 comments on commit 8a46c7c

Please sign in to comment.