Redefine the default boolean type to gmx_bool.
[alexxy/gromacs.git] / include / gmx_parallel_3dfft.h
1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
2  *
3  *
4  * Gromacs                               Copyright (c) 1991-2005
5  * David van der Spoel, Erik Lindahl, University of Groningen.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * To help us fund GROMACS development, we humbly ask that you cite
13  * the research papers on the package. Check out http://www.gromacs.org
14  * 
15  * And Hey:
16  * Gnomes, ROck Monsters And Chili Sauce
17  */
18
19 #ifndef _gmx_parallel_3dfft_h_
20 #define _gmx_parallel_3dfft_h_
21
22
23 #include "types/simple.h"
24 #include "types/commrec.h"
25 #include "gmxcomplex.h"
26 #include "gmx_fft.h"
27
28 typedef struct gmx_parallel_3dfft *
29 gmx_parallel_3dfft_t;
30
31
32
33 /*! \brief Initialize parallel MPI-based 3D-FFT.
34  *
35  *  This routine performs real-to-complex and complex-to-real parallel 3D FFTs,
36  *  but not complex-to-complex.
37  *
38  *  The routine is optimized for small-to-medium size FFTs used for PME and
39  *  PPPM algorithms, and do allocate extra workspace whenever it might improve
40  *  performance. 
41  *
42  *  \param pfft_setup     Pointer to parallel 3dfft setup structure, previously
43  *                        allocated or with automatic storage.
44  *  \param ngridx         Global number of grid cells in the x direction. Must be
45  *                        divisible by the number of nodes.
46  *  \param ngridy         Global number of grid cells in the y direction. Must be
47  *                        divisible by the number of nodes.
48  *  \param ngridz         Global number of grid cells in the z direction.
49  *  \param node2slab      Node id to slab index array, can be NULL.
50  *  \param slab2grid_x    Slab index to grid_x array (nnodes+1), can be NULL.
51  *  \param comm           MPI communicator, must have been initialized. 
52  *  \param bReproducible  Try to avoid FFT timing optimizations and other stuff
53  *                        that could make results differ for two runs with
54  *                        identical input (reproducibility for debugging).
55  *    
56  *  \return 0 or a standard error code.
57  */
58 int
59 gmx_parallel_3dfft_init   (gmx_parallel_3dfft_t *    pfft_setup,
60                            ivec                      ndata,
61                                                    real **                   real_data,
62                                                    t_complex **              complex_data,
63                            MPI_Comm                  comm[2],
64                            int *                     slab2index_major,
65                            int *                     slab2index_minor,
66                            gmx_bool                      bReproducible);
67
68
69
70
71
72 /*! \brief Get direct space grid index limits
73  */
74 int
75 gmx_parallel_3dfft_real_limits(gmx_parallel_3dfft_t      pfft_setup,
76                                                            ivec                      local_ndata,
77                                                            ivec                      local_offset,
78                                                            ivec                      local_size);
79
80
81 /*! \brief Get reciprocal space grid index limits
82  */
83 int
84 gmx_parallel_3dfft_complex_limits(gmx_parallel_3dfft_t      pfft_setup,
85                                   ivec                      complex_order,
86                                                                   ivec                      local_ndata,
87                                                                   ivec                      local_offset,
88                                                                   ivec                      local_size);
89
90
91 int
92 gmx_parallel_3dfft_execute(gmx_parallel_3dfft_t    pfft_setup,
93                                                    enum gmx_fft_direction  dir,
94                                                    void *                  in_data,
95                                                    void *                  out_data);
96
97
98 /*! \brief Release all data in parallel fft setup
99  *
100  *  All temporary storage and FFT plans are released. The structure itself
101  *  is not released, but the contents is invalid after this call.
102  *
103  *  \param pfft_setup Parallel 3dfft setup.
104  *
105  *  \return 0 or a standard error code.
106  */
107 int
108 gmx_parallel_3dfft_destroy(gmx_parallel_3dfft_t    pfft_setup);
109
110
111
112
113 #endif /* _gmx_parallel_3dfft_h_ */
114