mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Adding function for retrieving the name of a nuclide from a tally.
This commit is contained in:
parent
02f8804fe3
commit
7b6bf93afd
2 changed files with 15 additions and 0 deletions
|
|
@ -75,6 +75,9 @@ public:
|
|||
//! A string representing the i-th score on this tally
|
||||
std::string score_name(int score_idx) const;
|
||||
|
||||
//! A string representing the i-th nuclide on this tally
|
||||
std::string nuclide_name(int nuclide_idx) const;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Major public data members.
|
||||
|
||||
|
|
|
|||
|
|
@ -677,6 +677,18 @@ Tally::score_name(int score_idx) const {
|
|||
return reaction_name(scores_[score_idx]);
|
||||
}
|
||||
|
||||
std::string
|
||||
Tally::nuclide_name(int nuclide_idx) const {
|
||||
if (nuclide_idx != -1) {
|
||||
return "total";
|
||||
} else if (nuclide_idx < 0 || nuclide_idx >= nuclides_.size()) {
|
||||
fatal_error("Index in nuclides array is out of bounds");
|
||||
}
|
||||
|
||||
int nuclide = nuclides_.at(nuclide_idx);
|
||||
return data::nuclides.at(nuclide)->name_;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Non-member functions
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue