From 3fbfb366d2a09a93c050660b16947d2b337cef92 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Wed, 26 Mar 2025 12:36:18 -0400 Subject: [PATCH] feat(tests/poly): updated polytrope tests to use resource manager --- tests/poly/meson.build | 2 +- tests/poly/polyTest.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/poly/meson.build b/tests/poly/meson.build index 17a36e5..d88e6b6 100644 --- a/tests/poly/meson.build +++ b/tests/poly/meson.build @@ -11,7 +11,7 @@ foreach test_file : test_sources test_exe = executable( exe_name, test_file, - dependencies: [gtest_dep, polysolver_dep, probe_dep, quill_dep, config_dep, gtest_main], + dependencies: [gtest_dep, polysolver_dep, probe_dep, quill_dep, config_dep, gtest_main, resourceManager_dep], install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly ) diff --git a/tests/poly/polyTest.cpp b/tests/poly/polyTest.cpp index 42d0d34..9a20706 100644 --- a/tests/poly/polyTest.cpp +++ b/tests/poly/polyTest.cpp @@ -24,6 +24,8 @@ #include "quill/LogMacros.h" #include "mfem.hpp" +#include "resourceManager.h" +#include "resourceManagerTypes.h" #include "polySolver.h" #include "polyCoeff.h" @@ -32,7 +34,7 @@ #include "meshIO.h" 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 {}; @@ -41,16 +43,19 @@ TEST_F(polyTest, Solve) { config.loadConfig(CONFIG_FILENAME); Probe::LogManager& logManager = Probe::LogManager::getInstance(); quill::Logger* logger = logManager.getLogger("log"); + + ResourceManager& rm = ResourceManager::getInstance(); + const Resource& resource = rm.getResource("mesh:polySphere"); + const auto &meshIO = std::get>(resource); + LOG_INFO(logger, "Starting polytrope solve test 1..."); config.loadConfig(CONFIG_FILENAME); double polytropicIndex = config.get("Tests:Poly:Index", 1); double polyRadius = polycoeff::x1(polytropicIndex); - std::cout << "Polytropic index: " << polytropicIndex << std::endl; - std::cout << "Polytropic radius: " << polyRadius << std::endl; LOG_INFO(logger, "Solving polytrope with n = {:0.2f}", polytropicIndex); - MeshIO meshIO(SPHERICAL_MESH, polyRadius); - mfem::Mesh& mesh = meshIO.GetMesh(); + meshIO->LinearRescale(polyRadius); + mfem::Mesh& mesh = meshIO->GetMesh(); double radius = Probe::getMeshRadius(mesh); LOG_INFO(logger, "Mesh radius: {:0.4f} (target={:0.4f})", radius, polyRadius);