FrictionQPotSpringBlock v0.22.7
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
7#ifndef FRICTIONQPOTSPRINGBLOCK_CONFIG_H
8#define FRICTIONQPOTSPRINGBLOCK_CONFIG_H
9
13#define Q(x) #x
14#define QUOTE(x) Q(x)
15
16#define FRICTIONQPOTSPRINGBLOCK_WARNING_IMPL(message, file, line) \
17 std::cout << std::string(file) + ":" + std::to_string(line) + ": " message ") \n\t";
18
19#define FRICTIONQPOTSPRINGBLOCK_ASSERT_IMPL(expr, file, line) \
20 if (!(expr)) { \
21 throw std::runtime_error( \
22 std::string(file) + ":" + std::to_string(line) + ": assertion failed (" #expr ") \n\t" \
23 ); \
24 }
25
26#ifdef FRICTIONQPOTSPRINGBLOCK_ENABLE_DEBUG
27#define FRICTIONQPOTFEM_ENABLE_ASSERT
28#endif
37#define FRICTIONQPOTSPRINGBLOCK_REQUIRE(expr) \
38 FRICTIONQPOTSPRINGBLOCK_ASSERT_IMPL(expr, __FILE__, __LINE__)
39
58#ifdef FRICTIONQPOTSPRINGBLOCK_ENABLE_ASSERT
59#define FRICTIONQPOTSPRINGBLOCK_ASSERT(expr) \
60 FRICTIONQPOTSPRINGBLOCK_ASSERT_IMPL(expr, __FILE__, __LINE__)
61#else
62#define FRICTIONQPOTSPRINGBLOCK_ASSERT(expr)
63#endif
64
79#ifdef FRICTIONQPOTSPRINGBLOCK_ENABLE_DEBUG
80#define FRICTIONQPOTSPRINGBLOCK_DEBUG(expr) \
81 FRICTIONQPOTSPRINGBLOCK_ASSERT_IMPL(expr, __FILE__, __LINE__)
82#else
83#define FRICTIONQPOTSPRINGBLOCK_DEBUG(expr)
84#endif
85
95#ifdef FRICTIONQPOTSPRINGBLOCK_DISABLE_WARNING
96#define FRICTIONQPOTSPRINGBLOCK_WARNING(message)
97#else
98#define FRICTIONQPOTSPRINGBLOCK_WARNING(message) \
99 FRICTIONQPOTSPRINGBLOCK_WARNING_IMPL(message, __FILE__, __LINE__)
100#endif
101
111#ifdef FRICTIONQPOTSPRINGBLOCK_ENABLE_WARNING_PYTHON
112#define FRICTIONQPOTSPRINGBLOCK_WARNING_PYTHON(message) \
113 FRICTIONQPOTSPRINGBLOCK_WARNING_IMPL(message, __FILE__, __LINE__)
114#else
115#define FRICTIONQPOTSPRINGBLOCK_WARNING_PYTHON(message)
116#endif
117
138#ifndef FRICTIONQPOTSPRINGBLOCK_VERSION
139#define FRICTIONQPOTSPRINGBLOCK_VERSION "@PROJECT_VERSION@"
140#endif
141
146
150namespace array_type {
151
152#ifdef FRICTIONQPOTSPRINGBLOCK_USE_XTENSOR_PYTHON
153
157template <typename T, size_t N>
158using tensor = xt::pytensor<T, N>;
159
163template <typename T>
164using array = xt::pyarray<T>;
165
166#else
167
171template <typename T, size_t N>
172using tensor = xt::xtensor<T, N>;
173
177template <typename T>
178using array = xt::xarray<T>;
179
180#endif
181
182} // namespace array_type
183
187using size_type = ptrdiff_t;
188
189namespace detail {
190
196inline std::string unquote(const std::string& arg)
197{
198 std::string ret = arg;
199 ret.erase(std::remove(ret.begin(), ret.end(), '\"'), ret.end());
200 return ret;
201}
202
203} // namespace detail
204
209inline std::string version()
210{
211 return detail::unquote(std::string(QUOTE(FRICTIONQPOTSPRINGBLOCK_VERSION)));
212}
213
214} // namespace FrictionQPotSpringBlock
215
216#endif
std::string unquote(const std::string &arg)
Remove quotes from a string.
Definition config.h:196
#define FRICTIONQPOTSPRINGBLOCK_VERSION
Current version.
Definition config.h:139
xt::xtensor< T, N > tensor
Fixed (static) rank array.
Definition config.h:172
xt::xarray< T > array
Arbitrary rank array.
Definition config.h:178
Tensor products / operations.
Definition config.h:145
std::string version()
Return version string, e.g.
Definition config.h:209
ptrdiff_t size_type
Type using for size and shapes of arrays.
Definition config.h:187