#pragma once #include "common.hpp" #include "flatten.hpp" namespace kel { namespace lbm { namespace sch { namespace impl { template> struct chunk_schema_type_helper; template struct chunk_schema_type_helper, saw::tmpl_value_group> final { using Schema = typename chunk_schema_type_helper, saw::tmpl_value_group>::Schema; }; template struct chunk_schema_type_helper, saw::tmpl_value_group> final { using Schema = FixedArray; }; } template struct Chunk { using InnerSchema = typename impl::chunk_schema_type_helper>::Schema; }; // Not needed for now template using SuperChunk = Array; } } } namespace saw { template class data,Encode> final { public: using Schema = kel::lbm::sch::Chunk; private: using InnerSchema = typename Schema::InnerSchema; using ValueSchema = typename InnerSchema::ValueType; data values_; public: data& ghost_at(const data>& index){ return values_.at(index); } const data& ghost_at(const data>& index) const { return values_.at(index); } static constexpr auto get_ghost_dims() { return data::get_dims(); } data& at(const data>& index){ std::decay_t ind; for(uint64_t i = 0u; i < sizeof...(Sides); ++i){ ind.at({i}) = index.at({i}) + Ghost; } 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; } return values_.at(ind); } static constexpr auto get_dims(){ return data,Encode>{{Sides...}}; } auto flat_data(){ return values_.flat_data(); } static constexpr auto flat_size() { return data::flat_dims(); } }; template struct meta_schema> { using MetaSchema = typename meta_schema::MetaSchema; }; }