mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25: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
|
|
@ -212,13 +212,12 @@ class VolumeCalculation(object):
|
|||
ids.append(domain_id)
|
||||
group = f[obj_name]
|
||||
volume = ufloat(*group['volume'][()])
|
||||
volumes[domain_id] = volume
|
||||
nucnames = group['nuclides'][()]
|
||||
atoms_ = group['atoms'][()]
|
||||
|
||||
atom_dict = OrderedDict()
|
||||
for name_i, atoms_i in zip(nucnames, atoms_):
|
||||
atom_dict[name_i.decode()] = ufloat(*atoms_i)
|
||||
volumes[domain_id] = volume
|
||||
atoms[domain_id] = atom_dict
|
||||
|
||||
# Instantiate some throw-away domains that are used by the constructor
|
||||
|
|
|
|||
|
|
@ -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