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