1 | #ifndef myfft_h
|
---|
2 | #define myfft_h
|
---|
3 | /** \file myfft.h
|
---|
4 | * Header file for \ref myfft.c
|
---|
5 | *
|
---|
6 | * Contains declarations of the functions implemented in \ref myfft.c and
|
---|
7 | * structures around the fftransformations containg plans fft_plan_3d, plans
|
---|
8 | * on a level LevelPlan and plan_weight.
|
---|
9 | *
|
---|
10 | Project: ParallelCarParrinello
|
---|
11 | Jan Hamaekers
|
---|
12 | 2000
|
---|
13 |
|
---|
14 | File: myfft.h
|
---|
15 | $Id: myfft.h,v 1.15 2006/08/21 09:16:16 foo Exp $
|
---|
16 | */
|
---|
17 |
|
---|
18 | // use double precision fft when we have it
|
---|
19 | #ifdef HAVE_CONFIG_H
|
---|
20 | #include <config.h>
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #ifdef HAVE_DFFTW_H
|
---|
24 | #include "dfftw.h"
|
---|
25 | #else
|
---|
26 | #include "fftw.h"
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #ifdef HAVE_DRFFTW_H
|
---|
30 | #include "drfftw.h"
|
---|
31 | #else
|
---|
32 | #include "rfftw.h"
|
---|
33 | #endif
|
---|
34 |
|
---|
35 |
|
---|
36 | #define fftw_flag FFTW_ESTIMATE //!< flag used when calling fftw routine to create plans
|
---|
37 |
|
---|
38 | struct Problem;
|
---|
39 |
|
---|
40 | /** Plan weight structure
|
---|
41 | * \todo what is plan weight?
|
---|
42 | */
|
---|
43 | struct plan_weight {
|
---|
44 | double weight; //!< the acual weight
|
---|
45 | int Index; //!< ???
|
---|
46 | int PE; //!< resides on which process
|
---|
47 | };
|
---|
48 |
|
---|
49 | /** Structure around the fft plan for one level
|
---|
50 | */
|
---|
51 | struct LevelPlan {
|
---|
52 | int LevelFactor; //!< ratio of level size between maximum level and this level
|
---|
53 | int nyz; //!< mesh points in yz-plane (nx times ny)
|
---|
54 | int local_nyz; //!< mesh points in yz-plane per process (local_nx times local_ny)
|
---|
55 | int nx; //!< mesh points in x direction
|
---|
56 | int local_nx; //!< mesh points in x direction per process (nx/MaxPE)
|
---|
57 | int start_nx; //!< start index for mesh point set of individual process
|
---|
58 | int ny; //!< mesh points in y direction
|
---|
59 | int local_ny; //!< mesh points in y direction per process (ny/MaxPE)
|
---|
60 | int nz; //!< mesh points in z direction (halved plus 1)
|
---|
61 | int LevelBlockSize; //!< cubed plan::LevelSize
|
---|
62 | int SendRecvBlockSize; //!< size of block 'pen' that is sent and received between processes in FFT
|
---|
63 | int PermBlockSize; //!< size of block for permutation (2x2x2 generally)
|
---|
64 | int LocalSizeC; //!< number of complex mesh points (nx times ny times nz)
|
---|
65 | int LocalSizeR; //!< number of complex mesh points (nx times ny times 2*nz-1)
|
---|
66 | int LevelNo; //!< continuous cardinal number of the level
|
---|
67 | int N[NDIM]; //!< number of nodes on the grid for each dimension
|
---|
68 | fftw_plan *xplanCR;
|
---|
69 | fftw_plan *xplanRC;
|
---|
70 | rfftwnd_plan *yzplanCR;
|
---|
71 | rfftwnd_plan *yzplanRC;
|
---|
72 | };
|
---|
73 |
|
---|
74 | /** Internal fftw plan structure.
|
---|
75 | */
|
---|
76 | struct fft_plan_3d {
|
---|
77 | MPI_Comm comm; //!< involved MPI communicator group
|
---|
78 | double E_cut; //!< energy cutoff
|
---|
79 | double GBasisSQ[NDIM]; //!< squared norm of reciprocal basis vectors
|
---|
80 | int MaxPE; //!< Size of group in the communicator
|
---|
81 | int myPE; //!< Rank of process in the communicator
|
---|
82 | int LevelSize; //!< factor of number of mesh points between 0th and MaxLevel's level
|
---|
83 | int Maxpw; //!< maximum number of plan weights
|
---|
84 | int LocalMaxpw; //!< number of plan weights stored on this process
|
---|
85 | int MaxLevel; //!< maximum number of LatticeLevel's
|
---|
86 | int LocalDataSize;
|
---|
87 | int LocalWorkSize;
|
---|
88 | int LevelBlockSize;
|
---|
89 | int *MaxNoOfnFields; //!< Maximum number of NField's per level
|
---|
90 | int **NFields; //!< NField per level per field
|
---|
91 | int N[NDIM]; //!< number of mesh points per dimension
|
---|
92 | int NLSR[NDIM]; //!< ratio of mesh points N over LevelSize
|
---|
93 | int *PENo;
|
---|
94 | int *LevelSizes; //!< factor of mesh points between this and upper level per level
|
---|
95 | int *Lev_CR_RC;
|
---|
96 | struct plan_weight *pw;
|
---|
97 | struct plan_weight *pwFS;
|
---|
98 | struct plan_weight *Localpw;
|
---|
99 | struct LevelPlan *Levplan;
|
---|
100 | fftw_complex *local_data;
|
---|
101 | fftw_complex *work;
|
---|
102 | struct Problem *P; //!< Problem at hand
|
---|
103 | };
|
---|
104 |
|
---|
105 | struct fft_plan_3d *fft_3d_create_plan(struct Problem *P, MPI_Comm comm, const double E_cut, const int MaxLevel, const int *LevelSizes, const double GBasisSQ[NDIM], const int N[NDIM], const int *MaxNoOfnFields, int **NFields);
|
---|
106 | void fft_3d_complex_to_real(const struct fft_plan_3d *plan, const int Level, const int nFields, fftw_complex *local_data, fftw_complex *work); /* local data -> local_data, work destroyed */
|
---|
107 | void fft_3d_real_to_complex(const struct fft_plan_3d *plan, const int Level, const int nFields, fftw_complex *local_data, fftw_complex *work); /* local data -> local_data, work destroyed */
|
---|
108 | void fft_3d_destroy_plan(const struct Problem *P, struct fft_plan_3d *plan);
|
---|
109 | void InitDataTestR(const struct fft_plan_3d *plan, const int Level, const int nFields,fftw_real *local_data);
|
---|
110 | /*void fft_3d_c2r_r2c_Test(struct Problem *P, const struct fft_plan_3d *plan, const int nFields);*/
|
---|
111 | #endif
|
---|