NGSolve  5.3
ngstd.hpp
1 #ifndef FILE_NGSTD
2 #define FILE_NGSTD
3 
4 /*********************************************************************/
5 /* File: ngstd.hpp */
6 /* Author: Joachim Schoeberl */
7 /* Date: 25. Mar. 2000 */
8 /*********************************************************************/
9 
10 /*
11  ng-standard classes
12 */
13 
14 #include <ngs_stdcpp_include.hpp>
15 
16 #ifdef WIN32
17  #ifdef NGS_EXPORTS
18  #define NGS_DLL_HEADER __declspec(dllexport)
19  #else
20  #define NGS_DLL_HEADER __declspec(dllimport)
21  #endif
22 #else
23  #if __GNUC__ >= 4
24  #define NGS_DLL_HEADER __attribute__ ((visibility ("default")))
25  #else
26  #define NGS_DLL_HEADER
27  #endif
28 #endif
29 
30 /*
31 inline void * operator new (size_t cnt)
32 {
33  static int cnt_new = 0;
34  cnt_new++;
35  std::cout << "private new called, cnt = " << cnt_new << ", bytes = " << cnt << std::endl;
36  return operator new(cnt, std::nothrow);
37 }
38 
39 inline void * operator new[] (size_t cnt)
40 {
41  static int cnt_new = 0;
42  cnt_new++;
43  std::cout << "private new[] called, cnt = " << cnt_new << ", bytes = " << cnt << std::endl;
44  return operator new[](cnt, std::nothrow);
45 }
46 */
47 
48 
49 
50 
51 
52 // #include "dynamicmem.hpp"
53 
54 
55 namespace ngstd
56 {
57  NGS_DLL_HEADER extern int printmessage_importance;
58  NGS_DLL_HEADER extern const std::string ngsolve_version;
59 }
60 
61 
62 
63 /*
64 namespace ngstd
65 {
66  using netgen::DynamicMem;
67 }
68 */
69 
70 
78 namespace ngstd
79 {
80  using namespace std;
81  template <typename T>
83  {
84  T val;
85  public:
86  ParallelValue (const T & _val) : val(_val) { ; }
87  operator T () const { return val; }
88  };
89 
90  template <typename FUNC> class ParallelFunction
91  {
92  FUNC f;
93  public:
94  ParallelFunction (const FUNC & _f) : f(_f) { ; }
95  operator FUNC () const { return f; }
96  auto operator() (size_t i) const { return f(i); }
97  };
98 
99 }
100 
101 #include <ngs_defines.hpp>
102 
103 // #include "mycomplex.hpp"
104 #include <core/ngcore.hpp>
105 namespace ngstd
106 {
107  using namespace ngcore;
108  using ngcore::INT;
109 } // namespace ngstd
110 
111 #include "ngs_utils.hpp"
112 #include "ngsstream.hpp"
113 #include "templates.hpp"
114 
115 #include "simd_complex.hpp"
116 
117 #include "blockalloc.hpp"
118 #include "autoptr.hpp"
119 #include "memusage.hpp"
120 
121 #include "evalfunc.hpp"
122 #include "sample_sort.hpp"
123 
124 #include "autodiff.hpp"
125 #include "autodiffdiff.hpp"
126 #include "polorder.hpp"
127 #include "stringops.hpp"
128 #include "statushandler.hpp"
129 
130 #include "mpiwrapper.hpp"
131 #ifndef WIN32
132 #include "sockets.hpp"
133 #endif
134 
135 namespace ngstd
136 {
137 #ifdef WIN32
138  const char dirslash = '\\';
139 #else
140  const char dirslash = '/';
141 #endif
142 }
143 
144 
145 inline void NOOP_Deleter(void *) { ; }
146 
147 
148 #ifdef GOLD
149 #include <ngstd_gold.hpp>
150 #endif
151 
152 
153 
154 #include "cuda_ngstd.hpp"
155 
156 #endif
ngstd::ParallelValue
Definition: ngstd.hpp:82
ngstd
namespace for standard data types and algorithms.
Definition: ngstd.hpp:55
ngstd::ParallelFunction
Definition: ngstd.hpp:90