From 39e57619dfa3e3530f8a80941f94ee9668458b18 Mon Sep 17 00:00:00 2001 From: Olaf Schumann Date: Sun, 16 Jan 2022 19:29:29 +0000 Subject: [PATCH] add suggensstions by @paulromano run clang-format on all changed files Update test results --- include/openmc/hdf5_interface.h | 2 +- src/distribution_energy.cpp | 8 ++++---- src/photon.cpp | 7 +------ src/secondary_thermal.cpp | 11 +++++------ tests/regression_tests/salphabeta/results_true.dat | 2 +- tests/regression_tests/triso/results_true.dat | 2 +- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/include/openmc/hdf5_interface.h b/include/openmc/hdf5_interface.h index 4bcef7ede..49413a9c9 100644 --- a/include/openmc/hdf5_interface.h +++ b/include/openmc/hdf5_interface.h @@ -251,7 +251,7 @@ inline void read_dataset( // Read attribute and set string read_string(obj_id, name, n, buffer.data(), indep); - str = std::string { buffer.begin(), buffer.end() }; + str = std::string {buffer.begin(), buffer.end()}; } // array version diff --git a/src/distribution_energy.cpp b/src/distribution_energy.cpp index b1e88d89f..a4a5ce9e1 100644 --- a/src/distribution_energy.cpp +++ b/src/distribution_energy.cpp @@ -244,16 +244,16 @@ double ContinuousTabular::sample(double E, uint64_t* seed) const // Now interpolate between incident energy bins i and i + 1 if (!histogram_interp && n_energy_out > 1 && k >= n_discrete) { // Interpolation for energy E1 and EK - int n_energy_out = distribution_[i].e_out.size(); - int n_discrete = distribution_[i].n_discrete; + n_energy_out = distribution_[i].e_out.size(); + n_discrete = distribution_[i].n_discrete; const double E_i_1 = distribution_[i].e_out[n_discrete]; const double E_i_K = distribution_[i].e_out[n_energy_out - 1]; - + n_energy_out = distribution_[i + 1].e_out.size(); n_discrete = distribution_[i + 1].n_discrete; const double E_i1_1 = distribution_[i + 1].e_out[n_discrete]; const double E_i1_K = distribution_[i + 1].e_out[n_energy_out - 1]; - + const double E_1 = E_i_1 + r * (E_i1_1 - E_i_1); const double E_K = E_i_K + r * (E_i1_K - E_i_K); diff --git a/src/photon.cpp b/src/photon.cpp index 37913e00e..b0cd8aa87 100644 --- a/src/photon.cpp +++ b/src/photon.cpp @@ -218,14 +218,9 @@ PhotonInteraction::PhotonInteraction(hid_t group) close_group(rgroup); // Create Compton profile CDF - if (n_shell != profile_pdf_.shape(0)) { - warning(fmt::format( - "The number of subshells is {} but only {} compton profiles are available in .", - n_shell, profile_pdf_.shape(0))); - } auto n_profile = data::compton_profile_pz.size(); profile_cdf_ = xt::empty({n_shell, n_profile}); - for (int i = 0; i < std::min(n_shell, profile_pdf_.shape(0)); ++i) { + for (int i = 0; i < profile_pdf_.shape(0); ++i) { double c = 0.0; profile_cdf_(i, 0) = 0.0; for (int j = 0; j < n_profile - 1; ++j) { diff --git a/src/secondary_thermal.cpp b/src/secondary_thermal.cpp index c96152c8f..6e04092b3 100644 --- a/src/secondary_thermal.cpp +++ b/src/secondary_thermal.cpp @@ -19,8 +19,8 @@ void get_energy_index( f = 0.0; if (E >= energies.front()) { i = lower_bound_index(energies.begin(), energies.end(), E); - if (i+1 < energies.size()) - f = (E - energies[i]) / (energies[i + 1] - energies[i]); + if (i + 1 < energies.size()) + f = (E - energies[i]) / (energies[i + 1] - energies[i]); } } @@ -28,7 +28,6 @@ void get_energy_index( // CoherentElasticAE implementation //============================================================================== -#include CoherentElasticAE::CoherentElasticAE(const CoherentElasticXS& xs) : xs_ {xs} {} void CoherentElasticAE::sample( @@ -42,7 +41,7 @@ void CoherentElasticAE::sample( if (E_in < energies.front()) { // XS is zero for E < energies[0] -> no scatter mu = 1.0; - return ; + return; } const int i = lower_bound_index(energies.begin(), energies.end(), E_in); @@ -52,11 +51,11 @@ void CoherentElasticAE::sample( const auto& factors = xs_.factors(); const double prob = prn(seed) * factors[i]; - const int k = std::lower_bound(factors.begin(), factors.begin() + i, prob) - factors.begin(); + const int k = std::lower_bound(factors.begin(), factors.begin() + i, prob) - + factors.begin(); // Characteristic scattering cosine for this Bragg edge (ENDF-102, Eq. 7-2) mu = 1.0 - 2.0 * energies[k] / E_in; - } //============================================================================== diff --git a/tests/regression_tests/salphabeta/results_true.dat b/tests/regression_tests/salphabeta/results_true.dat index ea893abed..1c22db3a0 100644 --- a/tests/regression_tests/salphabeta/results_true.dat +++ b/tests/regression_tests/salphabeta/results_true.dat @@ -1,2 +1,2 @@ k-combined: -8.214162E-01 2.262777E-02 +8.214164E-01 2.262776E-02 diff --git a/tests/regression_tests/triso/results_true.dat b/tests/regression_tests/triso/results_true.dat index fc95e33fc..31d4a8544 100644 --- a/tests/regression_tests/triso/results_true.dat +++ b/tests/regression_tests/triso/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.653488E+00 2.128233E-02 +1.406055E+00 9.581397E-02