test(tests): updated tests
This commit is contained in:
@@ -1,16 +1,48 @@
|
|||||||
#define QUILL_COMPILE_ACTIVE_LOG_LEVEL QUILL_COMPILE_ACTIVE_LOG_LEVEL_DEBUG
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../../src/network/include/gridfire/engine/engine_graph.h"
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "gridfire/engine/engine_graph.h"
|
||||||
|
#include "gridfire/engine/engine_approx8.h"
|
||||||
|
#include "gridfire/engine/engine_adaptive.h"
|
||||||
|
|
||||||
|
#include "gridfire/solver/solver.h"
|
||||||
|
|
||||||
#include "gridfire/network.h"
|
#include "gridfire/network.h"
|
||||||
#include "../../src/network/include/gridfire/engine/engine_approx8.h"
|
|
||||||
#include "../../src/network/include/gridfire/solver/solver.h"
|
|
||||||
|
|
||||||
#include "fourdst/composition/composition.h"
|
#include "fourdst/composition/composition.h"
|
||||||
|
|
||||||
|
#include "fourdst/logging/logging.h"
|
||||||
|
#include "quill/Logger.h"
|
||||||
|
#include "quill/LogMacros.h"
|
||||||
|
#include "quill/Backend.h"
|
||||||
|
#include "quill/Frontend.h"
|
||||||
|
|
||||||
|
// Keep a copy of the previous handler
|
||||||
|
static std::terminate_handler g_previousHandler = nullptr;
|
||||||
|
|
||||||
|
void quill_terminate_handler()
|
||||||
|
{
|
||||||
|
// 1. Stop the Quill backend (flushes all sinks and joins thread)
|
||||||
|
quill::Backend::stop();
|
||||||
|
|
||||||
|
// 2. Optionally, flush individual loggers:
|
||||||
|
// for (auto logger : quill::get_all_loggers())
|
||||||
|
// logger->flush_log();
|
||||||
|
|
||||||
|
// 3. Chain to the previous terminate handler (or abort if none)
|
||||||
|
if (g_previousHandler)
|
||||||
|
g_previousHandler();
|
||||||
|
else
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
g_previousHandler = std::set_terminate(quill_terminate_handler);
|
||||||
|
quill::Logger* logger = fourdst::logging::LogManager::getInstance().getLogger("log");
|
||||||
|
logger->set_log_level(quill::LogLevel::TraceL1);
|
||||||
|
LOG_DEBUG(logger, "Starting Adaptive Engine View Example...");
|
||||||
|
|
||||||
using namespace gridfire;
|
using namespace gridfire;
|
||||||
// reaction::REACLIBLogicalReactionSet reactions = build_reaclib_nuclear_network_from_file("approx8", false);
|
|
||||||
// GraphNetwork network(reactions);
|
|
||||||
const std::vector<double> comp = {0.708, 0.0, 2.94e-5, 0.276, 0.003, 0.0011, 9.62e-3, 1.62e-3, 5.16e-4};
|
const std::vector<double> comp = {0.708, 0.0, 2.94e-5, 0.276, 0.003, 0.0011, 9.62e-3, 1.62e-3, 5.16e-4};
|
||||||
const std::vector<std::string> symbols = {"H-1", "H-2", "He-3", "He-4", "C-12", "N-14", "O-16", "Ne-20", "Mg-24"};
|
const std::vector<std::string> symbols = {"H-1", "H-2", "He-3", "He-4", "C-12", "N-14", "O-16", "Ne-20", "Mg-24"};
|
||||||
|
|
||||||
@@ -22,27 +54,24 @@ int main() {
|
|||||||
|
|
||||||
NetIn netIn;
|
NetIn netIn;
|
||||||
netIn.composition = composition;
|
netIn.composition = composition;
|
||||||
netIn.temperature = 1e7;
|
netIn.temperature = 1.5e7;
|
||||||
netIn.density = 1e2;
|
netIn.density = 1e2;
|
||||||
netIn.energy = 0.0;
|
netIn.energy = 0.0;
|
||||||
|
|
||||||
netIn.tMax = 3.15e17;
|
netIn.tMax = 3.1536e17;
|
||||||
netIn.dt0 = 1e12;
|
netIn.dt0 = 1e12;
|
||||||
|
|
||||||
NetOut netOut;
|
NetOut netOut;
|
||||||
approx8::Approx8Network approx8Network;
|
// approx8::Approx8Network approx8Network;
|
||||||
netOut = approx8Network.evaluate(netIn);
|
// netOut = approx8Network.evaluate(netIn);
|
||||||
std::cout << "Approx8 Network Output: " << netOut << std::endl;
|
// std::cout << "Approx8 Network Output: " << netOut << std::endl;
|
||||||
|
|
||||||
// // Network Ignition
|
|
||||||
netIn.dt0 = 1e-15;
|
netIn.dt0 = 1e-15;
|
||||||
// netIn.temperature = 2.0e8;
|
|
||||||
// netIn.density = 1.0e6;
|
|
||||||
// netIn.tMax = 1e-1;
|
|
||||||
|
|
||||||
GraphEngine ReaclibEngine(composition);
|
GraphEngine ReaclibEngine(composition);
|
||||||
// netOut = network.evaluate(netIn);
|
AdaptiveEngineView adaptiveEngine(ReaclibEngine);
|
||||||
solver::QSENetworkSolver solver(ReaclibEngine);
|
solver::QSENetworkSolver solver(adaptiveEngine);
|
||||||
|
|
||||||
netOut = solver.evaluate(netIn);
|
netOut = solver.evaluate(netIn);
|
||||||
std::cout << "QSE Graph Network Output: " << netOut << std::endl;
|
std::cout << "QSE Graph Network Output: " << netOut << std::endl;
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,12 @@
|
|||||||
|
|
||||||
#include "fourdst/composition/composition.h"
|
#include "fourdst/composition/composition.h"
|
||||||
#include "fourdst/config/config.h"
|
#include "fourdst/config/config.h"
|
||||||
#include "../../src/network/include/gridfire/engine/engine_approx8.h"
|
#include "gridfire/engine/engine_approx8.h"
|
||||||
#include "../../src/network/include/gridfire/engine/engine_graph.h"
|
#include "gridfire/engine/engine_graph.h"
|
||||||
#include "gridfire/network.h"
|
#include "gridfire/network.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gridfire/reactions.h"
|
|
||||||
|
|
||||||
std::string TEST_CONFIG = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
|
std::string TEST_CONFIG = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
|
||||||
class approx8Test : public ::testing::Test {};
|
class approx8Test : public ::testing::Test {};
|
||||||
@@ -86,7 +85,7 @@ TEST_F(approx8Test, reaclib) {
|
|||||||
netIn.dt0 = 1e12;
|
netIn.dt0 = 1e12;
|
||||||
|
|
||||||
GraphEngine network(composition);
|
GraphEngine network(composition);
|
||||||
NetOut netOut;
|
// NetOut netOut;
|
||||||
netOut = network.evaluate(netIn);
|
// netOut = network.evaluate(netIn);
|
||||||
std::cout << netOut << std::endl;
|
// std::cout << netOut << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user