From da53221aadbf652fd8483afb88085754401a311e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Wed, 7 May 2025 17:48:45 +0200 Subject: [PATCH] Add temporary test files --- src/language/modules/SchemeModule.cpp | 9 +++++++++ src/scheme/CMakeLists.txt | 2 ++ src/scheme/test_reconstruction.cpp | 19 +++++++++++++++++++ src/scheme/test_reconstruction.hpp | 8 ++++++++ 4 files changed, 38 insertions(+) create mode 100644 src/scheme/test_reconstruction.cpp create mode 100644 src/scheme/test_reconstruction.hpp diff --git a/src/language/modules/SchemeModule.cpp b/src/language/modules/SchemeModule.cpp index b9b789cfa..f2570a3c3 100644 --- a/src/language/modules/SchemeModule.cpp +++ b/src/language/modules/SchemeModule.cpp @@ -65,6 +65,9 @@ #include <utils/checkpointing/WriteIQuadratureDescriptor.hpp> #include <utils/checkpointing/WriteVariableBCDescriptor.hpp> +#warning REMOVE +#include <scheme/test_reconstruction.hpp> + #include <memory> SchemeModule::SchemeModule() @@ -756,6 +759,12 @@ SchemeModule::SchemeModule() )); + this->_addBuiltinFunction("test_reconstruction", std::function{[](std::shared_ptr<const DiscreteFunctionVariant> df, + size_t degree, size_t number) -> void { + // + test_reconstruction(df, degree, number); + }}); + MathFunctionRegisterForVh{*this}; } diff --git a/src/scheme/CMakeLists.txt b/src/scheme/CMakeLists.txt index e5ce50e9e..c299cd24f 100644 --- a/src/scheme/CMakeLists.txt +++ b/src/scheme/CMakeLists.txt @@ -12,6 +12,8 @@ add_library( HyperelasticSolver.cpp LoadBalancer.cpp PolynomialReconstruction.cpp + + test_reconstruction.cpp ) target_link_libraries( diff --git a/src/scheme/test_reconstruction.cpp b/src/scheme/test_reconstruction.cpp new file mode 100644 index 000000000..ec106f497 --- /dev/null +++ b/src/scheme/test_reconstruction.cpp @@ -0,0 +1,19 @@ +#include <scheme/test_reconstruction.hpp> + +#include <scheme/PolynomialReconstruction.hpp> +#include <utils/Timer.hpp> + +void +test_reconstruction(std::shared_ptr<const DiscreteFunctionVariant> df, size_t degree, size_t number) +{ + PolynomialReconstructionDescriptor descriptor{IntegrationMethodType::boundary, degree}; + PolynomialReconstruction rec_builder{descriptor}; + + Timer t; + + for (size_t i = 0; i < number; ++i) { + auto rec = rec_builder.build(df); + } + + std::cout << "*** Elapsed time for " << number << " reconstructions: " << t.seconds() << "s ***\n"; +} diff --git a/src/scheme/test_reconstruction.hpp b/src/scheme/test_reconstruction.hpp new file mode 100644 index 000000000..36ed481ec --- /dev/null +++ b/src/scheme/test_reconstruction.hpp @@ -0,0 +1,8 @@ +#ifndef TEST_RECONSTRUCTION_HPP +#define TEST_RECONSTRUCTION_HPP + +#include <scheme/DiscreteFunctionVariant.hpp> +#warning REMOVE +void test_reconstruction(std::shared_ptr<const DiscreteFunctionVariant> df, size_t degree, size_t number); + +#endif // TEST_RECONSTRUCTION_HPP -- GitLab