From 24bf28a8fb9cc8c3a90b77de9b60728bece7885d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sat, 18 Oct 2025 18:01:14 +0200 Subject: Moving project structure for more less compilation --- c++/descriptor.hpp | 296 ----------------------------------------------------- 1 file changed, 296 deletions(-) delete mode 100644 c++/descriptor.hpp (limited to 'c++/descriptor.hpp') diff --git a/c++/descriptor.hpp b/c++/descriptor.hpp deleted file mode 100644 index d04d217..0000000 --- a/c++/descriptor.hpp +++ /dev/null @@ -1,296 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace kel { -namespace lbm { -namespace sch { -using namespace saw::schema; - -template -struct Descriptor { - static constexpr uint64_t D = DV; - static constexpr uint64_t Q = QV; -}; - -template -struct Cell { - using Descriptor = Desc; - static constexpr uint64_t SC = SC_V; - static constexpr uint64_t DC = DC_V; - static constexpr uint64_t QC = QC_V; - static constexpr uint64_t Size = SC + Desc::D * DC + Desc::Q * QC; -}; - -template -struct CellField; - -template -struct CellField< - Desc, - Struct< - Member... - > ->; - -} - -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: - using Descriptor = sch::Descriptor<2,5>; - - static constexpr uint64_t D = 2u; - static constexpr uint64_t Q = 5u; - - static constexpr std::array, Q> directions = {{ - { 0, 0}, - {-1, 0}, - { 1, 0}, - { 0,-1}, - { 0, 1}, - }}; - - static constexpr std::array::type,Q> weights = { - 1./3., - 1./6., - 1./6., - 1./6., - 1./6. - }; - - static constexpr std::array opposite_index = { - 0, - 2, - 1, - 4, - 3 - }; - - static constexpr typename saw::native_data_type::type inv_cs2 = 3.0; - static constexpr typename saw::native_data_type::type cs2 = 1./3.; -}; - -template -class df_info> { -public: - using Descriptor = sch::Descriptor<2,9>; - - static constexpr uint64_t D = 2u; - static constexpr uint64_t Q = 9u; - - static constexpr std::array, Q> directions = {{ - { 0, 0}, - {-1, 0}, - { 1, 0}, - { 0,-1}, - { 0, 1}, - {-1,-1}, - { 1, 1}, - {-1, 1}, - { 1,-1} - }}; - - static constexpr std::array::type,Q> weights = { - 4./9., - 1./9., - 1./9., - 1./9., - 1./9., - 1./36., - 1./36., - 1./36., - 1./36. - }; - - static constexpr std::array opposite_index = { - 0, - 2, - 1, - 4, - 3, - 6, - 5, - 8, - 7 - }; - - static constexpr typename saw::native_data_type::type inv_cs2 = 3.0; - static constexpr typename saw::native_data_type::type cs2 = 1./3.; -}; -/* -template -class df_info> { -public: - using Descriptor = sch::Descriptor<3,27>; - - static constexpr uint64_t D = 3u; - static constexpr uint64_t Q = 27u; - - static constexpr std::array, Q> directions = {{ - { 0, 0, 0}, - {-1, 0, 0}, - { 1, 0, 0}, - { 0,-1, 0}, - { 0, 1, 0}, - {-1,-1, 0}, - { 1, 1, 0}, - {-1, 1, 0}, - { 1,-1, 0} - }}; - - static constexpr std::array::type,Q> weights = { - 4./9., - 1./9., - 1./9., - 1./9., - 1./9., - 1./36., - 1./36., - 1./36., - 1./36. - }; - - static constexpr std::array opposite_index = { - 0, - 2, - 1, - 4, - 3, - 6, - 5, - 8, - 7 - }; - - static constexpr typename saw::native_data_type::type inv_cs2 = 3.0; - static constexpr typename saw::native_data_type::type cs2 = 1./3.; -}; -*/ - -template -class cell_schema_builder { -private: - saw::schema_factory factory_struct_; -public: - cell_schema_builder() = default; - - cell_schema_builder(saw::schema_factory inp): - factory_struct_{inp} - {} - - /* - template - constexpr auto require() const noexcept { - return {factory_struct_.add_maybe()}; - } - */ -}; - -} -} - -namespace saw { -template -struct meta_schema> { - using MetaSchema = schema::Void; - using Schema = kel::lbm::sch::Cell; -}; - -template -struct meta_schema> { - using MetaSchema = schema::FixedArray; - using Schema = kel::lbm::sch::CellField; -}; - -template -class data, Encode> final { -public: - using Schema = kel::lbm::sch::Cell; - using MetaSchema = typename meta_schema::MetaSchema; -private: - data, Encode> inner_; -public: - data() = default; - - data& operator()(const data& index){ - return inner_.at(index); - } - - const data& operator()(const data& index)const{ - return inner_.at(index); - } - - const data, Encode> copy() const { - return *this; - } -}; - -template -class data, Encode> final { -public: - using Schema = kel::lbm::sch::CellField; - using MetaSchema = typename meta_schema::MetaSchema; -private: - data, Encode> inner_; -public: - data() = default; - data(const data& inner_meta__): - inner_{inner_meta__} - {} - - const data meta() const { - return inner_.get_dims(); - } - - template - data get_dim_size() const { - static_assert(i < Desc::D, "Not enough dimensions"); - return inner_.template get_dim_size(); - } - - const data& operator()(const data, Encode>& index)const{ - return inner_.at(index); - } - - data& operator()(const data, Encode>& index){ - return inner_.at(index); - } -}; -} -- cgit v1.2.3