mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Writing empty groups for nuclides/atoms in volume calc if no entries are found.
This commit is contained in:
parent
0055ecbb3a
commit
c1d746164f
2 changed files with 13 additions and 16 deletions
|
|
@ -311,22 +311,20 @@ void VolumeCalculation::to_hdf5(const std::string& filename,
|
|||
// Create array of nuclide names from the vector
|
||||
auto n_nuc = result.nuclides.size();
|
||||
|
||||
if (!result.nuclides.empty()) {
|
||||
std::vector<std::string> nucnames;
|
||||
for (int i_nuc : result.nuclides) {
|
||||
nucnames.push_back(data::nuclides[i_nuc]->name_);
|
||||
}
|
||||
|
||||
// Create array of total # of atoms with uncertainty for each nuclide
|
||||
xt::xtensor<double, 2> atom_data({n_nuc, 2});
|
||||
xt::view(atom_data, xt::all(), 0) = xt::adapt(result.atoms);
|
||||
xt::view(atom_data, xt::all(), 1) = xt::adapt(result.uncertainty);
|
||||
|
||||
// Write results
|
||||
write_dataset(group_id, "nuclides", nucnames);
|
||||
write_dataset(group_id, "atoms", atom_data);
|
||||
std::vector<std::string> nucnames;
|
||||
for (int i_nuc : result.nuclides) {
|
||||
nucnames.push_back(data::nuclides[i_nuc]->name_);
|
||||
}
|
||||
|
||||
// Create array of total # of atoms with uncertainty for each nuclide
|
||||
xt::xtensor<double, 2> atom_data({n_nuc, 2});
|
||||
xt::view(atom_data, xt::all(), 0) = xt::adapt(result.atoms);
|
||||
xt::view(atom_data, xt::all(), 1) = xt::adapt(result.uncertainty);
|
||||
|
||||
// Write results
|
||||
write_dataset(group_id, "nuclides", nucnames);
|
||||
write_dataset(group_id, "atoms", atom_data);
|
||||
|
||||
close_group(group_id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue