minor changes, still not passing the test

This commit is contained in:
Adam G Nelson 2018-06-15 19:46:25 -04:00
parent 9fd65822f0
commit 39c063830c
4 changed files with 15 additions and 17 deletions

View file

@ -97,7 +97,7 @@ void calc_pn_c(int n, double x, double pnx[]) {
}
// Use recursion relation to build the higher orders
for (int l = 1; l < n; l ++) {
for (int l = 1; l < n; l++) {
pnx[l + 1] = ((2 * l + 1) * x * pnx[l] - l * pnx[l - 1]) / (l + 1);
}
}

View file

@ -6,8 +6,8 @@ namespace openmc {
// ScattData base-class methods
//==============================================================================
void ScattData::generic_init(int order, int_1dvec in_gmin,
int_1dvec in_gmax, double_2dvec in_energy, double_2dvec in_mult)
void ScattData::generic_init(int order, int_1dvec& in_gmin,
int_1dvec& in_gmax, double_2dvec& in_energy, double_2dvec& in_mult)
{
int groups = in_energy.size();
@ -18,18 +18,17 @@ void ScattData::generic_init(int order, int_1dvec in_gmin,
dist.resize(groups);
for (int gin = 0; gin < groups; gin++) {
// Make sure the energy is normalized
double norm = std::accumulate(in_energy[gin].begin(),
in_energy[gin].end(), 0.);
if (norm != 0.) {
for (auto& n : in_energy[gin]) n /= norm;
}
// Store the inputted data
energy[gin] = in_energy[gin];
mult[gin] = in_mult[gin];
// Make sure the energy is normalized
double norm = std::accumulate(energy[gin].begin(), energy[gin].end(), 0.);
if (norm != 0.) {
for (auto& n : energy[gin]) n /= norm;
}
// Initialize the distribution data
dist[gin].resize(in_gmax[gin] - in_gmin[gin] + 1);
for (auto& v : dist[gin]) {
@ -131,9 +130,7 @@ void ScattDataLegendre::init(int_1dvec& in_gmin, int_1dvec& in_gmax,
int num_groups = in_gmax[gin] - in_gmin[gin] + 1;
scattxs[gin] = 0.;
for (int i_gout = 0; i_gout < num_groups; i_gout++) {
scattxs[gin] = std::accumulate(matrix[gin][i_gout].begin(),
matrix[gin][i_gout].end(),
scattxs[gin]);
scattxs[gin] += matrix[gin][i_gout][0];
}
}

View file

@ -39,8 +39,8 @@ class ScattData {
double_2dvec& in_mult, double_3dvec& coeffs) = 0;
void sample_energy(int gin, int& gout, int& i_gout);
double get_xs(const int xstype, int gin, int* gout, double* mu);
void generic_init(int order, int_1dvec in_gmin, int_1dvec in_gmax,
double_2dvec in_energy, double_2dvec in_mult);
void generic_init(int order, int_1dvec& in_gmin, int_1dvec& in_gmax,
double_2dvec& in_energy, double_2dvec& in_mult);
virtual void combine(std::vector<ScattData*>& those_scatts,
double_1dvec& scalars) = 0;
virtual int get_order() = 0;

View file

@ -602,7 +602,7 @@ void XsData::_scatter_from_hdf5(hid_t xsdata_grp, int n_pol, int n_azi,
double_4dvec temp_mult = double_4dvec(n_pol, double_3dvec(n_azi,
double_2dvec(energy_groups)));
if (object_exists(scatt_grp, "multiplicity_matrix")) {
temp_arr.resize(length);
temp_arr.resize(length / order_data);
read_nd_vector(scatt_grp, "multiplicity_matrix", temp_arr);
// convert the flat temp_arr to a jagged array for passing to scatt data
@ -630,6 +630,7 @@ void XsData::_scatter_from_hdf5(hid_t xsdata_grp, int n_pol, int n_azi,
}
}
}
temp_arr.clear();
close_group(scatt_grp);
// Finally, convert the Legendre data to tabular, if needed