Bridge++  Ver. 2.0.2
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  virtual ~FFT() {}
63 
64  private:
65  // non-copyable
66  FFT(const FFT&);
67  FFT& operator=(const FFT&);
68 
69  public:
70  virtual void fft(Field& field) = 0; // field is overwritten
71  virtual void fft(Field& field_out, const Field& field_in) = 0;
72  virtual void fft(Field& field_out, const Field& field_in, const Direction dir) = 0;
73 
74  virtual void set_parameters(const std::string& str_fft_direction) {}
75 
76 
77 #ifdef USE_FACTORY
78  public:
79  typedef FFT *(*ProductCreator)();
80  typedef FFT *(*ProductCreator_params)(const Parameters&);
81 
83  typedef FactoryTemplate<FFT, ProductCreator_params> Factory_params;
84 
85  static FFT *New(const IdentifierType& subtype)
86  {
87  ProductCreator p = Factory::Find(subtype);
88  return p ? (*p)() : 0;
89  }
90 
91  static FFT *New(const IdentifierType& subtype, const Parameters& params)
92  {
93  ProductCreator_params p = Factory_params::Find(subtype);
94  return p ? (*p)(params) : 0;
95  }
96 
97 #ifdef USE_FACTORY_AUTOREGISTER
98 #else
99  static bool init_factory();
100 #endif
101 #endif
102 };
103 //- #endif of #ifdef USE_FFTWLIB
104 #endif
105 #endif
bridgeIO.h
factory.h
Parameters
Class for parameters.
Definition: parameters.h:46
Direction
Direction
Definition: bridge_defs.h:24
communicator_mpi.h
threadManager.h
field.h
index_lex.h
parameters.h
FactoryTemplate
Definition: factory.h:42
commonParameters.h
Field
Container of Field-type object.
Definition: field.h:46
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
IdentifierType
std::string IdentifierType
Definition: factory.h:39