Files
MeanField_SERiF/tests/sandbox/rayfem_sandbox.cpp
Emily Boudreaux cb20faeb3d test(tests): added test suite
The test suite is extensive. Note that LLMs were used to aid in the development of the test suite. All LLM generated code was manually reviewed.
2026-11-09 13:53:17 -05:00

26 lines
1.1 KiB
C++

#include <cmath>
#include <print>
#include "mfem.hpp"
#include "libRayfem/io/serif.hpp"
#include "libRayfem/mesh/converter.hpp"
/** @brief Exercise the visualization dependency without opening a window or running a solve. */
int main() {
auto mesh = mfem::Mesh::MakeCartesian2D(2, 2, mfem::Element::QUADRILATERAL, true, 1.0, 1.0);
mfem::H1_FECollection collection(2, 2);
mfem::FiniteElementSpace space(&mesh, &collection);
mfem::GridFunction field(&space);
mfem::FunctionCoefficient coefficient([](const mfem::Vector& x) { return x[0] + 2.0 * x[1]; });
field.ProjectCoefficient(coefficient);
const auto surface = RayFEM::BuildSurface(mesh, &field);
if (!RayFEM::SerifLoadingAvailable() || surface.values.empty() ||
std::abs(surface.min_value) > 1.0e-12 || std::abs(surface.max_value - 3.0) > 1.0e-12) {
std::println(stderr, "RayFEM could not evaluate the parent MFEM field or load SERiF archives.");
return 1;
}
std::println("RayFEM evaluated the MFEM field through serif_dep; SERiF archive support is available.");
return 0;
}