Go to the documentation of this file.00001 #ifndef ATHENA_FFT_H
00002 #define ATHENA_FFT_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "../athena.h"
00026 #include "../defs.h"
00027
00028 #ifdef FFT_ENABLED
00029
00030 #ifndef MPI_PARALLEL
00031
00032 #define FFT_SLAB_DECOMP
00033 #else
00034
00035 #define FFT_BLOCK_DECOMP
00036 #endif
00037
00038 #ifdef FFT_BLOCK_DECOMP
00039
00040 #include "fft_3d.h"
00041 #else
00042
00043 #include "fftw3.h"
00044 #endif
00045
00046 #define ath_fft_data fftw_complex
00047
00048
00049
00050 #define F3DI(i, j, k, nx1, nx2, nx3) ((k) + (nx3)*((j) + (nx2)*(i)))
00051 #define F2DI(i, j, nx1, nx2) ((j) + (nx2)*(i))
00052
00053
00054
00055
00056 #define KCOMP(a, gas, gnxa) ((double)(((a)+(gas))-(int)(2*((a)+(gas))/(gnxa))*(gnxa)))
00057
00058 typedef enum {
00059 ATH_FFT_FORWARD=-1, ATH_FFT_BACKWARD=1
00060 } ath_fft_direction;
00061
00062 struct ath_3d_fft_plan {
00063 #ifdef FFT_BLOCK_DECOMP
00064 struct fft_plan_3d *plan;
00065 #else
00066 fftw_plan plan;
00067 #endif
00068 ath_fft_direction dir;
00069 long int cnt;
00070 long int gcnt;
00071 };
00072
00073 struct ath_2d_fft_plan {
00074 #ifdef FFT_BLOCK_DECOMP
00075 struct fft_plan_2d *plan;
00076 #else
00077 fftw_plan plan;
00078 #endif
00079 ath_fft_direction dir;
00080 long int cnt;
00081 long int gcnt;
00082 };
00083
00084
00085
00086
00087
00088
00089
00090 struct ath_3d_fft_plan *ath_3d_fft_quick_plan(DomainS *pD,
00091 ath_fft_data *data, ath_fft_direction dir);
00092 struct ath_3d_fft_plan *ath_3d_fft_create_plan(int gnx3, int gnx2,
00093 int gnx1, int gks, int gke, int gjs, int gje,
00094 int gis, int gie, ath_fft_data *data, int al,
00095 ath_fft_direction dir);
00096 ath_fft_data *ath_3d_fft_malloc(struct ath_3d_fft_plan *ath_plan);
00097 void ath_3d_fft(struct ath_3d_fft_plan *ath_plan, ath_fft_data *data);
00098 void ath_3d_fft_free(ath_fft_data *data);
00099 void ath_3d_fft_destroy_plan(struct ath_3d_fft_plan *ath_plan);
00100
00101
00102
00103
00104
00105
00106
00107 struct ath_2d_fft_plan *ath_2d_fft_quick_plan(DomainS *pD,
00108 ath_fft_data *data, ath_fft_direction dir);
00109 struct ath_2d_fft_plan *ath_2d_fft_create_plan(int gnx2, int gnx1,
00110 int gjs, int gje, int gis, int gie,
00111 ath_fft_data *data, int al,
00112 ath_fft_direction dir);
00113 ath_fft_data *ath_2d_fft_malloc(struct ath_2d_fft_plan *ath_plan);
00114 void ath_2d_fft(struct ath_2d_fft_plan *ath_plan, ath_fft_data *data);
00115 void ath_2d_fft_free(ath_fft_data *data);
00116 void ath_2d_fft_destroy_plan(struct ath_2d_fft_plan *ath_plan);
00117
00118 #endif
00119
00120 #endif