Bridge++  Ver. 2.0.2
fft_3d_parallel1d.h
Go to the documentation of this file.
1 
13 #ifndef FFT_3D_PARALLEL1D_INCLUDED
14 #define FFT_3D_PARALLEL1D_INCLUDED
15 
16 // requires FFTW library
17 #ifdef USE_FFTWLIB
18 
19 // requires MPI
20 #ifdef USE_MPI
21 
22 #include <fftw3-mpi.h>
23 
24 #include "fft.h"
26 
27 class FFT_3d_parallel1d : public FFT
28 {
29  public:
30  static const std::string class_name;
31 
32  public:
33  FFT_3d_parallel1d();
34  FFT_3d_parallel1d(const Parameters& params);
35  virtual ~FFT_3d_parallel1d();
36 
37  void fft(Field& dst, const Field& src, enum Direction dir);
38  void fft(Field& dst, const Field& src);
39  void fft(Field& field);
40 
41  void set_parameters(const Parameters& params);
42  void set_parameters(const std::string& direction);
43 
44  void get_parameters(Parameters& params) const;
45 
46  private:
47 
48  void initialize();
49  void finalize();
50 
51  bool check_ok();
52 
53  void initialize_plan(const Field& src);
54  void clear_plan();
55 
57 
58  // size info
59  int m_ndim;
60  ptrdiff_t m_nsize[4]; // assume atmost 4dimensional
61  ptrdiff_t m_vol;
62  ptrdiff_t m_nv; // number of complex elements
63 
64  fftw_complex *m_buf_in;
65  fftw_complex *m_buf_out;
66  fftw_plan m_plan_fw;
67  fftw_plan m_plan_bw;
68 
69  MPI_Comm m_comm;
70 
71  Direction m_direction;
72 
73 
74 #ifdef USE_FACTORY
75  private:
76  static FFT *create_object()
77  {
78  return new FFT_3d_parallel1d();
79  }
80 
81  static FFT *create_object_with_params(const Parameters& params)
82  {
83  return new FFT_3d_parallel1d(params);
84  }
85 
86  public:
87  static bool register_factory()
88  {
89  bool init = true;
90  init &= FFT::Factory::Register("FFT_3d_parallel_1dim", create_object);
91  init &= FFT::Factory_params::Register("FFT_3d_parallel_1dim", create_object_with_params);
92  return init;
93  }
94 #endif
95 };
96 
97 #endif /* USE_MPI */
98 #endif /* USE_FFTWLIB */
99 
100 #endif /* FFT_3D_PARALLEL1D_INCLUDED */
Parameters
Class for parameters.
Definition: parameters.h:46
Direction
Direction
Definition: bridge_defs.h:24
communicator_mpi.h
fft.h
Field
Container of Field-type object.
Definition: field.h:46
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42