From 346d979dcdea3e3f37d3ad55680b4f0469d7220c Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 27 May 2026 15:58:45 +0200 Subject: Dangliung --- lib/core/c++/math/n_closest.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/core/c++/math/n_closest.hpp (limited to 'lib/core/c++/math') diff --git a/lib/core/c++/math/n_closest.hpp b/lib/core/c++/math/n_closest.hpp new file mode 100644 index 0000000..ddc89be --- /dev/null +++ b/lib/core/c++/math/n_closest.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "../common.hpp" +#include "../iterator.hpp" + +namespace kel { +namespace lbm { + +template +auto n_closest_read(saw::data, const saw::data>& frac_ind){ + + auto shift_frac_ind = frac_ind; + for(uint64_t i{0u}; i < D; ++i){ + + shift_frac_ind.at({{i}}) = shift_frac_ind.at({{i}}) + saw::data{0.5}; + if(shift_frac_ind.at({{i}}).get() < 0){ + shift_frac_ind.at({{i}}) = {}; + } + } + + auto shift_ind = frac_ind.template cast_to(); +} +} +} -- cgit v1.2.3