diff --git a/include/openmc/interpolate.h b/include/openmc/interpolate.h index 3f5d2d361e..8ccdc5bd74 100644 --- a/include/openmc/interpolate.h +++ b/include/openmc/interpolate.h @@ -34,8 +34,8 @@ inline double interpolate_log_log( return y0 * exp(f * log(y1 / y0)); } -inline double interpolate_lagrangian( - const std::vector& xs, const std::vector& ys, int idx, double x, int order) +inline double interpolate_lagrangian(const std::vector& xs, + const std::vector& ys, int idx, double x, int order) { std::vector coeffs; @@ -55,9 +55,8 @@ inline double interpolate_lagrangian( coeffs.begin(), coeffs.end(), ys.begin() + idx, 0.0); } -double interpolate(const std::vector& xs, - const std::vector& ys, double x, - Interpolation i = Interpolation::lin_lin) +double interpolate(const std::vector& xs, const std::vector& ys, + double x, Interpolation i = Interpolation::lin_lin) { int idx = lower_bound_index(xs.begin(), xs.end(), x); @@ -75,20 +74,22 @@ double interpolate(const std::vector& xs, return interpolate_log_lin(xs[idx], xs[idx + 1], ys[idx], ys[idx + 1], x); case Interpolation::quadratic: // move back one point if x is in the last interval of the x-grid - if (idx == xs.size() - 2 && idx > 0) idx--; + if (idx == xs.size() - 2 && idx > 0) + idx--; return interpolate_lagrangian(xs, ys, idx, x, 2); case Interpolation::cubic: // if x is not in the first interval of the x-grid, move back one - if (idx > 0) idx--; + if (idx > 0) + idx--; // if the index was the last interval of the x-grid, move it back one more - if (idx == xs.size() - 3) idx--; + if (idx == xs.size() - 3) + idx--; return interpolate_lagrangian(xs, ys, idx, x, 3); default: fatal_error("Unsupported interpolation"); } } - } // namespace openmc #endif \ No newline at end of file diff --git a/src/tallies/filter_energyfunc.cpp b/src/tallies/filter_energyfunc.cpp index 170c052629..bf2b2e6cbb 100644 --- a/src/tallies/filter_energyfunc.cpp +++ b/src/tallies/filter_energyfunc.cpp @@ -40,11 +40,16 @@ void EnergyFunctionFilter::from_xml(pugi::xml_node node) interpolation_ = Interpolation::log_log; } else if (interpolation == "quadratic") { if (energy.size() < 3) - fatal_error(fmt::format("Quadratic interpolation on EnergyFunctionFilter {} requires at least 3 data points.", id())); + fatal_error( + fmt::format("Quadratic interpolation on EnergyFunctionFilter {} " + "requires at least 3 data points.", + id())); interpolation_ = Interpolation::quadratic; } else if (interpolation == "cubic") { if (energy.size() < 4) - fatal_error(fmt::format("Cubic interpolation on EnergyFunctionFilter {} requires at least 4 data points.", id())); + fatal_error(fmt::format("Cubic interpolation on EnergyFunctionFilter " + "{} requires at least 4 data points.", + id())); interpolation_ = Interpolation::cubic; } else { fatal_error(fmt::format(