diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-05-27 15:58:45 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-05-27 15:58:45 +0200 |
| commit | 346d979dcdea3e3f37d3ad55680b4f0469d7220c (patch) | |
| tree | 5d9c4a9d85c3982b234117102229f8d0d3106555 /lib/core/c++/math | |
| parent | 960a3ef31095af11c7c764a1bcdcb4b424c529b8 (diff) | |
| download | libs-lbm-346d979dcdea3e3f37d3ad55680b4f0469d7220c.tar.gz | |
Dangliung
Diffstat (limited to 'lib/core/c++/math')
| -rw-r--r-- | lib/core/c++/math/n_closest.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
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<typename FieldSchema, typename T, uint64_t D> +auto n_closest_read(saw::data<FieldSchema>, const saw::data<sch::Vector<T,D>>& 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<T>{0.5}; + if(shift_frac_ind.at({{i}}).get() < 0){ + shift_frac_ind.at({{i}}) = {}; + } + } + + auto shift_ind = frac_ind.template cast_to<sch::UInt64>(); +} +} +} |
