Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fft.h
Go to the documentation of this file.
1 
14 #ifndef FFT_INCLUDED
15 #define FFT_INCLUDED
16 
17 #ifdef USE_FFTWLIB
18 
19 #ifdef USE_MPI
20 #include <fftw3-mpi.h>
22 #else
23 #include <fftw3.h>
24 #endif
25 
26 #ifdef USE_OPENMP
28 #endif
29 
30 #include "Field/field.h"
31 #include "Field/index_lex.h"
32 #include "Parameters/parameters.h"
34 
35 #include "IO/bridgeIO.h"
36 using Bridge::vout;
37 
38 #ifdef USE_FACTORY
39 #include "factory.h"
40 #endif
41 
42 
44 
50 class FFT
51 {
52  public:
53  enum Direction
54  {
55  FORWARD = FFTW_FORWARD,
56  BACKWARD = FFTW_BACKWARD,
57  UNDEF
58  };
59 
60  public:
61  FFT()
62  : m_vl(CommonParameters::Vlevel())
63  {}
64 
65  virtual ~FFT() {}
66 
67  private:
68  // non-copyable
69  FFT(const FFT&);
70  FFT& operator=(const FFT&);
71 
72  public:
73  virtual void fft(Field& field) = 0; // field is overwritten
74  virtual void fft(Field& field_out, const Field& field_in) = 0;
75  virtual void fft(Field& field_out, const Field& field_in, const Direction dir) = 0;
76 
77  virtual void set_parameters(const Parameters& params)
78  {
79  // if (params.is_empty()) return;
80 
81  std::string vlevel;
82 
83  if (params.fetch_string("verbose_level", vlevel)) {
84  set_parameter_verboselevel(Bridge::BridgeIO::set_verbose_level(vlevel));
85  }
86  }
87 
88  virtual void set_parameters(const std::string& str_fft_direction) {}
89  virtual void set_parameter_verboselevel(const Bridge::VerboseLevel vl) { m_vl = vl; }
90 
91  protected:
93 
94 #ifdef USE_FACTORY
95  public:
96  typedef FFT *(*ProductCreator)();
98 
99  static FFT *New(const IdentifierType& subtype)
100  {
101  ProductCreator p = Factory::Find(subtype);
102 
103  return p ? (*p)() : 0;
104  }
105 
106 #ifdef USE_FACTORY_AUTOREGISTER
107 #else
108  static bool init_factory();
109 #endif
110 #endif
111 };
112 //- #endif of #ifdef USE_FFTWLIB
113 #endif
114 #endif
BridgeIO vout
Definition: bridgeIO.cpp:503
Container of Field-type object.
Definition: field.h:45
Class for parameters.
Definition: parameters.h:46
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Common parameter class: provides parameters as singleton.
Bridge::VerboseLevel vl
VerboseLevel
Definition: bridgeIO.h:42
Direction
Definition: bridge_defs.h:24
std::string IdentifierType
Factory template class.
Definition: factory.h:39
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131