summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-03-20 18:23:39 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-03-20 18:23:39 +0100
commit2a5261cd719547686f283b2aeae004b589b69e32 (patch)
tree1001cd4a31c8204c2d164319a1c03ab230399eea
parent16c1198f8fb401c3a98d927053fb2d29c2ce5f91 (diff)
downloadlibs-lbm-2a5261cd719547686f283b2aeae004b589b69e32.tar.gz
Fraction and downcast looks ok. Need upper bound now
-rw-r--r--lib/core/c++/math/n_linear.hpp2
-rw-r--r--lib/core/tests/math.cpp8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/core/c++/math/n_linear.hpp b/lib/core/c++/math/n_linear.hpp
index bb7653c..ac02da8 100644
--- a/lib/core/c++/math/n_linear.hpp
+++ b/lib/core/c++/math/n_linear.hpp
@@ -33,7 +33,7 @@ saw::data<sch::Tuple<sch::Vector<sch::UInt64,D>,sch::Vector<T,D>>> position_to_i
ind.at({{i}}) = pos_cpy.at({{i}}).template cast_to<sch::UInt64>();
}
- frac = pos - ind.template cast_to<T>();
+ frac = pos_cpy - ind.template cast_to<T>();
return sep;
}
diff --git a/lib/core/tests/math.cpp b/lib/core/tests/math.cpp
index 7c9dc14..970004b 100644
--- a/lib/core/tests/math.cpp
+++ b/lib/core/tests/math.cpp
@@ -30,11 +30,17 @@ SAW_TEST("Math/Floor Index from Pos"){
pos.at({{1u}}) = -50.0;
}
- auto ind = lbm::floor_index_from_position(pos);
+ 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<<ind.at({{i}}).get()<<" ";
}
std::cout<<std::endl;
+ auto& frac = ind_frac.template get<1u>();
+ for(uint64_t i = 0u; i < 2u; ++i){
+ std::cout<<frac.at({{i}}).get()<<" ";
+ }
+ std::cout<<std::endl;
SAW_EXPECT(true, "Default true check");
}