diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-01-30 19:08:54 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-01-30 19:09:36 +0100 |
| commit | a7420c5f5f56bb21de0241ed152ad9b55965d42d (patch) | |
| tree | 1688a747ffae42e4c2fe0917ed23e5690a88ca55 /lib/core/c++/chunk.hpp | |
| parent | 7dd015e6932c516528a88659163bca17cf43f1cc (diff) | |
| download | libs-lbm-a7420c5f5f56bb21de0241ed152ad9b55965d42d.tar.gz | |
Simulation works partially. Reconfirm with writing data out
Diffstat (limited to 'lib/core/c++/chunk.hpp')
| -rw-r--r-- | lib/core/c++/chunk.hpp | 13 |
1 files changed, 8 insertions, 5 deletions
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<ChunkSchema,Dim>; } namespace saw { + template<typename Sch, uint64_t Ghost, uint64_t... Sides, typename Encode> class data<kel::lbm::sch::Chunk<Sch,Ghost,Sides...>,Encode> final { public: @@ -57,19 +58,21 @@ public: return data<InnerSchema,Encode>::get_dims(); } - data<ValueSchema, Encode>& at(const data<schema::FixedArray<schema::UInt64,sizeof...(Sides)>>& index){ + static constexpr auto to_ghost_index(const data<schema::FixedArray<schema::UInt64,sizeof...(Sides)>>& index){ std::decay_t<decltype(index)> ind; for(uint64_t i = 0u; i < sizeof...(Sides); ++i){ ind.at({i}) = index.at({i}) + Ghost; } + return ind; + } + + data<ValueSchema, Encode>& at(const data<schema::FixedArray<schema::UInt64,sizeof...(Sides)>>& index){ + std::decay_t<decltype(index)> ind = to_ghost_index(index); return values_.at(ind); } const data<ValueSchema, Encode>& at(const data<schema::FixedArray<schema::UInt64,sizeof...(Sides)>>& index) const { - std::decay_t<decltype(index)> ind; - for(uint64_t i = 0u; i < sizeof...(Sides); ++i){ - ind.at({i}) = index.at({i}) + Ghost; - } + std::decay_t<decltype(index)> ind = to_ghost_index(index); return values_.at(ind); } |
