Refactor get_energy_index to prevent repetition (#3686)

This commit is contained in:
GuySten 2025-12-23 22:18:59 +02:00 committed by GitHub
parent a2fd6cc57e
commit 3f06a42abb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 55 deletions

View file

@ -9,6 +9,7 @@
#include <cstdlib>
#include "openmc/position.h"
#include "openmc/search.h"
namespace openmc {
@ -200,5 +201,15 @@ std::complex<double> faddeeva(std::complex<double> z);
//! \return Derivative of Faddeeva function evaluated at z
std::complex<double> w_derivative(std::complex<double> z, int order);
//! Helper function to get index and interpolation function on an incident
//! energy grid
//!
//! \param energies energy grid
//! \param E incident energy
//! \param i grid index
//! \param f interpolation factor
void get_energy_index(
const vector<double>& energies, double E, int& i, double& f);
} // namespace openmc
#endif // OPENMC_MATH_FUNCTIONS_H