CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
macros.hpp
Go to the documentation of this file.
1/*
2 * CoDiPack, a Code Differentiation Package
3 *
4 * Copyright (C) 2015-2024 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://www.scicomp.uni-kl.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum, Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of CoDiPack (http://www.scicomp.uni-kl.de/software/codi).
11 *
12 * CoDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * CoDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty
19 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU General Public License for more details.
22 * You should have received a copy of the GNU
23 * General Public License along with CoDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * For other licensing options please contact us.
27 *
28 * Authors:
29 * - SciComp, University of Kaiserslautern-Landau:
30 * - Max Sagebaum
31 * - Johannes Blühdorn
32 * - Former members:
33 * - Tim Albring
34 */
35#pragma once
36
37#include "../config.h"
38
42namespace codi {
43
45 template<typename... Args>
46 CODI_INLINE void CODI_UNUSED(Args const&...) {}
47
49#define CODI_UNUSED_ARG(arg) /* arg */
50
53#define CODI_ENABLE_CHECK(option, condition) (!(option) || (condition))
54
56#define CODI_TO_STRING2(expression) #expression
57
59#define CODI_TO_STRING(expression) CODI_TO_STRING2(expression)
60
62#define CODI_IS_CPP14 (201402L <= __cplusplus)
63
65#define CODI_IS_CPP17 (201703L <= __cplusplus)
66
67/*******************************************************************************/
83#if CODI_IDE
84 #define CODI_DECLARE_DEFAULT(Type, Default) Default
85#else
86 #define CODI_DECLARE_DEFAULT(Type, Default) Type
87#endif
88
90// Does not work in QT if CODI_DECLARE_DEFAULT is used
91#if CODI_IDE
92 #define CODI_DD(Type, Default) Default
93#else
94 #define CODI_DD(Type, Default) Type
95#endif
96
98#define CODI_ANY int
99
100#ifndef DOXYGEN_DISABLE
102 struct ImplProxy {};
103#endif
105#define CODI_IMPLEMENTATION ImplProxy
106
108#define CODI_TEMPLATE(...) __VA_ARGS__
109
111#define CODI_T(...) CODI_TEMPLATE(__VA_ARGS__)
112
114#define CODI_UNDEFINED void
115
117#define CODI_UNDEFINED_VALUE false
118
119#if CODI_IDE
120 #define CODI_STATIC_ASSERT(cond, message) /* Do not check in IDE mode */
121#else
123 #define CODI_STATIC_ASSERT(cond, message) static_assert(cond, message)
124#endif
125
126#if CODI_IDE
128 struct ActiveTypeProxy {
129 using Real = double;
130 using Identifier = int;
131 };
132
134 #define CODI_DEFAULT_TAPE FullTapeInterface<double, double, int, EmptyPosition>
135
137 #define CODI_DEFAULT_PARALLEL_TAPE CODI_UNION<CODI_DEFAULT_TAPE, EditingTapeInterface<EmptyPosition>>
138
140 #define CODI_DEFAULT_LHS_EXPRESSION LhsExpressionInterface<double, double, CODI_DEFAULT_TAPE, CODI_ANY>
141#endif
142
143#ifndef DOXYGEN_DISABLE
145 template<typename First, typename... Tail>
146 struct CODI_UNION : public First, public CODI_UNION<Tail...> {};
147#endif
148
150 template<typename First>
151 struct CODI_UNION<First> : public First {};
152
154
156#define CODI_WRAP_FUNCTION(NAME, FUNC) \
157 struct NAME { \
158 public: \
159 \
160 template<typename... Args> \
161 void operator()(Args&&... args) const { \
162 FUNC(std::forward<Args>(args)...); \
163 } \
164 }
165
167#define CODI_WRAP_FUNCTION_TEMPLATE(NAME, FUNC) \
168 template<typename... TT> \
169 struct NAME { \
170 public: \
171 \
172 template<typename... Args> \
173 void operator()(Args&&... args) const { \
174 FUNC<TT...>(std::forward<Args>(args)...); \
175 } \
176 }
177}
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition: config.h:457
CoDiPack - Code Differentiation Package.
Definition: codi.hpp:90
void CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition: macros.hpp:46
Represents a concrete lvalue in the CoDiPack expression tree.
Definition: activeType.hpp:52