diff options
Diffstat (limited to 'c++')
-rw-r--r-- | c++/descriptor.h | 31 | ||||
-rw-r--r-- | c++/lattice.h | 12 | ||||
-rw-r--r-- | c++/lbm_unit.h | 31 |
3 files changed, 68 insertions, 6 deletions
diff --git a/c++/descriptor.h b/c++/descriptor.h new file mode 100644 index 0000000..f0f7f28 --- /dev/null +++ b/c++/descriptor.h @@ -0,0 +1,31 @@ +#pragma once + +#include <forstio/codec/schema.h> + +namespace kel { +namespace lbm { +namespace schema { +using namespace saw::schema; + +template<typename T, uint64_t D, uint64_t Q> +struct Descriptor {}; + +template<typename T, uint64_t D, uint64_t Q, uint64_t SC, uint64_t DC, uint64_t QC> +using CellType = FixedArray<T,SC+D*DC+Q*QC>; + +/** + * T... is restricted to Member schemas + */ +template<typename... CellT> +using CellData = Struct< + CellT... +>; + +/** + * T is an array of CellData + */ +template<size_t D, typename T> +using Lattice = Array<T, D>; +} +} +} diff --git a/c++/lattice.h b/c++/lattice.h index eb3b4cc..86c643c 100644 --- a/c++/lattice.h +++ b/c++/lattice.h @@ -7,14 +7,14 @@ namespace lbm { namespace schema { using namespace saw::schema; -template<typename T, size_t D> -using Lattice = Array<T,D>; +template<typename T, uint16_t D, uint16_t Q> +using Lattice = Array<FixedArray<T,Q>,D>; -template<typename T> -using Lattice2D = Lattice<T,2>; +template<typename T, uint16_t Q> +using Lattice2D = Lattice<T,2,Q>; -template<typename T> -using Lattice3D = Lattice<T,3>; +template<typename T, uint16_t Q> +using Lattice3D = Lattice<T,3,Q>; } } } diff --git a/c++/lbm_unit.h b/c++/lbm_unit.h new file mode 100644 index 0000000..20c6e70 --- /dev/null +++ b/c++/lbm_unit.h @@ -0,0 +1,31 @@ +#pragma once + +#include <kel/unit/unit.h> + +#include <string_view> + +namespace kel { +namespace lbm_type { +struct meter { + static constexpr std::string_view name = "meter_l"; + static constexpr std::string_view short_name = "m_l"; +}; + +struct second { + static constexpr std::string_view name = "second_l"; + static constexpr std::string_view short_name = "s_l"; +}; +} + +template<typename S> +using lbm_meter = unit<S, unit_component<lbm_type::meter, 1>>; + +template<typename S> +using lbm_second = unit<S, unit_component<lbm_type::second, 1>>; + +template<typename S> +using lbm_velocity = unit<S, unit_component<lbm_type::meter, 1>, unit_component<lbm_type::second, -1>>; + +template<typename S> +using lbm_acceleration = unit<S, unit_component<lbm_type::meter, 1>, unit_component<lbm_type::second, -2>>; +} |