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.
This commit is contained in:
25
tests/sandbox/rayfem_sandbox.cpp
Normal file
25
tests/sandbox/rayfem_sandbox.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user