@@ -7,166 +7,150 @@ namespace ModulePW
77template <typename FPTYPE>
88class FFT_BASE
99{
10- public:
10+ public:
11+ FFT_BASE () {};
12+ virtual ~FFT_BASE () {};
1113
12- FFT_BASE (){};
13- virtual ~FFT_BASE (){};
14-
1514 /* *
1615 * @brief Initialize the fft parameters As virtual function.
17- *
16+ *
1817 * The function is used to initialize the fft parameters.
1918 */
20- virtual __attribute__ ((weak))
21- void initfft(int nx_in,
22- int ny_in,
23- int nz_in,
24- int lixy_in,
25- int rixy_in,
26- int ns_in,
27- int nplane_in,
28- int nproc_in,
29- bool gamma_only_in,
30- bool xprime_in = true );
31-
32- virtual __attribute__ ((weak))
33- void initfft(int nx_in,
34- int ny_in,
35- int nz_in);
19+ virtual __attribute__ ((weak)) void initfft(int nx_in,
20+ int ny_in,
21+ int nz_in,
22+ int lixy_in,
23+ int rixy_in,
24+ int ns_in,
25+ int nplane_in,
26+ int nproc_in,
27+ bool gamma_only_in,
28+ bool xprime_in = true );
29+
30+ virtual __attribute__ ((weak)) void initfft(int nx_in, int ny_in, int nz_in);
3631
3732 /* *
3833 * @brief Setup the fft Plan and data As pure virtual function.
39- *
34+ *
4035 * The function is set as pure virtual function.In order to
4136 * override the function in the derived class.In the derived
4237 * class, the function is used to setup the fft Plan and data.
4338 */
44- virtual void setupFFT ()=0;
39+ virtual void setupFFT () = 0;
4540
4641 /* *
4742 * @brief Clean the fft Plan As pure virtual function.
48- *
43+ *
4944 * The function is set as pure virtual function.In order to
5045 * override the function in the derived class.In the derived
5146 * class, the function is used to clean the fft Plan.
5247 */
53- virtual void cleanFFT ()= 0;
54-
48+ virtual void cleanFFT () = 0;
49+
5550 /* *
5651 * @brief Clear the fft data As pure virtual function.
57- *
52+ *
5853 * The function is set as pure virtual function.In order to
5954 * override the function in the derived class.In the derived
6055 * class, the function is used to clear the fft data.
6156 */
62- virtual void clear ()=0;
63-
57+ virtual void clear () = 0;
58+
59+ virtual void resource_handler (const int flag) const {};
6460 /* *
6561 * @brief Get the real space data in cpu-like fft
66- *
62+ *
6763 * The function is used to get the real space data.While the
6864 * FFT_BASE is an abstract class,the function will be override,
69- * The attribute weak is used to avoid define the function.
65+ * The attribute weak is used to avoid define the function.
7066 */
71- virtual __attribute__ ((weak))
72- FPTYPE* get_rspace_data() const ;
67+ virtual __attribute__ ((weak)) FPTYPE* get_rspace_data() const ;
7368
74- virtual __attribute__ ((weak))
75- std::complex<FPTYPE>* get_auxr_data() const ;
69+ virtual __attribute__ ((weak)) std::complex<FPTYPE>* get_auxr_data() const ;
7670
77- virtual __attribute__ ((weak))
78- std::complex<FPTYPE>* get_auxg_data() const ;
71+ virtual __attribute__ ((weak)) std::complex<FPTYPE>* get_auxg_data() const ;
7972
8073 /* *
8174 * @brief Get the auxiliary real space data in 3D
82- *
75+ *
8376 * The function is used to get the auxiliary real space data in 3D.
8477 * While the FFT_BASE is an abstract class,the function will be override,
8578 * The attribute weak is used to avoid define the function.
8679 */
87- virtual __attribute__ ((weak))
88- std::complex<FPTYPE>* get_auxr_3d_data() const ;
80+ virtual __attribute__ ((weak)) std::complex<FPTYPE>* get_auxr_3d_data() const ;
8981
90- // forward fft in x-y direction
82+ // forward fft in x-y direction
9183
9284 /* *
9385 * @brief Forward FFT in x-y direction
9486 * @param in input data
9587 * @param out output data
96- *
88+ *
9789 * This function performs the forward FFT in the x-y direction.
9890 * It involves two axes, x and y. The FFT is applied multiple times
99- * along the left and right boundaries in the primary direction(which is
100- * determined by the xprime flag).Notably, the Y axis operates in
91+ * along the left and right boundaries in the primary direction(which is
92+ * determined by the xprime flag).Notably, the Y axis operates in
10193 * "many-many-FFT" mode.
10294 */
103- virtual __attribute__ ((weak))
104- void fftxyfor(std::complex <FPTYPE>* in,
105- std::complex <FPTYPE>* out) const ;
95+ virtual __attribute__ ((weak)) void fftxyfor(std::complex <FPTYPE>* in,
96+ std::complex <FPTYPE>* out) const ;
10697
107- virtual __attribute__ ((weak))
108- void fftxybac(std::complex <FPTYPE>* in,
109- std::complex <FPTYPE>* out) const ;
98+ virtual __attribute__ ((weak)) void fftxybac(std::complex <FPTYPE>* in,
99+ std::complex <FPTYPE>* out) const ;
110100
111101 /* *
112102 * @brief Forward FFT in z direction
113103 * @param in input data
114104 * @param out output data
115- *
105+ *
116106 * This function performs the forward FFT in the z direction.
117107 * It involves only one axis, z. The FFT is applied only once.
118108 * Notably, the Z axis operates in many FFT with nz*ns.
119109 */
120- virtual __attribute__ ((weak))
121- void fftzfor(std::complex <FPTYPE>* in,
122- std::complex <FPTYPE>* out) const ;
123-
124- virtual __attribute__ ((weak))
125- void fftzbac(std::complex <FPTYPE>* in,
126- std::complex <FPTYPE>* out) const ;
110+ virtual __attribute__ ((weak)) void fftzfor(std::complex <FPTYPE>* in,
111+ std::complex <FPTYPE>* out) const ;
112+
113+ virtual __attribute__ ((weak)) void fftzbac(std::complex <FPTYPE>* in,
114+ std::complex <FPTYPE>* out) const ;
127115
128116 /* *
129117 * @brief Forward FFT in x-y direction with real to complex
130118 * @param in input data, real type
131119 * @param out output data, complex type
132- *
133- * This function performs the forward FFT in the x-y direction
120+ *
121+ * This function performs the forward FFT in the x-y direction
134122 * with real to complex.There is no difference between fftxyfor.
135123 */
136- virtual __attribute__ ((weak))
137- void fftxyr2c(FPTYPE* in,
138- std::complex <FPTYPE>* out) const ;
139-
140- virtual __attribute__ ((weak))
141- void fftxyc2r(std::complex <FPTYPE>* in,
142- FPTYPE* out) const ;
143-
124+ virtual __attribute__ ((weak)) void fftxyr2c(FPTYPE* in,
125+ std::complex <FPTYPE>* out) const ;
126+
127+ virtual __attribute__ ((weak)) void fftxyc2r(std::complex <FPTYPE>* in,
128+ FPTYPE* out) const ;
129+
144130 /* *
145131 * @brief Forward FFT in 3D
146132 * @param in input data
147133 * @param out output data
148- *
134+ *
149135 * This function performs the forward FFT for gpu-like fft.
150136 * It involves three axes, x, y, and z. The FFT is applied multiple times
151137 * for fft3D_forward.
152138 */
153- virtual __attribute__ ((weak))
154- void fft3D_forward(std::complex <FPTYPE>* in,
155- std::complex <FPTYPE>* out) const ;
156-
157- virtual __attribute__ ((weak))
158- void fft3D_backward(std::complex <FPTYPE>* in,
159- std::complex <FPTYPE>* out) const ;
160-
161- protected:
162- int nx=0 ;
163- int ny=0 ;
164- int nz=0 ;
139+ virtual __attribute__ ((weak)) void fft3D_forward(std::complex <FPTYPE>* in,
140+ std::complex <FPTYPE>* out) const ;
141+
142+ virtual __attribute__ ((weak)) void fft3D_backward(std::complex <FPTYPE>* in,
143+ std::complex <FPTYPE>* out) const ;
144+
145+ protected:
146+ int nx = 0 ;
147+ int ny = 0 ;
148+ int nz = 0 ;
165149};
166150
167151template FFT_BASE<float >::FFT_BASE();
168152template FFT_BASE<double >::FFT_BASE();
169153template FFT_BASE<float >::~FFT_BASE ();
170154template FFT_BASE<double >::~FFT_BASE ();
171- }
155+ } // namespace ModulePW
172156#endif // FFT_BASE_H
0 commit comments