From abeea9920c11231ed24db00e9f68b4490c12a61b Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 10 Apr 2025 15:21:55 +0200 Subject: Reworking from AoS to SoA for data handling --- c++/descriptor.hpp | 57 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 12 deletions(-) (limited to 'c++/descriptor.hpp') diff --git a/c++/descriptor.hpp b/c++/descriptor.hpp index 5ee9918..376e733 100644 --- a/c++/descriptor.hpp +++ b/c++/descriptor.hpp @@ -22,14 +22,14 @@ struct Cell { static constexpr uint64_t Size = SC + Desc::D * DC + Desc::Q * QC; }; -template -struct Field; +template +struct CellFields; -template -struct Field< +template +struct CellFields< Desc, Struct< - CellMembers... + Member, CellFieldNames>... > >; @@ -38,6 +38,37 @@ struct Field< template class df_info{}; +template +class df_info> { +public: + using Descriptor = sch::Descriptor<1,3>; + + static constexpr uint64_t D = 1u; + static constexpr uint64_t Q = 3u; + + static constexpr std::array,Q> directions = {{ + { 0}, + {-1}, + { 1} + }}; + + static constexpr std::array::type, Q> weights = { + 2./3., + 1./6., + 1./6. + }; + + static constexpr std::array opposite_index = { + 0,2,1 + }; + + static constexpr typename saw::native_data_type::type inv_cs2 = 3.0; + static constexpr typename saw::native_data_type::type cs2 = 1./3.; +}; + +/** + * D2Q5 Descriptor + */ template class df_info> { public: @@ -132,9 +163,9 @@ struct meta_schema> { }; template -struct meta_schema> { +struct meta_schema> { using MetaSchema = schema::FixedArray; - using Schema = kel::lbm::sch::Field; + using Schema = kel::lbm::sch::CellFields; }; template @@ -156,16 +187,18 @@ public: }; template -class data, Encode> final { +class data, Encode> final { public: - using Schema = kel::lbm::sch::Field; + using Schema = kel::lbm::sch::CellFields; using MetaSchema = typename meta_schema::MetaSchema; private: - data, Encode> inner_; + data inner_; + data inner_meta_; public: data() = default; - data(const data>& inner_meta__): - inner_{inner_meta__} + data(const data& inner_meta__): + inner_{inner_meta__}, + inner_meta_{inner_meta__} {} template -- cgit v1.2.3