24#ifndef DESCRIPTOR_FIELD_H
25#define DESCRIPTOR_FIELD_H
40namespace descriptors {
48template <
unsigned C,
unsigned... U>
66 template <std::size_t... V>
67 static constexpr std::size_t
size(std::index_sequence<V...>)
69 static_assert(
sizeof...(U) ==
sizeof...(V),
"V size fits U params");
70 return ((U*V) + ... + C);
74 template <std::size_t... V>
75 static constexpr std::size_t
size()
77 if constexpr (
sizeof...(U) <
sizeof...(V)) {
79 }
else if constexpr (
sizeof...(U) >
sizeof...(V)) {
81 static_assert(is_zero_sequence(drop_n_sequence<
sizeof...(V)>(std::index_sequence<U...>())),
82 "Dropped U entries are zero");
83 return size(std::index_sequence<V...>() + zero_sequence<
sizeof...(U) -
sizeof...(V)>());
85 return size(std::index_sequence<V...>());
87 __builtin_unreachable();
94 template <
typename T,
typename DESCRIPTOR>
105template <
typename TYPE,
unsigned C,
unsigned... U>
107 template <
typename T>
110 template <
typename T>
113 template <
typename T,
typename DESCRIPTOR>
119 return !std::is_pointer_v<TYPE>;
123template <
template<
typename>
typename TYPE,
unsigned C,
unsigned... U>
125 template <
typename T>
128 template <
typename T>
131 template <
typename T,
typename DESCRIPTOR>
143 template <
typename T>
146 template <
typename T>
151template <
typename FIELD>
158 template <
unsigned D,
unsigned Q>
159 static constexpr unsigned size()
161 return (D * (D+1)) / 2;
166template <
typename TYPE>
168 static_assert(std::is_object_v<TYPE>,
"TYPE must be object");
216 template <
typename T,
typename DESCRIPTOR>
257 template <
typename T,
typename DESCRIPTOR>
271 typename WANTED_FIELD,
272 typename CURRENT_FIELD,
275 std::enable_if_t<std::is_same<WANTED_FIELD,CURRENT_FIELD>::value,
int> = 0
283 typename WANTED_FIELD,
284 typename CURRENT_FIELD,
287 std::enable_if_t<!std::is_same<WANTED_FIELD,CURRENT_FIELD>::value,
int> = 0
292 static_assert(
sizeof...(FIELDS) > 0,
"Field not found.");
Basic value-substitute enabling extraction of expression trees for code generation.
constexpr unsigned getIndexInFieldList()
typename std::is_base_of< PROPAGATABLE_FIELD_BASE, FIELD >::type is_propagatable_field
Evaluates to true iff FIELD is propagatable (e.g. POPULATION)
Top level namespace for all of OpenLB.
Abstract declarator of Column-like storage.
Abstract declarator of cyclic Column-like storage.
Base of a field whose size is defined by [C,U_1,...,U_N]^T * [1,V_1,...V_N].
static constexpr bool isSerializable()
static constexpr std::size_t size()
Get size of field for parameter vector V (zero-padds or shortens V as required)
static constexpr std::size_t size(std::index_sequence< V... >)
Get size of field for parameter vector V (strict)
static constexpr auto getInitialValue()
Return value must be a correctly sized and typed olb::Vector.
T value_type
Return value type of field.
static constexpr auto getInitialValue()
Base of a descriptor field of pointer type.
static constexpr auto getInitialValue()
Base of a implicitly propagatable descriptor field.
static constexpr auto getInitialValue()
static constexpr bool isSerializable()
Base of a tensor-valued descriptor field.
static constexpr unsigned size()
Base of a descriptor field of scalar TYPE with dimensions A*B + B*Q + C.
static constexpr auto getInitialValue()
std::conditional_t< std::is_same_v< T, Expr >, Expr, TYPE > value_type
static constexpr bool isSerializable()
efficient implementation of a vector class