feat(reaclib): working on building efficient reaclib tooling for general nuclear network
this commit primarily adds a more robust ability to cull reactions that are not needed from the generated header
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,15 @@
|
||||
required_headers = [
|
||||
'atomicSpecies.h',
|
||||
]
|
||||
|
||||
foreach h : required_headers
|
||||
if not cpp.has_header(h, include_directories: include_directories('include'))
|
||||
error('SERiF requires the header file ' + h + ' to be present in the assets/static/atomic/include directory.')
|
||||
endif
|
||||
endforeach
|
||||
|
||||
species_weight_dep = declare_dependency(
|
||||
include_directories: include_directories('include'),
|
||||
)
|
||||
|
||||
message('✅ SERiF species_weight dependency declared')
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
namespace serif::composition {
|
||||
|
||||
CompositionEntry::CompositionEntry() : m_symbol("H-1"), m_isotope(chemSpecies::species.at("H-1")),
|
||||
CompositionEntry::CompositionEntry() : m_symbol("H-1"), m_isotope(serif::atomic::species.at("H-1")),
|
||||
m_initialized(false) {
|
||||
}
|
||||
|
||||
CompositionEntry::CompositionEntry(const std::string& symbol, const bool massFracMode) : m_symbol(symbol), m_isotope(chemSpecies::species.at(symbol)), m_massFracMode(massFracMode) {
|
||||
CompositionEntry::CompositionEntry(const std::string& symbol, const bool massFracMode) : m_symbol(symbol), m_isotope(serif::atomic::species.at(symbol)), m_massFracMode(massFracMode) {
|
||||
setSpecies(symbol);
|
||||
}
|
||||
|
||||
@@ -54,11 +54,11 @@ namespace serif::composition {
|
||||
if (m_initialized) {
|
||||
throw std::runtime_error("Composition entry is already initialized.");
|
||||
}
|
||||
if (chemSpecies::species.count(symbol) == 0) {
|
||||
if (serif::atomic::species.count(symbol) == 0) {
|
||||
throw std::runtime_error("Invalid symbol.");
|
||||
}
|
||||
m_symbol = symbol;
|
||||
m_isotope = chemSpecies::species.at(symbol);
|
||||
m_isotope = serif::atomic::species.at(symbol);
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace serif::composition {
|
||||
return m_relAbundance;
|
||||
}
|
||||
|
||||
chemSpecies::Species CompositionEntry::isotope() const {
|
||||
serif::atomic::Species CompositionEntry::isotope() const {
|
||||
return m_isotope;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace serif::composition {
|
||||
}
|
||||
|
||||
bool Composition::isValidSymbol(const std::string& symbol) {
|
||||
return chemSpecies::species.contains(symbol);
|
||||
return serif::atomic::species.contains(symbol);
|
||||
}
|
||||
|
||||
double Composition::setMassFraction(const std::string& symbol, const double& mass_fraction) {
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace serif::composition {
|
||||
*/
|
||||
struct CompositionEntry {
|
||||
std::string m_symbol; ///< The chemical symbol of the species.
|
||||
chemSpecies::Species m_isotope; ///< The isotope of the species.
|
||||
serif::atomic::Species m_isotope; ///< The isotope of the species.
|
||||
bool m_massFracMode = true; ///< The mode of the composition entry. True if mass fraction, false if number fraction.
|
||||
|
||||
double m_massFraction = 0.0; ///< The mass fraction of the species.
|
||||
@@ -142,7 +142,7 @@ namespace serif::composition {
|
||||
* @brief Gets the isotope of the species.
|
||||
* @return The isotope of the species.
|
||||
*/
|
||||
chemSpecies::Species isotope() const;
|
||||
serif::atomic::Species isotope() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the mode of the composition entry.
|
||||
|
||||
@@ -18,10 +18,10 @@ class compositionTest : public ::testing::Test {};
|
||||
* @brief Test the constructor of the composition class.
|
||||
*/
|
||||
TEST_F(compositionTest, isotopeMasses) {
|
||||
EXPECT_NO_THROW(chemSpecies::species.at("H-1"));
|
||||
EXPECT_DOUBLE_EQ(chemSpecies::species.at("H-1").mass(), 1.007825031898);
|
||||
EXPECT_DOUBLE_EQ(chemSpecies::species.at("He-3").mass(), 3.0160293219700001);
|
||||
EXPECT_DOUBLE_EQ(chemSpecies::species.at("He-4").mass(),4.0026032541300003);
|
||||
EXPECT_NO_THROW(serif::atomic::species.at("H-1"));
|
||||
EXPECT_DOUBLE_EQ(serif::atomic::species.at("H-1").mass(), 1.007825031898);
|
||||
EXPECT_DOUBLE_EQ(serif::atomic::species.at("He-3").mass(), 3.0160293219700001);
|
||||
EXPECT_DOUBLE_EQ(serif::atomic::species.at("He-4").mass(),4.0026032541300003);
|
||||
}
|
||||
|
||||
TEST_F(compositionTest, constructor) {
|
||||
@@ -135,7 +135,7 @@ TEST_F(compositionTest, getComposition) {
|
||||
comp.setMassFraction("He-4", 0.4);
|
||||
EXPECT_NO_THROW(comp.finalize());
|
||||
|
||||
auto compositionEntry = comp.getComposition("H-1");
|
||||
const auto compositionEntry = comp.getComposition("H-1");
|
||||
EXPECT_DOUBLE_EQ(compositionEntry.first.mass_fraction(), 0.6);
|
||||
EXPECT_DOUBLE_EQ(compositionEntry.second.meanParticleMass, 1.4382769310381101);
|
||||
EXPECT_DOUBLE_EQ(compositionEntry.second.specificNumberDensity, 1.0/1.4382769310381101);
|
||||
|
||||
Reference in New Issue
Block a user