OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
olb::descriptors::FIELD_BASE< C, U > Struct Template Reference

Base of a field whose size is defined by [C,U_1,...,U_N]^T * [1,V_1,...V_N]. More...

#include <descriptorField.h>

+ Inheritance diagram for olb::descriptors::FIELD_BASE< C, U >:
+ Collaboration diagram for olb::descriptors::FIELD_BASE< C, U >:

Public Types

template<typename T >
using value_type = T
 Return value type of field.
 
template<typename T >
using column_type = AbstractColumn<T>
 

Public Member Functions

 FIELD_BASE ()=default
 

Static Public Member Functions

template<std::size_t... V>
static constexpr std::size_t size (std::index_sequence< V... >)
 Get size of field for parameter vector V (strict)
 
template<std::size_t... V>
static constexpr std::size_t size ()
 Get size of field for parameter vector V (zero-padds or shortens V as required)
 
template<typename T , typename DESCRIPTOR >
static constexpr auto getInitialValue ()
 Return value must be a correctly sized and typed olb::Vector.
 
static constexpr bool isSerializable ()
 

Detailed Description

template<unsigned C, unsigned... U>
struct olb::descriptors::FIELD_BASE< C, U >

Base of a field whose size is defined by [C,U_1,...,U_N]^T * [1,V_1,...V_N].

Definition at line 49 of file descriptorField.h.

Member Typedef Documentation

◆ column_type

template<unsigned C, unsigned... U>
template<typename T >
using olb::descriptors::FIELD_BASE< C, U >::column_type = AbstractColumn<T>

Definition at line 63 of file descriptorField.h.

◆ value_type

template<unsigned C, unsigned... U>
template<typename T >
using olb::descriptors::FIELD_BASE< C, U >::value_type = T

Return value type of field.

Most fields are stored using the same value type as the T type parameter of their associated lattice. However this template offers the possibility of declaring a different value type per field. See TYPED_FIELD_BASE.

Definition at line 60 of file descriptorField.h.

Constructor & Destructor Documentation

◆ FIELD_BASE()

template<unsigned C, unsigned... U>
olb::descriptors::FIELD_BASE< C, U >::FIELD_BASE ( )
default

Member Function Documentation

◆ getInitialValue()

template<unsigned C, unsigned... U>
template<typename T , typename DESCRIPTOR >
static constexpr auto olb::descriptors::FIELD_BASE< C, U >::getInitialValue ( )
inlinestaticconstexpr

Return value must be a correctly sized and typed olb::Vector.

Definition at line 95 of file descriptorField.h.

95 {
96 return Vector<value_type<T>, DESCRIPTOR::template size<FIELD_BASE<C,U...>>()>{};
97 }
static constexpr std::size_t size()
Get size of field for parameter vector V (zero-padds or shortens V as required)

References olb::descriptors::FIELD_BASE< C, U >::size().

+ Here is the call graph for this function:

◆ isSerializable()

template<unsigned C, unsigned... U>
static constexpr bool olb::descriptors::FIELD_BASE< C, U >::isSerializable ( )
inlinestaticconstexpr

Definition at line 99 of file descriptorField.h.

99 {
100 return true;
101 }

◆ size() [1/2]

template<unsigned C, unsigned... U>
template<std::size_t... V>
static constexpr std::size_t olb::descriptors::FIELD_BASE< C, U >::size ( )
inlinestaticconstexpr

Get size of field for parameter vector V (zero-padds or shortens V as required)

Definition at line 75 of file descriptorField.h.

76 {
77 if constexpr (sizeof...(U) < sizeof...(V)) {
78 return size(meta::take_n_sequence<sizeof...(U)>(std::index_sequence<V...>()));
79 } else if constexpr (sizeof...(U) > sizeof...(V)) {
80 using namespace meta;
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)>());
84 } else {
85 return size(std::index_sequence<V...>());
86 }
87 __builtin_unreachable();
88 }
constexpr auto take_n_sequence(std::index_sequence< I, Is... >)
Definition meta.h:475
constexpr bool is_zero_sequence(std::index_sequence< Is... >)
Definition meta.h:509

References olb::descriptors::FIELD_BASE< C, U >::size(), and olb::meta::take_n_sequence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size() [2/2]

template<unsigned C, unsigned... U>
template<std::size_t... V>
static constexpr std::size_t olb::descriptors::FIELD_BASE< C, U >::size ( std::index_sequence< V... > )
inlinestaticconstexpr

Get size of field for parameter vector V (strict)

Definition at line 67 of file descriptorField.h.

68 {
69 static_assert(sizeof...(U) == sizeof...(V), "V size fits U params");
70 return ((U*V) + ... + C);
71 }

The documentation for this struct was generated from the following file: