From a7420c5f5f56bb21de0241ed152ad9b55965d42d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 30 Jan 2026 19:08:54 +0100 Subject: Simulation works partially. Reconfirm with writing data out --- lib/core/c++/chunk.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/core/c++/chunk.hpp') diff --git a/lib/core/c++/chunk.hpp b/lib/core/c++/chunk.hpp index 5d20faa..a1f2451 100644 --- a/lib/core/c++/chunk.hpp +++ b/lib/core/c++/chunk.hpp @@ -35,6 +35,7 @@ using SuperChunk = Array; } namespace saw { + template class data,Encode> final { public: @@ -57,19 +58,21 @@ public: return data::get_dims(); } - data& at(const data>& index){ + static constexpr auto to_ghost_index(const data>& index){ std::decay_t ind; for(uint64_t i = 0u; i < sizeof...(Sides); ++i){ ind.at({i}) = index.at({i}) + Ghost; } + return ind; + } + + data& at(const data>& index){ + std::decay_t ind = to_ghost_index(index); 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; - } + std::decay_t ind = to_ghost_index(index); return values_.at(ind); } -- cgit v1.2.3