add suggensstions by @paulromano

run clang-format on all changed files
Update test results
This commit is contained in:
Olaf Schumann 2022-01-16 19:29:29 +00:00
parent 10dfbb81c8
commit 39e57619df
6 changed files with 13 additions and 19 deletions

View file

@ -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

View file

@ -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);

View file

@ -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<double>({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) {

View file

@ -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 <iostream>
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;
}
//==============================================================================

View file

@ -1,2 +1,2 @@
k-combined:
8.214162E-01 2.262777E-02
8.214164E-01 2.262776E-02

View file

@ -1,2 +1,2 @@
k-combined:
1.653488E+00 2.128233E-02
1.406055E+00 9.581397E-02