Line data Source code
1 : /*----------------------------------------------------------------------------*/
2 : /* CP2K: A general program to perform molecular dynamics simulations */
3 : /* Copyright 2000-2026 CP2K developers group <https://cp2k.org> */
4 : /* */
5 : /* SPDX-License-Identifier: BSD-3-Clause */
6 : /*----------------------------------------------------------------------------*/
7 :
8 : #include "fft_api_F.h"
9 : #include "fft_lib.h"
10 : #include "fft_timer.h"
11 :
12 : #include "../base/cp_assert.h"
13 : #include <stdio.h>
14 : #include <string.h>
15 :
16 : /*******************************************************************************
17 : * \brief Fortran interface for fft_library_init.
18 : *
19 : * \param backend_F Fortran-side FFT backend selector.
20 : * \param fftw_plan FFTW planning mode.
21 : * \param use_guru_interface Whether the FFTW guru interface may be used.
22 : * \param wisdom_file Path to the FFTW wisdom file.
23 : * \author Frederick Stein
24 : ******************************************************************************/
25 11939 : int fft_library_init_F(const int backend_F, const int fftw_plan,
26 : const bool use_guru_interface, const char *wisdom_file) {
27 11939 : fft_lib backend;
28 11939 : switch (backend_F) {
29 : case FFT_LIBRARY_BACKEND_DEFAULT:
30 : backend = FFT_LIB_DEFAULT;
31 : break;
32 58 : case FFT_LIBRARY_BACKEND_FFTW:
33 58 : backend = FFT_LIB_FFTW;
34 58 : break;
35 2 : case FFT_LIBRARY_BACKEND_GPU:
36 2 : backend = FFT_LIB_GPU;
37 2 : break;
38 : default:
39 : return 1;
40 : }
41 11939 : fftw_plan_type plan_type;
42 11939 : switch (fftw_plan) {
43 : case FFT_LIBRARY_FFTW_MODE_ESTIMATE:
44 : plan_type = FFT_ESTIMATE;
45 : break;
46 2 : case FFT_LIBRARY_FFTW_MODE_MEASURE:
47 2 : plan_type = FFT_MEASURE;
48 2 : break;
49 4 : case FFT_LIBRARY_FFTW_MODE_PATIENT:
50 4 : plan_type = FFT_PATIENT;
51 4 : break;
52 4 : case FFT_LIBRARY_FFTW_MODE_EXHAUSTIVE:
53 4 : plan_type = FFT_EXHAUSTIVE;
54 4 : break;
55 : default:
56 : return 1;
57 : }
58 11939 : return fft_init_lib(backend, plan_type, use_guru_interface, wisdom_file);
59 : }
60 :
61 : /*******************************************************************************
62 : * \brief Fortran interface for fft_library_finalize.
63 : *
64 : * \param wisdom_file Path to the FFTW wisdom file.
65 : * \author Frederick Stein
66 : ******************************************************************************/
67 11725 : void fft_library_finalize_F(const char *wisdom_file) {
68 11725 : fft_finalize_lib(wisdom_file);
69 11725 : fft_finalize_timer();
70 11725 : }
71 :
72 : /*******************************************************************************
73 : * \brief Fortran interface for fft_print_timing_report.
74 : *
75 : * \param threshold Minimum relative timing value to report.
76 : * \param fortran_comm Fortran MPI communicator handle.
77 : * \author Frederick Stein
78 : ******************************************************************************/
79 0 : void fft_print_timing_report_F(const double threshold, const int fortran_comm) {
80 0 : fft_print_timing_report(threshold, cp_mpi_comm_f2c(fortran_comm));
81 0 : }
82 :
83 : /*******************************************************************************
84 : * \brief Fortran interface for fft_print_timing_report_unit.
85 : *
86 : * \param threshold Minimum relative timing value to report.
87 : * \param print_func Callback used to write the timing report.
88 : * \param output_unit Fortran output unit for the timing report.
89 : * \param fortran_comm Fortran MPI communicator handle.
90 : * \author Frederick Stein
91 : ******************************************************************************/
92 11420 : void fft_print_timing_report_unit_F(const double threshold,
93 : fft_print_func_t print_func,
94 : const int output_unit,
95 : const int fortran_comm) {
96 11420 : fft_print_timing_report_unit(threshold, print_func, output_unit,
97 11420 : cp_mpi_comm_f2c(fortran_comm));
98 11420 : }
99 :
100 : /*******************************************************************************
101 : * \brief Allocate buffer of type double.
102 : * \param length Number of elements.
103 : * \param buffer Buffer pointer.
104 : * \author Frederick Stein
105 : ******************************************************************************/
106 0 : void fft_allocate_double_F(const int length, double **buffer) {
107 0 : fft_allocate_double(length, buffer);
108 0 : }
109 :
110 : /*******************************************************************************
111 : * \brief Allocate buffer of type double complex.
112 : * \param length Number of elements.
113 : * \param buffer Buffer pointer.
114 : * \author Frederick Stein
115 : ******************************************************************************/
116 227730 : void fft_allocate_complex_F(const int length, double complex **buffer) {
117 227730 : fft_allocate_complex(length, buffer);
118 227730 : }
119 :
120 : /*******************************************************************************
121 : * \brief Allocate buffer of type double.
122 : * \param buffer Buffer pointer.
123 : * \author Frederick Stein
124 : ******************************************************************************/
125 0 : void fft_free_double_F(double *buffer) { fft_free_double(buffer); }
126 :
127 : /*******************************************************************************
128 : * \brief Allocate buffer of type double complex.
129 : * \param buffer Buffer pointer.
130 : * \author Frederick Stein
131 : ******************************************************************************/
132 227730 : void fft_free_complex_F(double complex *buffer) { fft_free_complex(buffer); }
133 :
134 : /*******************************************************************************
135 : * \brief Fortran interface for fft_backend_in_use.
136 : *
137 : * \author Frederick Stein
138 : ******************************************************************************/
139 11915 : int fft_backend_in_use_F() {
140 11915 : switch (fft_lib_backend_in_use()) {
141 : case FFT_LIB_FFTW:
142 : return FFT_LIBRARY_BACKEND_FFTW;
143 0 : case FFT_LIB_GPU:
144 0 : return FFT_LIBRARY_BACKEND_GPU;
145 0 : default:
146 0 : return FFT_LIBRARY_BACKEND_DEFAULT;
147 : }
148 : }
149 :
150 : /*******************************************************************************
151 : * \brief Fortran interface for fft_has_guru_interface.
152 : *
153 : * \author Frederick Stein
154 : ******************************************************************************/
155 11915 : bool fft_has_guru_interface_F() { return fft_lib_has_guru_interface(); }
156 :
157 : /*******************************************************************************
158 : * \brief Fortran interface for fft_register_1d_local.
159 : *
160 : * \param dir FFT direction: true for forward, false for backward.
161 : * \param fft_size Size of the transform in each dimension.
162 : * \param number_of_ffts Number of independent transforms (batch size).
163 : * \param transpose_in Whether the input has the transposed layout.
164 : * \param transpose_out Whether the output has the transposed layout.
165 : * \param leading_dimension_in Leading dimension of the input buffer.
166 : * \param leading_dimension_out Leading dimension of the output buffer.
167 : * \param grid_in Input grid buffer.
168 : * \param grid_out Output grid buffer.
169 : * \author Frederick Stein
170 : ******************************************************************************/
171 343584 : void fft_register_1d_local_F(const bool dir, const int fft_size,
172 : const int number_of_ffts, const bool transpose_in,
173 : const bool transpose_out,
174 : const int leading_dimension_in,
175 : const int leading_dimension_out,
176 : double complex *grid_in,
177 : double complex *grid_out) {
178 343584 : fft_register_1d_local(dir, fft_size, number_of_ffts, transpose_in,
179 : transpose_out, leading_dimension_in,
180 : leading_dimension_out, grid_in, grid_out);
181 343584 : }
182 :
183 : /*******************************************************************************
184 : * \brief Fortran interface for fft_register_2d_local.
185 : *
186 : * \param dir FFT direction: true for forward, false for backward.
187 : * \param fft_size Size of the transform in each dimension.
188 : * \param number_of_ffts Number of independent transforms (batch size).
189 : * \param transpose_in Whether the input has the transposed layout.
190 : * \param transpose_out Whether the output has the transposed layout.
191 : * \param grid_in Input grid buffer.
192 : * \param grid_out Output grid buffer.
193 : * \author Frederick Stein
194 : ******************************************************************************/
195 71960 : void fft_register_2d_local_F(const bool dir, const int fft_size[2],
196 : const int number_of_ffts, const bool transpose_in,
197 : const bool transpose_out, double complex *grid_in,
198 : double complex *grid_out) {
199 71960 : fft_register_2d_local(dir, (const int[]){fft_size[1], fft_size[0]},
200 : number_of_ffts, transpose_in, transpose_out, grid_in,
201 : grid_out);
202 71960 : }
203 :
204 : /*******************************************************************************
205 : * \brief Fortran interface for fft_register_3d_local.
206 : *
207 : * \param dir FFT direction: true for forward, false for backward.
208 : * \param fft_size Size of the transform in each dimension.
209 : * \param number_of_ffts Number of independent transforms (batch size).
210 : * \param transpose_in Whether the input has the transposed layout.
211 : * \param transpose_out Whether the output has the transposed layout.
212 : * \param grid_in Input grid buffer.
213 : * \param grid_out Output grid buffer.
214 : * \author Frederick Stein
215 : ******************************************************************************/
216 8518 : void fft_register_3d_local_F(const bool dir, const int fft_size[3],
217 : const int number_of_ffts, const bool transpose_in,
218 : const bool transpose_out, double complex *grid_in,
219 : double complex *grid_out) {
220 8518 : fft_register_3d_local(
221 8518 : dir, (const int[]){fft_size[2], fft_size[1], fft_size[0]}, number_of_ffts,
222 : transpose_in, transpose_out, grid_in, grid_out);
223 8518 : }
224 :
225 : /*******************************************************************************
226 : * \brief Fortran interface for fft_register_1d_local_inplace.
227 : *
228 : * \param dir FFT direction: true for forward, false for backward.
229 : * \param fft_size Size of the transform in each dimension.
230 : * \param number_of_ffts Number of independent transforms (batch size).
231 : * \param transpose Whether the in-place buffer has the transposed layout.
232 : * \param leading_dimension Leading dimension of the in-place buffer.
233 : * \param grid In-place grid buffer.
234 : * \author Frederick Stein
235 : ******************************************************************************/
236 8 : void fft_register_1d_local_inplace_F(const bool dir, const int fft_size,
237 : const int number_of_ffts,
238 : const bool transpose,
239 : const int leading_dimension,
240 : double complex *grid) {
241 8 : fft_register_1d_local(dir, fft_size, number_of_ffts, transpose, transpose,
242 : leading_dimension, leading_dimension, grid, grid);
243 8 : }
244 :
245 : /*******************************************************************************
246 : * \brief Fortran interface for fft_register_2d_local_inplace.
247 : *
248 : * \param dir FFT direction: true for forward, false for backward.
249 : * \param fft_size Size of the transform in each dimension.
250 : * \param number_of_ffts Number of independent transforms (batch size).
251 : * \param transpose Whether the in-place buffer has the transposed layout.
252 : * \param grid In-place grid buffer.
253 : * \author Frederick Stein
254 : ******************************************************************************/
255 8 : void fft_register_2d_local_inplace_F(const bool dir, const int fft_size[2],
256 : const int number_of_ffts,
257 : const bool transpose,
258 : double complex *grid) {
259 8 : fft_register_2d_local(dir, (const int[]){fft_size[1], fft_size[0]},
260 : number_of_ffts, transpose, transpose, grid, grid);
261 8 : }
262 :
263 : /*******************************************************************************
264 : * \brief Fortran interface for fft_register_3d_local_inplace.
265 : *
266 : * \param dir FFT direction: true for forward, false for backward.
267 : * \param fft_size Size of the transform in each dimension.
268 : * \param number_of_ffts Number of independent transforms (batch size).
269 : * \param transpose Whether the in-place buffer has the transposed layout.
270 : * \param grid In-place grid buffer.
271 : * \author Frederick Stein
272 : ******************************************************************************/
273 8518 : void fft_register_3d_local_inplace_F(const bool dir, const int fft_size[3],
274 : const int number_of_ffts,
275 : const bool transpose,
276 : double complex *grid) {
277 8518 : fft_register_3d_local(dir,
278 8518 : (const int[]){fft_size[2], fft_size[1], fft_size[0]},
279 : number_of_ffts, transpose, transpose, grid, grid);
280 8518 : }
281 :
282 : /*******************************************************************************
283 : * \brief Fortran interface for fft_1d_local.
284 : *
285 : * \param dir FFT direction: true for forward, false for backward.
286 : * \param fft_size Size of the transform in each dimension.
287 : * \param number_of_ffts Number of independent transforms (batch size).
288 : * \param transpose_in Whether the input has the transposed layout.
289 : * \param transpose_out Whether the output has the transposed layout.
290 : * \param leading_dimension_in Leading dimension of the input buffer.
291 : * \param leading_dimension_out Leading dimension of the output buffer.
292 : * \param grid_in Input grid buffer.
293 : * \param grid_out Output grid buffer.
294 : * \author Frederick Stein
295 : ******************************************************************************/
296 14403039 : void fft_1d_local_F(const bool dir, const int fft_size,
297 : const int number_of_ffts, const bool transpose_in,
298 : const bool transpose_out, const int leading_dimension_in,
299 : const int leading_dimension_out, double complex *grid_in,
300 : double complex *grid_out) {
301 14403039 : fft_1d_local(dir, fft_size, number_of_ffts, transpose_in, transpose_out,
302 : leading_dimension_in, leading_dimension_out, grid_in, grid_out);
303 14403039 : }
304 :
305 : /*******************************************************************************
306 : * \brief Fortran interface for fft_2d_local.
307 : *
308 : * \param dir FFT direction: true for forward, false for backward.
309 : * \param fft_size Size of the transform in each dimension.
310 : * \param number_of_ffts Number of independent transforms (batch size).
311 : * \param transpose_in Whether the input has the transposed layout.
312 : * \param transpose_out Whether the output has the transposed layout.
313 : * \param grid_in Input grid buffer.
314 : * \param grid_out Output grid buffer.
315 : * \author Frederick Stein
316 : ******************************************************************************/
317 3746294 : void fft_2d_local_F(const bool dir, const int fft_size[2],
318 : const int number_of_ffts, const bool transpose_in,
319 : const bool transpose_out, double complex *grid_in,
320 : double complex *grid_out) {
321 3746294 : fft_2d_local(dir, (const int[]){fft_size[1], fft_size[0]}, number_of_ffts,
322 : transpose_in, transpose_out, grid_in, grid_out);
323 3746294 : }
324 :
325 : /*******************************************************************************
326 : * \brief Fortran interface for fft_3d_local.
327 : *
328 : * \param dir FFT direction: true for forward, false for backward.
329 : * \param fft_size Size of the transform in each dimension.
330 : * \param number_of_ffts Number of independent transforms (batch size).
331 : * \param transpose_in Whether the input has the transposed layout.
332 : * \param transpose_out Whether the output has the transposed layout.
333 : * \param grid_in Input grid buffer.
334 : * \param grid_out Output grid buffer.
335 : * \author Frederick Stein
336 : ******************************************************************************/
337 2651 : void fft_3d_local_F(const bool dir, const int fft_size[3],
338 : const int number_of_ffts, const bool transpose_in,
339 : const bool transpose_out, double complex *grid_in,
340 : double complex *grid_out) {
341 2651 : fft_3d_local(dir, (const int[]){fft_size[2], fft_size[1], fft_size[0]},
342 : number_of_ffts, transpose_in, transpose_out, grid_in, grid_out);
343 2651 : }
344 :
345 : /*******************************************************************************
346 : * \brief Fortran interface for fft_1d_local_inplace.
347 : *
348 : * \param dir FFT direction: true for forward, false for backward.
349 : * \param fft_size Size of the transform in each dimension.
350 : * \param number_of_ffts Number of independent transforms (batch size).
351 : * \param transpose Whether the in-place buffer has the transposed layout.
352 : * \param leading_dimension Leading dimension of the in-place buffer.
353 : * \param grid In-place grid buffer.
354 : * \author Frederick Stein
355 : ******************************************************************************/
356 8 : void fft_1d_local_inplace_F(const bool dir, const int fft_size,
357 : const int number_of_ffts, const bool transpose,
358 : const int leading_dimension, double complex *grid) {
359 8 : fft_1d_local(dir, fft_size, number_of_ffts, transpose, transpose,
360 : leading_dimension, leading_dimension, grid, grid);
361 8 : }
362 :
363 : /*******************************************************************************
364 : * \brief Fortran interface for fft_2d_local_inplace.
365 : *
366 : * \param dir FFT direction: true for forward, false for backward.
367 : * \param fft_size Size of the transform in each dimension.
368 : * \param number_of_ffts Number of independent transforms (batch size).
369 : * \param transpose Whether the in-place buffer has the transposed layout.
370 : * \param grid In-place grid buffer.
371 : * \author Frederick Stein
372 : ******************************************************************************/
373 8 : void fft_2d_local_inplace_F(const bool dir, const int fft_size[2],
374 : const int number_of_ffts, const bool transpose,
375 : double complex *grid) {
376 8 : fft_2d_local(dir, (const int[]){fft_size[1], fft_size[0]}, number_of_ffts,
377 : transpose, transpose, grid, grid);
378 8 : }
379 :
380 : /*******************************************************************************
381 : * \brief Fortran interface for fft_3d_local_inplace.
382 : *
383 : * \param dir FFT direction: true for forward, false for backward.
384 : * \param fft_size Size of the transform in each dimension.
385 : * \param number_of_ffts Number of independent transforms (batch size).
386 : * \param transpose Whether the in-place buffer has the transposed layout.
387 : * \param grid In-place grid buffer.
388 : * \author Frederick Stein
389 : ******************************************************************************/
390 658068 : void fft_3d_local_inplace_F(const bool dir, const int fft_size[3],
391 : const int number_of_ffts, const bool transpose,
392 : double complex *grid) {
393 658068 : fft_3d_local(dir, (const int[]){fft_size[2], fft_size[1], fft_size[0]},
394 : number_of_ffts, transpose, transpose, grid, grid);
395 658068 : }
396 :
397 : /*******************************************************************************
398 : * \brief Fortran interface for fft_register_1d_r2c_local.
399 : *
400 : * \param fft_size Size of the transform in each dimension.
401 : * \param number_of_ffts Number of independent transforms (batch size).
402 : * \param transpose_in Whether the input has the transposed layout.
403 : * \param transpose_out Whether the output has the transposed layout.
404 : * \param leading_dimension_in Leading dimension of the input buffer.
405 : * \param leading_dimension_out Leading dimension of the output buffer.
406 : * \param grid_in Input grid buffer.
407 : * \param grid_out Output grid buffer.
408 : * \author Frederick Stein
409 : ******************************************************************************/
410 0 : void fft_register_1d_r2c_local_F(const int fft_size, const int number_of_ffts,
411 : const bool transpose_in,
412 : const bool transpose_out,
413 : const int leading_dimension_in,
414 : const int leading_dimension_out,
415 : double *grid_in, double complex *grid_out) {
416 0 : fft_register_1d_r2c_local(fft_size, number_of_ffts, transpose_in,
417 : transpose_out, leading_dimension_in,
418 : leading_dimension_out, grid_in, grid_out);
419 0 : }
420 :
421 : /*******************************************************************************
422 : * \brief Fortran interface for fft_register_1d_c2r_local.
423 : *
424 : * \param fft_size Size of the transform in each dimension.
425 : * \param number_of_ffts Number of independent transforms (batch size).
426 : * \param transpose_in Whether the input has the transposed layout.
427 : * \param transpose_out Whether the output has the transposed layout.
428 : * \param leading_dimension_in Leading dimension of the input buffer.
429 : * \param leading_dimension_out Leading dimension of the output buffer.
430 : * \param grid_in Input grid buffer.
431 : * \param grid_out Output grid buffer.
432 : * \author Frederick Stein
433 : ******************************************************************************/
434 0 : void fft_register_1d_c2r_local_F(const int fft_size, const int number_of_ffts,
435 : const bool transpose_in,
436 : const bool transpose_out,
437 : const int leading_dimension_in,
438 : const int leading_dimension_out,
439 : double complex *grid_in, double *grid_out) {
440 0 : fft_register_1d_c2r_local(fft_size, number_of_ffts, transpose_in,
441 : transpose_out, leading_dimension_in,
442 : leading_dimension_out, grid_in, grid_out);
443 0 : }
444 :
445 : /*******************************************************************************
446 : * \brief Fortran interface for fft_register_2d_r2c_local.
447 : *
448 : * \param fft_size Size of the transform in each dimension.
449 : * \param number_of_ffts Number of independent transforms (batch size).
450 : * \param transpose_in Whether the input has the transposed layout.
451 : * \param transpose_out Whether the output has the transposed layout.
452 : * \param grid_in Input grid buffer.
453 : * \param grid_out Output grid buffer.
454 : * \author Frederick Stein
455 : ******************************************************************************/
456 0 : void fft_register_2d_r2c_local_F(const int fft_size[2],
457 : const int number_of_ffts,
458 : const bool transpose_in,
459 : const bool transpose_out, double *grid_in,
460 : double complex *grid_out) {
461 0 : fft_register_2d_r2c_local((const int[]){fft_size[1], fft_size[0]},
462 : number_of_ffts, transpose_in, transpose_out,
463 : grid_in, grid_out);
464 0 : }
465 :
466 : /*******************************************************************************
467 : * \brief Fortran interface for fft_register_2d_c2r_local.
468 : *
469 : * \param fft_size Size of the transform in each dimension.
470 : * \param number_of_ffts Number of independent transforms (batch size).
471 : * \param transpose_in Whether the input has the transposed layout.
472 : * \param transpose_out Whether the output has the transposed layout.
473 : * \param grid_in Input grid buffer.
474 : * \param grid_out Output grid buffer.
475 : * \author Frederick Stein
476 : ******************************************************************************/
477 0 : void fft_register_2d_c2r_local_F(const int fft_size[2],
478 : const int number_of_ffts,
479 : const bool transpose_in,
480 : const bool transpose_out,
481 : double complex *grid_in, double *grid_out) {
482 0 : fft_register_2d_c2r_local((const int[]){fft_size[1], fft_size[0]},
483 : number_of_ffts, transpose_in, transpose_out,
484 : grid_in, grid_out);
485 0 : }
486 :
487 : /*******************************************************************************
488 : * \brief Fortran interface for fft_register_3d_r2c_local.
489 : *
490 : * \param fft_size Size of the transform in each dimension.
491 : * \param number_of_ffts Number of independent transforms (batch size).
492 : * \param transpose_in Whether the input has the transposed layout.
493 : * \param transpose_out Whether the output has the transposed layout.
494 : * \param grid_in Input grid buffer.
495 : * \param grid_out Output grid buffer.
496 : * \author Frederick Stein
497 : ******************************************************************************/
498 0 : void fft_register_3d_r2c_local_F(const int fft_size[3],
499 : const int number_of_ffts,
500 : const bool transpose_in,
501 : const bool transpose_out, double *grid_in,
502 : double complex *grid_out) {
503 0 : fft_register_3d_r2c_local(
504 0 : (const int[]){fft_size[2], fft_size[1], fft_size[0]}, number_of_ffts,
505 : transpose_in, transpose_out, grid_in, grid_out);
506 0 : }
507 :
508 : /*******************************************************************************
509 : * \brief Fortran interface for fft_register_3d_c2r_local.
510 : *
511 : * \param fft_size Size of the transform in each dimension.
512 : * \param number_of_ffts Number of independent transforms (batch size).
513 : * \param transpose_in Whether the input has the transposed layout.
514 : * \param transpose_out Whether the output has the transposed layout.
515 : * \param grid_in Input grid buffer.
516 : * \param grid_out Output grid buffer.
517 : * \author Frederick Stein
518 : ******************************************************************************/
519 0 : void fft_register_3d_c2r_local_F(const int fft_size[3],
520 : const int number_of_ffts,
521 : const bool transpose_in,
522 : const bool transpose_out,
523 : double complex *grid_in, double *grid_out) {
524 0 : fft_register_3d_c2r_local(
525 0 : (const int[]){fft_size[2], fft_size[1], fft_size[0]}, number_of_ffts,
526 : transpose_in, transpose_out, grid_in, grid_out);
527 0 : }
528 :
529 : /*******************************************************************************
530 : * \brief Fortran interface for fft_1d_r2c_local.
531 : *
532 : * \param fft_size Size of the transform in each dimension.
533 : * \param number_of_ffts Number of independent transforms (batch size).
534 : * \param transpose_in Whether the input has the transposed layout.
535 : * \param transpose_out Whether the output has the transposed layout.
536 : * \param leading_dimension_in Leading dimension of the input buffer.
537 : * \param leading_dimension_out Leading dimension of the output buffer.
538 : * \param grid_in Input grid buffer.
539 : * \param grid_out Output grid buffer.
540 : * \author Frederick Stein
541 : ******************************************************************************/
542 0 : void fft_1d_r2c_local_F(const int fft_size, const int number_of_ffts,
543 : const bool transpose_in, const bool transpose_out,
544 : const int leading_dimension_in,
545 : const int leading_dimension_out, double *grid_in,
546 : double complex *grid_out) {
547 0 : fft_1d_r2c_local(fft_size, number_of_ffts, transpose_in, transpose_out,
548 : leading_dimension_in, leading_dimension_out, grid_in,
549 : grid_out);
550 0 : }
551 :
552 : /*******************************************************************************
553 : * \brief Fortran interface for fft_1d_c2r_local.
554 : *
555 : * \param fft_size Size of the transform in each dimension.
556 : * \param number_of_ffts Number of independent transforms (batch size).
557 : * \param transpose_in Whether the input has the transposed layout.
558 : * \param transpose_out Whether the output has the transposed layout.
559 : * \param leading_dimension_in Leading dimension of the input buffer.
560 : * \param leading_dimension_out Leading dimension of the output buffer.
561 : * \param grid_in Input grid buffer.
562 : * \param grid_out Output grid buffer.
563 : * \author Frederick Stein
564 : ******************************************************************************/
565 0 : void fft_1d_c2r_local_F(const int fft_size, const int number_of_ffts,
566 : const bool transpose_in, const bool transpose_out,
567 : const int leading_dimension_in,
568 : const int leading_dimension_out,
569 : double complex *grid_in, double *grid_out) {
570 0 : fft_1d_c2r_local(fft_size, number_of_ffts, transpose_in, transpose_out,
571 : leading_dimension_in, leading_dimension_out, grid_in,
572 : grid_out);
573 0 : }
574 :
575 : /*******************************************************************************
576 : * \brief Fortran interface for fft_2d_r2c_local.
577 : *
578 : * \param fft_size Size of the transform in each dimension.
579 : * \param number_of_ffts Number of independent transforms (batch size).
580 : * \param transpose_in Whether the input has the transposed layout.
581 : * \param transpose_out Whether the output has the transposed layout.
582 : * \param grid_in Input grid buffer.
583 : * \param grid_out Output grid buffer.
584 : * \author Frederick Stein
585 : ******************************************************************************/
586 0 : void fft_2d_r2c_local_F(const int fft_size[2], const int number_of_ffts,
587 : const bool transpose_in, const bool transpose_out,
588 : double *grid_in, double complex *grid_out) {
589 0 : fft_2d_r2c_local((const int[]){fft_size[1], fft_size[0]}, number_of_ffts,
590 : transpose_in, transpose_out, grid_in, grid_out);
591 0 : }
592 :
593 : /*******************************************************************************
594 : * \brief Fortran interface for fft_2d_c2r_local.
595 : *
596 : * \param fft_size Size of the transform in each dimension.
597 : * \param number_of_ffts Number of independent transforms (batch size).
598 : * \param transpose_in Whether the input has the transposed layout.
599 : * \param transpose_out Whether the output has the transposed layout.
600 : * \param grid_in Input grid buffer.
601 : * \param grid_out Output grid buffer.
602 : * \author Frederick Stein
603 : ******************************************************************************/
604 0 : void fft_2d_c2r_local_F(const int fft_size[2], const int number_of_ffts,
605 : const bool transpose_in, const bool transpose_out,
606 : double complex *grid_in, double *grid_out) {
607 0 : fft_2d_c2r_local((const int[]){fft_size[1], fft_size[0]}, number_of_ffts,
608 : transpose_in, transpose_out, grid_in, grid_out);
609 0 : }
610 :
611 : /*******************************************************************************
612 : * \brief Fortran interface for fft_3d_r2c_local.
613 : *
614 : * \param fft_size Size of the transform in each dimension.
615 : * \param number_of_ffts Number of independent transforms (batch size).
616 : * \param transpose_in Whether the input has the transposed layout.
617 : * \param transpose_out Whether the output has the transposed layout.
618 : * \param grid_in Input grid buffer.
619 : * \param grid_out Output grid buffer.
620 : * \author Frederick Stein
621 : ******************************************************************************/
622 0 : void fft_3d_r2c_local_F(const int fft_size[3], const int number_of_ffts,
623 : const bool transpose_in, const bool transpose_out,
624 : double *grid_in, double complex *grid_out) {
625 0 : fft_3d_r2c_local((const int[]){fft_size[2], fft_size[1], fft_size[0]},
626 : number_of_ffts, transpose_in, transpose_out, grid_in,
627 : grid_out);
628 0 : }
629 :
630 : /*******************************************************************************
631 : * \brief Fortran interface for fft_3d_c2r_local.
632 : *
633 : * \param fft_size Size of the transform in each dimension.
634 : * \param number_of_ffts Number of independent transforms (batch size).
635 : * \param transpose_in Whether the input has the transposed layout.
636 : * \param transpose_out Whether the output has the transposed layout.
637 : * \param grid_in Input grid buffer.
638 : * \param grid_out Output grid buffer.
639 : * \author Frederick Stein
640 : ******************************************************************************/
641 0 : void fft_3d_c2r_local_F(const int fft_size[3], const int number_of_ffts,
642 : const bool transpose_in, const bool transpose_out,
643 : double complex *grid_in, double *grid_out) {
644 0 : fft_3d_c2r_local((const int[]){fft_size[2], fft_size[1], fft_size[0]},
645 : number_of_ffts, transpose_in, transpose_out, grid_in,
646 : grid_out);
647 0 : }
648 :
649 : /*******************************************************************************
650 : * \brief Fortran interface for fft_register_1d_r2c_local_inplace.
651 : *
652 : * \param fft_size Size of the transform in each dimension.
653 : * \param number_of_ffts Number of independent transforms (batch size).
654 : * \param transpose Whether the in-place buffer has the transposed layout.
655 : * \param leading_dimension Leading dimension of the in-place buffer.
656 : * \param grid In-place grid buffer.
657 : * \author Frederick Stein
658 : ******************************************************************************/
659 0 : void fft_register_1d_r2c_local_inplace_F(const int fft_size,
660 : const int number_of_ffts,
661 : const bool transpose,
662 : const int leading_dimension,
663 : double *grid) {
664 0 : fft_register_1d_r2c_local(fft_size, number_of_ffts, transpose, transpose,
665 0 : leading_dimension, leading_dimension / 2, grid,
666 : (double complex *)grid);
667 0 : }
668 :
669 : /*******************************************************************************
670 : * \brief Fortran interface for fft_register_1d_c2r_local_inplace.
671 : *
672 : * \param fft_size Size of the transform in each dimension.
673 : * \param number_of_ffts Number of independent transforms (batch size).
674 : * \param transpose Whether the in-place buffer has the transposed layout.
675 : * \param leading_dimension Leading dimension of the in-place buffer.
676 : * \param grid In-place grid buffer.
677 : * \author Frederick Stein
678 : ******************************************************************************/
679 0 : void fft_register_1d_c2r_local_inplace_F(const int fft_size,
680 : const int number_of_ffts,
681 : const bool transpose,
682 : const int leading_dimension,
683 : double *grid) {
684 0 : fft_register_1d_c2r_local(fft_size, number_of_ffts, transpose, transpose,
685 0 : leading_dimension / 2, leading_dimension,
686 : (double complex *)grid, grid);
687 0 : }
688 :
689 : /*******************************************************************************
690 : * \brief Fortran interface for fft_register_2d_r2c_local_inplace.
691 : *
692 : * \param fft_size Size of the transform in each dimension.
693 : * \param number_of_ffts Number of independent transforms (batch size).
694 : * \param transpose Whether the in-place buffer has the transposed layout.
695 : * \param grid In-place grid buffer.
696 : * \author Frederick Stein
697 : ******************************************************************************/
698 0 : void fft_register_2d_r2c_local_inplace_F(const int fft_size[2],
699 : const int number_of_ffts,
700 : const bool transpose, double *grid) {
701 0 : fft_register_2d_r2c_local((const int[]){fft_size[1], fft_size[0]},
702 : number_of_ffts, transpose, transpose, grid,
703 : (double complex *)grid);
704 0 : }
705 :
706 : /*******************************************************************************
707 : * \brief Fortran interface for fft_register_2d_c2r_local_inplace.
708 : *
709 : * \param fft_size Size of the transform in each dimension.
710 : * \param number_of_ffts Number of independent transforms (batch size).
711 : * \param transpose Whether the in-place buffer has the transposed layout.
712 : * \param grid In-place grid buffer.
713 : * \author Frederick Stein
714 : ******************************************************************************/
715 0 : void fft_register_2d_c2r_local_inplace_F(const int fft_size[2],
716 : const int number_of_ffts,
717 : const bool transpose, double *grid) {
718 0 : fft_register_2d_c2r_local((const int[]){fft_size[1], fft_size[0]},
719 : number_of_ffts, transpose, transpose,
720 : (double complex *)grid, grid);
721 0 : }
722 :
723 : /*******************************************************************************
724 : * \brief Fortran interface for fft_register_3d_r2c_local_inplace.
725 : *
726 : * \param fft_size Size of the transform in each dimension.
727 : * \param number_of_ffts Number of independent transforms (batch size).
728 : * \param transpose Whether the in-place buffer has the transposed layout.
729 : * \param grid In-place grid buffer.
730 : * \author Frederick Stein
731 : ******************************************************************************/
732 0 : void fft_register_3d_r2c_local_inplace_F(const int fft_size[3],
733 : const int number_of_ffts,
734 : const bool transpose, double *grid) {
735 0 : fft_register_3d_r2c_local(
736 0 : (const int[]){fft_size[2], fft_size[1], fft_size[0]}, number_of_ffts,
737 : transpose, transpose, grid, (double complex *)grid);
738 0 : }
739 :
740 : /*******************************************************************************
741 : * \brief Fortran interface for fft_register_3d_c2r_local_inplace.
742 : *
743 : * \param fft_size Size of the transform in each dimension.
744 : * \param number_of_ffts Number of independent transforms (batch size).
745 : * \param transpose Whether the in-place buffer has the transposed layout.
746 : * \param grid In-place grid buffer.
747 : * \author Frederick Stein
748 : ******************************************************************************/
749 0 : void fft_register_3d_c2r_local_inplace_F(const int fft_size[3],
750 : const int number_of_ffts,
751 : const bool transpose, double *grid) {
752 0 : fft_register_3d_c2r_local(
753 0 : (const int[]){fft_size[2], fft_size[1], fft_size[0]}, number_of_ffts,
754 : transpose, transpose, (double complex *)grid, grid);
755 0 : }
756 :
757 : /*******************************************************************************
758 : * \brief Fortran interface for fft_1d_r2c_local_inplace.
759 : *
760 : * \param fft_size Size of the transform in each dimension.
761 : * \param number_of_ffts Number of independent transforms (batch size).
762 : * \param transpose Whether the in-place buffer has the transposed layout.
763 : * \param leading_dimension Leading dimension of the in-place buffer.
764 : * \param grid In-place grid buffer.
765 : * \author Frederick Stein
766 : ******************************************************************************/
767 0 : void fft_1d_r2c_local_inplace_F(const int fft_size, const int number_of_ffts,
768 : const bool transpose,
769 : const int leading_dimension, double *grid) {
770 0 : fft_1d_r2c_local(fft_size, number_of_ffts, transpose, transpose,
771 0 : leading_dimension, leading_dimension / 2, grid,
772 : (double complex *)grid);
773 0 : }
774 :
775 : /*******************************************************************************
776 : * \brief Fortran interface for fft_1d_c2r_local_inplace.
777 : *
778 : * \param fft_size Size of the transform in each dimension.
779 : * \param number_of_ffts Number of independent transforms (batch size).
780 : * \param transpose Whether the in-place buffer has the transposed layout.
781 : * \param leading_dimension Leading dimension of the in-place buffer.
782 : * \param grid In-place grid buffer.
783 : * \author Frederick Stein
784 : ******************************************************************************/
785 0 : void fft_1d_c2r_local_inplace_F(const int fft_size, const int number_of_ffts,
786 : const bool transpose,
787 : const int leading_dimension, double *grid) {
788 0 : fft_1d_c2r_local(fft_size, number_of_ffts, transpose, transpose,
789 0 : leading_dimension / 2, leading_dimension,
790 : (double complex *)grid, grid);
791 0 : }
792 :
793 : /*******************************************************************************
794 : * \brief Fortran interface for fft_2d_r2c_local_inplace.
795 : *
796 : * \param fft_size Size of the transform in each dimension.
797 : * \param number_of_ffts Number of independent transforms (batch size).
798 : * \param transpose Whether the in-place buffer has the transposed layout.
799 : * \param grid In-place grid buffer.
800 : * \author Frederick Stein
801 : ******************************************************************************/
802 0 : void fft_2d_r2c_local_inplace_F(const int fft_size[2], const int number_of_ffts,
803 : const bool transpose, double *grid) {
804 0 : fft_2d_r2c_local((const int[]){fft_size[1], fft_size[0]}, number_of_ffts,
805 : transpose, transpose, grid, (double complex *)grid);
806 0 : }
807 :
808 : /*******************************************************************************
809 : * \brief Fortran interface for fft_2d_c2r_local_inplace.
810 : *
811 : * \param fft_size Size of the transform in each dimension.
812 : * \param number_of_ffts Number of independent transforms (batch size).
813 : * \param transpose Whether the in-place buffer has the transposed layout.
814 : * \param grid In-place grid buffer.
815 : * \author Frederick Stein
816 : ******************************************************************************/
817 0 : void fft_2d_c2r_local_inplace_F(const int fft_size[2], const int number_of_ffts,
818 : const bool transpose, double *grid) {
819 0 : fft_2d_c2r_local((const int[]){fft_size[1], fft_size[0]}, number_of_ffts,
820 : transpose, transpose, (double complex *)grid, grid);
821 0 : }
822 :
823 : /*******************************************************************************
824 : * \brief Fortran interface for fft_3d_r2c_local_inplace.
825 : *
826 : * \param fft_size Size of the transform in each dimension.
827 : * \param number_of_ffts Number of independent transforms (batch size).
828 : * \param transpose Whether the in-place buffer has the transposed layout.
829 : * \param grid In-place grid buffer.
830 : * \author Frederick Stein
831 : ******************************************************************************/
832 0 : void fft_3d_r2c_local_inplace_F(const int fft_size[3], const int number_of_ffts,
833 : const bool transpose, double *grid) {
834 0 : fft_3d_r2c_local((const int[]){fft_size[2], fft_size[1], fft_size[0]},
835 : number_of_ffts, transpose, transpose, grid,
836 : (double complex *)grid);
837 0 : }
838 :
839 : /*******************************************************************************
840 : * \brief Fortran interface for fft_3d_c2r_local_inplace.
841 : *
842 : * \param fft_size Size of the transform in each dimension.
843 : * \param number_of_ffts Number of independent transforms (batch size).
844 : * \param transpose Whether the in-place buffer has the transposed layout.
845 : * \param grid In-place grid buffer.
846 : * \author Frederick Stein
847 : ******************************************************************************/
848 0 : void fft_3d_c2r_local_inplace_F(const int fft_size[3], const int number_of_ffts,
849 : const bool transpose, double *grid) {
850 0 : fft_3d_c2r_local((const int[]){fft_size[2], fft_size[1], fft_size[0]},
851 : number_of_ffts, transpose, transpose, (double complex *)grid,
852 : grid);
853 0 : }
854 :
855 : // EOF
|