OpenLB 1.7
Loading...
Searching...
No Matches
descriptorTag.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2019 Adrian Kummerlaender
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef DESCRIPTOR_TAG_H
25#define DESCRIPTOR_TAG_H
26
27#include "core/meta.h"
28
29namespace olb {
30
31namespace descriptors {
32
33// *INDENT-OFF*
34
36
37
40 template <unsigned, unsigned>
41 static constexpr unsigned size()
42 {
43 return 0; // a tag doesn't have a size
44 }
45
46 template <typename T>
47 using value_type = void;
48};
49
50template <typename FIELD>
51using is_tag_field = std::is_base_of<DESCRIPTOR_TAG, FIELD>;
52
53namespace tag {
54
56
59struct CATEGORY { };
60
62struct DEFAULT : public CATEGORY, public DESCRIPTOR_TAG { };
63
65
68template <typename BASE, typename FALLBACK, typename... FIELDS>
69using field_with_base = typename std::conditional<
70 std::is_void<typename meta::first_type_with_base<BASE, FIELDS...>::type>::value,
71 FALLBACK,
72 typename meta::first_type_with_base<BASE, FIELDS...>::type
73>::type;
74
75}
76
78
79}
80
81}
82
83#endif
typename std::conditional< std::is_void< typename meta::first_type_with_base< BASE, FIELDS... >::type >::value, FALLBACK, typename meta::first_type_with_base< BASE, FIELDS... >::type >::type field_with_base
Returns first item of FIELDS type list that is derived from BASE.
std::is_base_of< DESCRIPTOR_TAG, FIELD > is_tag_field
Top level namespace for all of OpenLB.
Base of a descriptor tag.
static constexpr unsigned size()
Base of all tags describing the category of a descriptor.
Implicit default category of normal descriptors.
Get first type based on BASE contained in a given type list.
Definition meta.h:171