test(tests/poly): removed default constructor test
This commit is contained in:
@@ -1,40 +1,38 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include<numbers>
|
||||||
|
|
||||||
#include "quill/LogMacros.h"
|
#include "quill/LogMacros.h"
|
||||||
#include "mfem.hpp"
|
#include "mfem.hpp"
|
||||||
|
|
||||||
#include "polySolver.h"
|
#include "polySolver.h"
|
||||||
#include "probe.h"
|
#include "probe.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "meshIO.h"
|
||||||
|
|
||||||
std::string CONFIG_FILENAME = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
|
std::string CONFIG_FILENAME = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
|
||||||
|
std::string SPHERICAL_MESH = std::string(getenv("MESON_SOURCE_ROOT")) + "/src/resources/mesh/core.msh";
|
||||||
|
|
||||||
class polyTest : public ::testing::Test {};
|
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) {
|
TEST_F(polyTest, Solve) {
|
||||||
Config& config = Config::getInstance();
|
Config& config = Config::getInstance();
|
||||||
config.loadConfig(CONFIG_FILENAME);
|
config.loadConfig(CONFIG_FILENAME);
|
||||||
PolySolver polytrope(1, 1);
|
|
||||||
EXPECT_NO_THROW(polytrope.solve());
|
|
||||||
Probe::LogManager& logManager = Probe::LogManager::getInstance();
|
Probe::LogManager& logManager = Probe::LogManager::getInstance();
|
||||||
quill::Logger* logger = logManager.newFileLogger("polyTest.log", "polyTest");
|
quill::Logger* logger = logManager.getLogger("log");
|
||||||
LOG_INFO(logger, "Solving polytrope with n = 1.5");
|
LOG_INFO(logger, "Starting polytrope solve test 1...");
|
||||||
mfem::Mesh& mesh = polytrope.getMesh();
|
config.loadConfig(CONFIG_FILENAME);
|
||||||
mfem::GridFunction& solution = polytrope.getSolution();
|
|
||||||
Probe::glVisView(solution, mesh, "Polytrope solution");
|
|
||||||
|
|
||||||
// Get the mesh radius
|
MeshIO meshIO(SPHERICAL_MESH, std::numbers::pi);
|
||||||
|
mfem::Mesh& mesh = meshIO.GetMesh();
|
||||||
double radius = Probe::getMeshRadius(mesh);
|
double radius = Probe::getMeshRadius(mesh);
|
||||||
LOG_INFO(logger, "Mesh radius: {}", radius);
|
LOG_INFO(logger, "Mesh radius: {}", radius);
|
||||||
|
|
||||||
// Get the ray solution
|
double polytropicIndex = config.get<double>("Tests:Poly:Index", 1);
|
||||||
const std::vector<double> rayDirection = {0, 0};
|
LOG_INFO(logger, "Solving polytrope with n = {:0.2f}", polytropicIndex);
|
||||||
int numSamples = 10;
|
|
||||||
// std::vector<double> samples = Probe::getRaySolution(solution, mesh, rayDirection, numSamples);
|
PolySolver polytrope(polytropicIndex, 1, mesh);
|
||||||
|
LOG_INFO(logger, "Solving polytrope...");
|
||||||
|
EXPECT_NO_THROW(polytrope.solve());
|
||||||
|
LOG_INFO(logger, "Polytrope solved.");
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user