Skip to content

Commit 097f940

Browse files
committed
Implement the extraction of the discovery year
1 parent a2aa631 commit 097f940

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

include/inch/nuclide.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,13 @@ class Nuclide
267267
*
268268
* \return Nothing
269269
*/
270-
inline void setYear() const { year = Converter::StringToInt(full_data, NUBASE_START_YEAR, NUBASE_END_YEAR); }
270+
inline void setYear() const
271+
{
272+
// Some isotopes have no value for the year so we need to watch for that.
273+
// Leave it as the default if no year is given
274+
const auto value = full_data.substr(NUBASE_START_YEAR, NUBASE_END_YEAR - NUBASE_START_YEAR);
275+
year = std::isspace(value.front()) != 0 ? 1900 : Converter::StringToInt(value);
276+
}
271277

272278
/**
273279
* Extract the half life value from the data file

src/massTable.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ bool MassTable::readNUBASE(const std::filesystem::path& nubaseTable)
196196

197197
isotope.setHalfLife();
198198

199+
// Discovery year was added after 2003
200+
if (table_year != 3)
201+
{
202+
isotope.setYear();
203+
}
204+
199205
isotope.setDecayMode(pnSide, table_year);
200206

201207
isotope.setNeutronOrProtonRich(pnSide);

0 commit comments

Comments
 (0)