refactor(serif): refactored entire codebase into serif and sub namespaces

This commit is contained in:
2025-06-11 14:49:11 -04:00
parent 43c34daf5b
commit 3ed522b229
2 changed files with 23 additions and 17 deletions

View File

@@ -30,7 +30,7 @@
#include "atomicSpecies.h" #include "atomicSpecies.h"
using namespace composition; namespace serif::composition {
CompositionEntry::CompositionEntry() : m_symbol("H-1"), m_isotope(chemSpecies::species.at("H-1")), m_initialized(false) {} CompositionEntry::CompositionEntry() : m_symbol("H-1"), m_isotope(chemSpecies::species.at("H-1")), m_initialized(false) {}
@@ -547,10 +547,24 @@ Composition Composition::operator+(const Composition& other) const {
return mix(other, 0.5); return mix(other, 0.5);
} }
std::ostream& composition::operator<<(std::ostream& os, const Composition& composition) { std::ostream& operator<<(std::ostream& os, const GlobalComposition& comp) {
os << "Global Composition: \n";
os << "\tSpecific Number Density: " << comp.specificNumberDensity << "\n";
os << "\tMean Particle Mass: " << comp.meanParticleMass << "\n";
return os;
}
std::ostream& operator<<(std::ostream& os, const CompositionEntry& entry) {
os << "<" << entry.m_symbol << " : m_frac = " << entry.mass_fraction() << ">";
return os;
}
std::ostream& operator<<(std::ostream& os, const Composition& composition) {
os << "Composition: \n"; os << "Composition: \n";
for (const auto& [symbol, entry] : composition.m_compositions) { for (const auto& [symbol, entry] : composition.m_compositions) {
os << entry << "\n"; os << entry << "\n";
} }
return os; return os;
} }
} // namespace serif::composition

View File

@@ -33,7 +33,7 @@
#include "atomicSpecies.h" #include "atomicSpecies.h"
namespace composition{ namespace serif::composition {
/** /**
* @brief Represents the global composition of a system. This tends to be used after finalize and is primarily for internal use. * @brief Represents the global composition of a system. This tends to be used after finalize and is primarily for internal use.
*/ */
@@ -42,12 +42,7 @@ namespace composition{
double meanParticleMass; ///< The mean particle mass of the composition (\sum_{i} \frac{n_i}{m_i}. where n_i is the number fraction of the ith species and m_i is the mass of the ith species). double meanParticleMass; ///< The mean particle mass of the composition (\sum_{i} \frac{n_i}{m_i}. where n_i is the number fraction of the ith species and m_i is the mass of the ith species).
// Overload the output stream operator for GlobalComposition // Overload the output stream operator for GlobalComposition
friend std::ostream& operator<<(std::ostream& os, const GlobalComposition& comp) { friend std::ostream& operator<<(std::ostream& os, const GlobalComposition& comp);
os << "Global Composition: \n";
os << "\tSpecific Number Density: " << comp.specificNumberDensity << "\n";
os << "\tMean Particle Mass: " << comp.meanParticleMass << "\n";
return os;
}
}; };
/** /**
@@ -174,10 +169,7 @@ namespace composition{
* @param entry The CompositionEntry to output. * @param entry The CompositionEntry to output.
* @return The output stream. * @return The output stream.
*/ */
friend std::ostream& operator<<(std::ostream& os, const CompositionEntry& entry) { friend std::ostream& operator<<(std::ostream& os, const CompositionEntry& entry);
os << "<" << entry.m_symbol << " : m_frac = " << entry.mass_fraction() << ">";
return os;
}
}; };
/** /**
@@ -210,8 +202,8 @@ namespace composition{
*/ */
class Composition { class Composition {
private: private:
Config& m_config = Config::getInstance(); serif::config::Config& m_config = serif::config::Config::getInstance();
Probe::LogManager& m_logManager = Probe::LogManager::getInstance(); serif::probe::LogManager& m_logManager = serif::probe::LogManager::getInstance();
quill::Logger* m_logger = m_logManager.getLogger("log"); quill::Logger* m_logger = m_logManager.getLogger("log");
bool m_finalized = false; ///< True if the composition is finalized. bool m_finalized = false; ///< True if the composition is finalized.
@@ -471,6 +463,6 @@ namespace composition{
Composition operator+(const Composition& other) const; Composition operator+(const Composition& other) const;
}; };
}; }; // namespace serif::composition
#endif // COMPOSITION_H #endif // COMPOSITION_H