temporary fix for compilation error with GMX_OPENMM=ON
[gromacs/rigid-bodies.git] / src / mdlib / fft5d.h
blob6356195339b149851d08a8e195e2b8e6aaed8eb4
1 #ifndef FFT5D_H_
2 #define FFT5D_H_
4 #include <complex.h>
6 #ifdef HAVE_CONFIG_H
7 #include <config.h>
8 #endif
10 #ifdef NOGMX
11 /*#define GMX_MPI*/
12 /*#define GMX_FFT_FFTW3*/
13 FILE* debug;
14 #endif
16 #ifdef GMX_LIB_MPI
17 #include <mpi.h>
18 #elif defined GMX_THREADS
19 #include "tmpi.h"
20 #else
21 #ifndef HAVE_MPICOMM
22 #ifndef _gmx_parallel_3dfft_h_
23 typedef void* MPI_Comm;
24 #endif
25 #define HAVE_MPICOMM
26 #endif
27 double MPI_Wtime();
28 #endif
29 #ifdef GMX_THREADS
30 #include "tmpi.h"
31 #endif
33 #include "gmx_fft.h"
35 #ifdef GMX_FFT_FFTW3
36 #include <fftw3.h>
37 #ifdef FFT5D_MPI_TRANSPOSE
38 #include <fftw3-mpi.h>
39 #endif
40 #endif
41 /* TODO: optional wrapper
42 #ifdef GMX_FFT_MKL
43 #include <fftw/fftw3.h>
44 #ifdef FFT5D_MPI_TRANSPOSE
45 #include <fftw/fftw3-mpi.h>
46 #endif
47 #endif
50 #ifndef NOGMX
51 #ifndef GMX_DOUBLE /*TODO how to not how have to do this GMX specific in here?
52 can't be in gmx_parallel_3dfft.h because it has to be also be set when included from fft5d.c */
53 #define FFT5D_SINGLE
54 #endif
55 #endif
57 typedef t_complex fft5d_type;
58 #ifdef FFT5D_SINGLE
59 #define FFTW(x) fftwf_##x
60 typedef float fft5d_rtype;
61 #define FFT5D_EPS __FLT_EPSILON__
62 #define FFT5D_MPI_RTYPE MPI_FLOAT
63 #else
64 #define FFTW(x) fftw_##x
65 typedef double fft5d_rtype;
66 #define FFT5D_EPS __DBL_EPSILON__
67 #define FFT5D_MPI_RTYPE MPI_DOUBLE
68 #endif
70 struct fft5d_time_t {
71 double fft,local,mpi1,mpi2;
73 typedef struct fft5d_time_t *fft5d_time;
75 typedef enum fft5d_flags_t {
76 FFT5D_ORDER_YZ=1,
77 FFT5D_BACKWARD=2,
78 FFT5D_REALCOMPLEX=4,
79 FFT5D_DEBUG=8,
80 FFT5D_NOMEASURE=16,
81 FFT5D_INPLACE=32,
82 FFT5D_NOMALLOC=64
83 } fft5d_flags;
85 struct fft5d_plan_t {
86 fft5d_type *lin;
87 fft5d_type *lout;
88 gmx_fft_t p1d[3]; /*1D plans*/
89 #ifdef GMX_FFT_FFTW3
90 FFTW(plan) p2d; /*2D plan: used for 1D decomposition if FFT supports transposed output*/
91 FFTW(plan) p3d; /*3D plan: used for 0D decomposition if FFT supports transposed output*/
92 #ifdef FFT5D_MPI_TRANSPOSE
93 FFTW(plan) mpip[2];
94 #endif
95 #endif
96 MPI_Comm cart[2];
98 int N[3],M[3],K[3]; /*local length in transposed coordinate system (if not divisisable max)*/
99 int pN[3],pM[3], pK[3]; /*local length - not max but length for this processor*/
100 int oM[3],oK[3]; /*offset for current processor*/
101 int *iNin[3],*oNin[3],*iNout[3],*oNout[3]; /*size for each processor (if divisisable=max) for out(=split)
102 and in (=join) and offsets in transposed coordinate system*/
103 int C[3],rC[3]; /*global length (of the one global axes) */
104 /* C!=rC for real<->complex. then C=rC/2 but with potential padding*/
105 int P[2]; /*size of processor grid*/
106 /* int fftorder;*/
107 /* int direction;*/
108 /* int realcomplex;*/
109 int flags;
110 /*int N0,N1,M0,M1,K0,K1;*/
111 int NG,MG,KG;
112 /*int P[2];*/
113 int coor[2];
116 typedef struct fft5d_plan_t *fft5d_plan;
118 void fft5d_execute(fft5d_plan plan,fft5d_time times);
119 fft5d_plan fft5d_plan_3d(int N, int M, int K, MPI_Comm comm[2], int flags, fft5d_type** lin, fft5d_type** lin2);
120 void fft5d_local_size(fft5d_plan plan,int* N1,int* M0,int* K0,int* K1,int** coor);
121 void fft5d_destroy(fft5d_plan plan);
122 fft5d_plan fft5d_plan_3d_cart(int N, int M, int K, MPI_Comm comm, int P0, int flags, fft5d_type** lin, fft5d_type** lin2);
123 void fft5d_compare_data(const fft5d_type* lin, const fft5d_type* in, fft5d_plan plan, int bothLocal, int normarlize);
124 #endif /*FFTLIB_H_*/