From 4158c893d49ea6c64938403ddccfb39f9e8aff91 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Sun, 16 Feb 2025 15:20:24 -0500 Subject: [PATCH] docs(tests/meshIO): added comments to meshIO tests --- tests/meshIO/meshIOTest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/meshIO/meshIOTest.cpp b/tests/meshIO/meshIOTest.cpp index 1ed55d1..07eec4f 100644 --- a/tests/meshIO/meshIOTest.cpp +++ b/tests/meshIO/meshIOTest.cpp @@ -6,6 +6,16 @@ std::string EXAMPLE_FILENAME = std::string(getenv("MESON_SOURCE_ROOT")) + "/src/resources/mesh/sphere.msh"; +double ComputeMeshVolume(mfem::Mesh &mesh) +{ + double totalVolume = 0.0; + for (int i = 0; i < mesh.GetNE(); i++) // Loop over all elements + { + totalVolume += mesh.GetElementVolume(i); + } + return totalVolume; +} + class meshIOTest : public ::testing::Test {}; @@ -23,4 +33,6 @@ TEST_F(meshIOTest, GetMesh) { mfem::Mesh& mesh = meshIO.GetMesh(); EXPECT_EQ(mesh.GetNE(), 670); EXPECT_EQ(mesh.GetNV(), 201); + double volume = ComputeMeshVolume(mesh); + EXPECT_DOUBLE_EQ(volume, 3.9357596288315868); } \ No newline at end of file