Make sure MG materials get put in libraries

This commit is contained in:
Paul Romano 2018-11-06 09:52:18 -06:00
parent c2428608c1
commit de666e3291
4 changed files with 17 additions and 13 deletions

View file

@ -2,6 +2,7 @@
#include <string>
#include "openmc/cross_sections.h"
#include "openmc/error.h"
#include "openmc/math_functions.h"
@ -109,6 +110,20 @@ void read_mg_cross_sections_header_c(hid_t file_id)
for (int i = 0; i < energy_bins.size() - 1; ++i) {
energy_bin_avg.push_back(0.5*(energy_bins[i] + energy_bins[i+1]));
}
// Add entries into libraries for MG data
auto names = group_names(file_id);
if (names.empty()) {
fatal_error("At least one MGXS data set must be present in mgxs "
"library file!");
}
for (auto& name : names) {
Library lib {};
lib.type_ = Library::Type::neutron;
lib.materials_.push_back(name);
libraries.push_back(lib);
}
}
//==============================================================================