-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathgeneral.h
More file actions
61 lines (47 loc) · 1.12 KB
/
general.h
File metadata and controls
61 lines (47 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef GENERAL_H_
#define GENERAL_H_
#include <cmath>
#include <complex>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
// JSON
#include <nlohmann/json.hpp>
using nlohmann::json;
using namespace nlohmann;
// Packages
#include "fftw3-mpi.h"
#include "fftw3.h" // this includes the serial fftw as well as mpi header files! See https://fftw.org/doc/MPI-Files-and-Data-Types.html
#include "H5Cpp.h"
#include "reader.h"
#include <Eigen/Dense>
using namespace Eigen;
#include "mpi.h"
#include "sys/stat.h"
#endif
#ifndef FANS_MALLOC_H
#define FANS_MALLOC_H
/* Usage: V *data = FANS_malloc<V>(n); */
template <class V>
inline V *FANS_malloc(std::size_t n)
{
if (n == 0)
throw std::invalid_argument("FANS_malloc: zero-byte request");
void *p = fftw_malloc(n * sizeof(V)); // SIMD-friendly alignment
if (!p)
throw std::bad_alloc();
return static_cast<V *>(p);
}
template <class V>
inline void FANS_free(V *p)
{
fftw_free(p);
}
#endif // FANS_MALLOC_H
// #define EIGEN_RUNTIME_NO_MALLOC