refactor(serif): refactored entire codebase into serif and sub namespaces
This commit is contained in:
@@ -72,7 +72,7 @@ The coefficients to the fit are from reaclib.jinaweb.org .
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace nnApprox8{
|
namespace serif::network::approx8{
|
||||||
|
|
||||||
// using namespace std;
|
// using namespace std;
|
||||||
using namespace boost::numeric::odeint;
|
using namespace boost::numeric::odeint;
|
||||||
@@ -245,7 +245,7 @@ namespace nnApprox8{
|
|||||||
// a Jacobian matrix for implicit solvers
|
// a Jacobian matrix for implicit solvers
|
||||||
|
|
||||||
void Jacobian::operator() ( const vector_type &y, matrix_type &J, double /* t */, vector_type &dfdt ) {
|
void Jacobian::operator() ( const vector_type &y, matrix_type &J, double /* t */, vector_type &dfdt ) {
|
||||||
Constants& constants = Constants::getInstance();
|
serif::constant::Constants& constants = serif::constant::Constants::getInstance();
|
||||||
const double avo = constants.get("N_a").value;
|
const double avo = constants.get("N_a").value;
|
||||||
const double clight = constants.get("c").value;
|
const double clight = constants.get("c").value;
|
||||||
// EOS
|
// EOS
|
||||||
@@ -350,7 +350,7 @@ namespace nnApprox8{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ODE::operator() ( const vector_type &y, vector_type &dydt, double /* t */) {
|
void ODE::operator() ( const vector_type &y, vector_type &dydt, double /* t */) {
|
||||||
Constants& constants = Constants::getInstance();
|
serif::constant::Constants& constants = serif::constant::Constants::getInstance();
|
||||||
const double avo = constants.get("N_a").value;
|
const double avo = constants.get("N_a").value;
|
||||||
const double clight = constants.get("c").value;
|
const double clight = constants.get("c").value;
|
||||||
|
|
||||||
@@ -444,7 +444,7 @@ namespace nnApprox8{
|
|||||||
dydt[Net::iener] = -enuc*avo*clight*clight;
|
dydt[Net::iener] = -enuc*avo*clight*clight;
|
||||||
}
|
}
|
||||||
|
|
||||||
nuclearNetwork::NetOut Approx8Network::evaluate(const nuclearNetwork::NetIn &netIn) {
|
NetOut Approx8Network::evaluate(const NetIn &netIn) {
|
||||||
m_y = convert_netIn(netIn);
|
m_y = convert_netIn(netIn);
|
||||||
m_tmax = netIn.tmax;
|
m_tmax = netIn.tmax;
|
||||||
m_dt0 = netIn.dt0;
|
m_dt0 = netIn.dt0;
|
||||||
@@ -488,7 +488,7 @@ namespace nnApprox8{
|
|||||||
m_y[i] /= ysum;
|
m_y[i] /= ysum;
|
||||||
}
|
}
|
||||||
|
|
||||||
nuclearNetwork::NetOut netOut;
|
NetOut netOut;
|
||||||
std::vector<double> outComposition;
|
std::vector<double> outComposition;
|
||||||
outComposition.reserve(Net::nvar);
|
outComposition.reserve(Net::nvar);
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ namespace nnApprox8{
|
|||||||
m_stiff = stiff;
|
m_stiff = stiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector_type Approx8Network::convert_netIn(const nuclearNetwork::NetIn &netIn) {
|
vector_type Approx8Network::convert_netIn(const NetIn &netIn) {
|
||||||
if (netIn.composition.size() != Net::niso) {
|
if (netIn.composition.size() != Net::niso) {
|
||||||
LOG_ERROR(m_logger, "Error: composition size mismatch in convert_netIn");
|
LOG_ERROR(m_logger, "Error: composition size mismatch in convert_netIn");
|
||||||
throw std::runtime_error("Error: composition size mismatch in convert_netIn");
|
throw std::runtime_error("Error: composition size mismatch in convert_netIn");
|
||||||
|
|||||||
@@ -22,13 +22,13 @@
|
|||||||
#include "probe.h"
|
#include "probe.h"
|
||||||
#include "quill/LogMacros.h"
|
#include "quill/LogMacros.h"
|
||||||
|
|
||||||
namespace nuclearNetwork {
|
namespace serif::network {
|
||||||
Network::Network() :
|
Network::Network() :
|
||||||
m_config(Config::getInstance()),
|
m_config(serif::config::Config::getInstance()),
|
||||||
m_logManager(Probe::LogManager::getInstance()),
|
m_logManager(serif::probe::LogManager::getInstance()),
|
||||||
m_logger(m_logManager.getLogger("log")) {
|
m_logger(m_logManager.getLogger("log")) {
|
||||||
}
|
}
|
||||||
nuclearNetwork::NetOut nuclearNetwork::Network::evaluate(const NetIn &netIn) {
|
NetOut Network::evaluate(const NetIn &netIn) {
|
||||||
// You can throw an exception here or log a warning if it should never be used.
|
// You can throw an exception here or log a warning if it should never be used.
|
||||||
LOG_ERROR(m_logger, "nuclearNetwork::Network::evaluate() is not implemented");
|
LOG_ERROR(m_logger, "nuclearNetwork::Network::evaluate() is not implemented");
|
||||||
throw std::runtime_error("nuclearNetwork::Network::evaluate() is not implemented");
|
throw std::runtime_error("nuclearNetwork::Network::evaluate() is not implemented");
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ typedef boost::numeric::ublas::matrix< double > matrix_type;
|
|||||||
*/
|
*/
|
||||||
typedef std::array<double,7> vec7;
|
typedef std::array<double,7> vec7;
|
||||||
|
|
||||||
namespace nnApprox8{
|
namespace serif::network::approx8{
|
||||||
|
|
||||||
using namespace boost::numeric::odeint;
|
using namespace boost::numeric::odeint;
|
||||||
|
|
||||||
@@ -294,14 +294,14 @@ namespace nnApprox8{
|
|||||||
* @class Approx8Network
|
* @class Approx8Network
|
||||||
* @brief Class for the Approx8 nuclear reaction network.
|
* @brief Class for the Approx8 nuclear reaction network.
|
||||||
*/
|
*/
|
||||||
class Approx8Network : public nuclearNetwork::Network {
|
class Approx8Network : public Network {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Evaluates the nuclear network.
|
* @brief Evaluates the nuclear network.
|
||||||
* @param netIn Input parameters for the network.
|
* @param netIn Input parameters for the network.
|
||||||
* @return Output results from the network.
|
* @return Output results from the network.
|
||||||
*/
|
*/
|
||||||
virtual nuclearNetwork::NetOut evaluate(const nuclearNetwork::NetIn &netIn);
|
virtual NetOut evaluate(const NetIn &netIn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets whether the solver should use a stiff method.
|
* @brief Sets whether the solver should use a stiff method.
|
||||||
@@ -325,7 +325,7 @@ namespace nnApprox8{
|
|||||||
* @param netIn Input parameters for the network.
|
* @param netIn Input parameters for the network.
|
||||||
* @return Internal state vector.
|
* @return Internal state vector.
|
||||||
*/
|
*/
|
||||||
vector_type convert_netIn(const nuclearNetwork::NetIn &netIn);
|
vector_type convert_netIn(const NetIn &netIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nnApprox8
|
} // namespace nnApprox8
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "quill/Logger.h"
|
#include "quill/Logger.h"
|
||||||
|
|
||||||
namespace nuclearNetwork {
|
namespace serif::network {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct NetIn
|
* @struct NetIn
|
||||||
@@ -102,8 +102,8 @@ namespace nuclearNetwork {
|
|||||||
virtual NetOut evaluate(const NetIn &netIn);
|
virtual NetOut evaluate(const NetIn &netIn);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Config& m_config; ///< Configuration instance
|
serif::config::Config& m_config; ///< Configuration instance
|
||||||
Probe::LogManager& m_logManager; ///< Log manager instance
|
serif::probe::LogManager& m_logManager; ///< Log manager instance
|
||||||
quill::Logger* m_logger; ///< Logger instance
|
quill::Logger* m_logger; ///< Logger instance
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user