Files
SERiF/tests/poly/polyTest.cpp

40 lines
1.3 KiB
C++

#include <gtest/gtest.h>
#include "quill/LogMacros.h"
#include "mfem.hpp"
#include "polySolver.h"
#include "probe.h"
#include "config.h"
std::string CONFIG_FILENAME = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
class polyTest : public ::testing::Test {};
TEST_F(polyTest, DefaultConstructor) {
Config& config = Config::getInstance();
config.loadConfig(CONFIG_FILENAME);
EXPECT_NO_THROW(PolySolver(1, 1));
}
TEST_F(polyTest, Solve) {
Config& config = Config::getInstance();
config.loadConfig(CONFIG_FILENAME);
PolySolver polytrope(1, 1);
EXPECT_NO_THROW(polytrope.solve());
Probe::LogManager& logManager = Probe::LogManager::getInstance();
quill::Logger* logger = logManager.newFileLogger("polyTest.log", "polyTest");
LOG_INFO(logger, "Solving polytrope with n = 1.5");
mfem::Mesh& mesh = polytrope.getMesh();
mfem::GridFunction& solution = polytrope.getSolution();
Probe::glVisView(solution, mesh, "Polytrope solution");
// Get the mesh radius
double radius = Probe::getMeshRadius(mesh);
LOG_INFO(logger, "Mesh radius: {}", radius);
// Get the ray solution
const std::vector<double> rayDirection = {0, 0};
int numSamples = 10;
// std::vector<double> samples = Probe::getRaySolution(solution, mesh, rayDirection, numSamples);
}