#pragma once #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 Field; template struct Field< Desc, Struct< CellMembers... > >; } template class df_info{}; template class df_info> { static constexpr std::array, 5> directions = {{ { 0, 0}, {-1, 0}, { 0,-1}, { 0, 1}, { 1, 0} }}; static constexpr std::array::type,5> weights = { 1./3., 1./6., 1./6., 1./6., 1./6. }; static constexpr typename saw::native_data_type::type cs2 = 1./3.; }; } } 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::Field; }; 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_(index); } }; template class data, Encode> final { public: using Schema = kel::lbm::sch::Field; using MetaSchema = typename meta_schema::MetaSchema; private: data, Encode> inner_; public: data(const data>& inner_meta__): inner_{inner_meta__} {} template data get_dim_size() const { static_assert(i < Desc::D, "Not enough dimensions"); return inner_.template get_dim_size(); } data& operator()(const data, Encode>& index){ return inner_(index); } }; }