From 952940c3487856447bb80c819b61483b8028d027 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 20 Jan 2026 14:50:23 +0100 Subject: Chunk setup test --- lib/core/c++/chunk.hpp | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'lib/core/c++') diff --git a/lib/core/c++/chunk.hpp b/lib/core/c++/chunk.hpp index 1950661..607bec0 100644 --- a/lib/core/c++/chunk.hpp +++ b/lib/core/c++/chunk.hpp @@ -34,12 +34,46 @@ using SuperChunk = Array; } namespace saw { -template -class data,Encode> final { +template +class data,Encode> final { public: - using Schema = kel::lbm::sch::Chunk; + using Schema = kel::lbm::sch::Chunk; private: - data values_; + using InnerSchema = typename Schema::InnerSchema; + using ValueSchema = typename InnerSchema::ValueType; + + data values_; public: + data& ghost_at(const data>& index){ + return values_.at(index); + } + + const data& ghost_at(const data>& index) const { + return values_.at(index); + } + + static constexpr auto get_ghost_dims() { + return data::get_dims(); + } + + data& at(const data>& index){ + std::decay_t ind; + for(uint64_t i = 0u; i < sizeof...(Sides); ++i){ + ind.at({i}) = index.at({i}) + Ghost; + } + return values_.at(ind); + } + + const data& at(const data>& index) const { + std::decay_t ind; + for(uint64_t i = 0u; i < sizeof...(Sides); ++i){ + ind.at({i}) = index.at({i}) + Ghost; + } + return values_.at(ind); + } + + static constexpr auto get_dims(){ + return data,Encode>{{Sides...}}; + } }; } -- cgit v1.2.3