24#ifndef CORE_CONCEPTS_H
25#define CORE_CONCEPTS_H
27#if (defined __cpp_concepts && (__cplusplus >= __cpp_concepts))
49 x + y; x - y; x * y; x / y;
51 x += y; x -= y; x *= y; x /= y;
60template <
typename DESCRIPTOR>
62 { DESCRIPTOR::d } -> std::convertible_to<std::size_t>;
63 requires std::is_base_of_v<meta::list_base, DESCRIPTOR>;
66namespace placeholder {
77template <
typename DESCRIPTOR>
81 { DESCRIPTOR::q } -> std::convertible_to<std::size_t>;
83 requires (DESCRIPTOR::template provides<descriptors::POPULATION>());
94template <
typename FIELD>
99 { FIELD::template size<placeholder::Descriptor>() } -> std::convertible_to<std::size_t>;
101 { FIELD::template getInitialValue<placeholder::ValueType,placeholder::Descriptor>() } -> std::same_as<
103 placeholder::Descriptor::template size<FIELD>()>
106 { FIELD::isSerializable() } -> std::same_as<bool>;
109namespace placeholder {
112 template <
typename T>
115 template <
typename T>
122 template <
typename DESCRIPTOR>
123 static constexpr std::size_t
size() {
127 template <
typename T,
typename DESCRIPTOR>
136template <
typename CELL>
139 { cell[
unsigned{}] } -> std::convertible_to<const typename CELL::value_t&>;
143template <
typename CELL>
144concept Cell =
requires(CELL cell) {
153 { cell.template getField<descriptors::POPULATION>() } -> std::same_as<
160 { cell.template getFieldComponent<descriptors::POPULATION>(
unsigned{}) } -> std::convertible_to<typename CELL::value_t>;
162 { cell.template getFieldPointer<descriptors::POPULATION>()[
unsigned{}] } -> std::convertible_to<typename CELL::value_t>;
166template <
typename PARAMETERS>
167concept Parameters =
requires (
typename PARAMETERS::template include_fields<placeholder::Field> parameters) {
174 { parameters.template provides<placeholder::Field>() } -> std::same_as<bool>;
175 { parameters.template get<placeholder::Field>() } -> std::convertible_to<
179 parameters.template set<placeholder::Field>(
183namespace placeholder {
194 template <
typename FIELD>
196 template <
typename FIELD>
198 template <
typename FIELD>
200 template <
typename FIELD>
208 template <
typename...>
211 template <
typename FIELD>
213 template <
typename FIELD>
215 if constexpr (descriptor_t::template size<FIELD>() == 1) {
221 template <
typename FIELD>
229 template <
typename...>
232 template <
typename FIELD>
234 template <
typename FIELD>
236 if constexpr (descriptor_t::template size<FIELD>() == 1) {
242 template <
typename FIELD>
251template <
typename CELL>
252concept DynamicCell =
requires(CELL cell,
typename CELL::value_t value) {
257 { cell.computeRho() } -> std::convertible_to<typename CELL::value_t>;
258 cell.computeU(&value);
259 cell.computeJ(&value);
260 cell.computeRhoU(value, &value);
261 cell.computeStress(&value);
262 cell.computeAllMomenta(value,&value,&value);
265 cell.defineRho(value);
266 cell.defineU(&value);
267 cell.defineRhoU(value,&value);
268 cell.defineAllMomenta(value,&value,&value);
269 cell.inverseShiftRhoU(value,&value);
274template <
typename OPERATOR>
277 { OPERATOR::scope } -> std::convertible_to<OperatorScope>;
282 { op.getPriority() } -> std::same_as<int>;
287template <
typename OPERATOR>
290 { OPERATOR::scope } -> std::convertible_to<OperatorScope>;
294 { op.getPriority() } -> std::same_as<int>;
304#error C++20 concept support is required
#define OPERATOR(OP, rhs)
The description of a algoritmic differentiation data type using the forward method – header file.
Foundational arithmetic type for all computations.
Block-wise operator with scope, priority and apply template.
Cell-wise operator with scope, priority and apply template.
Cell exposing populations and associated fields.
Full cell exposing populations, moments, dynamics and associated fields.
Descriptor of DdQq lattice and associated constants.
Basic cell exposing value-typed population references.
Parameters tuple for use in collision, non-local operators.
descriptors::D3Q19<> Descriptor3D
descriptors::D2Q9<> Descriptor2D
descriptors::D2Q9<> Descriptor
constexpr T invCs2() any_platform
constexpr T t(unsigned iPop, tag::CUM) any_platform
constexpr int c(unsigned iPop, unsigned iDim) any_platform
constexpr int opposite(unsigned iPop) any_platform
Top level namespace for all of OpenLB.
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>
Vector< typename FIELD::template value_type< T >, DESCRIPTOR::template size< FIELD >() > FieldD
Vector storing a single field instance.
@ PerBlock
Per-block application, i.e. OPERATOR::apply is passed a ConcreteBlockLattice.
@ PerCell
Per-cell application, i.e. OPERATOR::apply is passed a CELL concept implementation.
@ PerCellWithParameters
Per-cell application with parameters, i.e. OPERATOR::apply is passed a CELL concept implementation an...
Abstract declarator of Column-like storage.
auto getFieldComponent(unsigned iPop)
void setField(FieldD< ValueType, Descriptor, FIELD > &&)
static constexpr bool isSerializable()
static constexpr std::size_t size()
static constexpr auto getInitialValue()
ValueType f[Descriptor::q]
ValueType & operator[](unsigned iPop)
void set(FieldD< ValueType, Descriptor2D, FIELD > &&)
void set(FieldD< ValueType, Descriptor3D, FIELD > &&)
efficient implementation of a vector class