From c0549d71b2109f10c1238db8b22362e7826ba61b Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 5 Jul 2026 15:59:23 +0200 Subject: Just rename from lib to modules --- modules/core/tests/math.cpp | 79 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 modules/core/tests/math.cpp (limited to 'modules/core/tests/math.cpp') diff --git a/modules/core/tests/math.cpp b/modules/core/tests/math.cpp new file mode 100644 index 0000000..d456ce8 --- /dev/null +++ b/modules/core/tests/math.cpp @@ -0,0 +1,79 @@ +#include + +#include +#include "../c++/math/n_linear.hpp" + +namespace { +namespace sch { +using namespace saw::schema; +} + +SAW_TEST("Math 1-Linear"){ + using namespace kel; + + saw::data,2u>> field; + { + field.at({{0u}}).at({{0u}}).set(-1.0); + field.at({{1u}}).at({{0u}}).set(2.0); + } + saw::data> pos; + pos.at({{0u}}).set(0.3); +} + +SAW_TEST("Math/Floor Index and Fraction from Position"){ + using namespace kel; + + saw::data> pos; + + { + pos.at({{0u}}) = 43.999; + pos.at({{1u}}) = -50.0; + } + + auto ind_frac = lbm::position_to_index_and_fraction(pos); + auto& ind = ind_frac.template get<0u>(); + for(uint64_t i = 0u; i < 2u; ++i){ + std::cout<(); + for(uint64_t i = 0u; i < 2u; ++i){ + std::cout<> pos; + + { + pos.at({{0u}}) = 43.999; + pos.at({{1u}}) = -50.0; + } + + saw::data> bound; + { + bound.at({{0u}}) = 32u; + bound.at({{1u}}) = 16u; + } + + auto ind_frac = lbm::position_to_index_and_fraction_bounded(pos,bound); + auto& ind = ind_frac.template get<0u>(); + for(uint64_t i = 0u; i < 2u; ++i){ + std::cout<(); + for(uint64_t i = 0u; i < 2u; ++i){ + std::cout<