HMLP: High-performance Machine Learning Primitives
common.hpp
1 #ifndef _PVFMM_COMMON_HPP_
2 #define _PVFMM_COMMON_HPP_
3 
4 // Define NULL
5 #ifndef NULL
6 #define NULL 0
7 #endif
8 
9 #include <cstddef>
10 #include <cstdint>
11 namespace pvfmm {
12 typedef long Integer; // bounded numbers < 32k
13 typedef int64_t Long; // problem size
14 }
15 
16 #include <iostream>
17 
18 #define PVFMM_WARN(msg) \
19  do { \
20  std::cerr << "\n\033[1;31mWarning:\033[0m " << msg << '\n'; \
21  } while (0)
22 
23  #define PVFMM_ERROR(msg) \
24  do { \
25  std::cerr << "\n\033[1;31mError:\033[0m " << msg << '\n'; \
26  abort(); \
27  } while (0)
28 
29  #define PVFMM_ASSERT_MSG(cond, msg) \
30  do { \
31  if (!(cond)) PVFMM_ERROR(msg); \
32  } while (0)
33 
34  #define PVFMM_ASSERT(cond) \
35  do { \
36  if (!(cond)) { \
37  fprintf(stderr, "\n%s:%d: %s: Assertion `%s' failed.\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #cond); \
38  abort(); \
39  } \
40  } while (0)
41 
42  #define UNUSED(x) (void)(x) // to ignore unused variable warning.
43 
44 namespace pvfmm {
45  #ifdef PVFMM_MEMDEBUG
46 template <class ValueType> class ConstIterator;
47 template <class ValueType> class Iterator;
48 template <class ValueType, Long DIM> class StaticArray;
49  #else
50 template <typename ValueType> using Iterator = ValueType*;
51 template <typename ValueType> using ConstIterator = const ValueType*;
52 template <typename ValueType, Long DIM> using StaticArray = ValueType[DIM];
53  #endif
54 }
55 
56 #include <pvfmm/math_utils.hpp>
57 
58 #endif //_PVFMM_COMMON_HPP_
Definition: cheb_utils.hpp:12