CARMA C++
FftwRealToRealPlan.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_UTIL_FFTWREALTOREALPLAN_H
11 #define CARMA_UTIL_FFTWREALTOREALPLAN_H
12 
14 
15 #include <fftw3.h>
16 
17 #include <vector>
18 #include <map>
19 #include <string>
20 
21 namespace carma {
22 
23 namespace util {
24 
25  typedef
26  std::vector< double, carma::util::FftwAllocator< double > > FftwRealVector;
27 
43  public:
44 
51  enum Kind { // Supported plan kinds
52  REAL_TO_HALFCOMPLEX,
53  HALFCOMPLEX_TO_REAL
54  };
55 
68  enum Rigor { // Supported plan creation rigors.
69  ESTIMATE, // Estimate the best plan via heuristics
70  MEASURE, // Determine best plan by measuring several ffts
71  PATIENT, // Same as measure, but tests more algorithms
72  EXHAUSTIVE // Same as patient, but tests even more algorithms
73  };
74 
75  typedef ::std::map< enum Rigor, ::std::string > RigorEnumMap;
76 
77  static RigorEnumMap rigors(); // Convenience for looping & debug
78 
103  explicit FftwRealToRealPlan( FftwRealVector::size_type size,
104  FftwRealVector & data,
105  enum Kind transformKind,
106  enum Rigor minimumRigor = MEASURE );
107 
113  FftwRealToRealPlan( const FftwRealToRealPlan & from );
114 
119 
125  void execute( );
126 
130  FftwRealVector::size_type getSize( ) const;
131 
135  enum Kind getKind( ) const;
136 
151  static void importWisdom( const ::std::string & filename );
152 
160  static void exportWisdom( const ::std::string & filename );
161 
168  static void forgetWisdom();
169 
170  private:
171 
172  const FftwRealVector::size_type size_;
173  const FftwRealVector::value_type * data0_; // For realloc checks
174  const Kind kind_;
175  const Rigor rigor_;
176  FftwRealVector & data_;
177  ::fftw_plan plan_;
178  };
179 } // namespace util
180 } // namespace carma
181 #endif
182 
void execute()
Execute transform for this plan.
FftwRealToRealPlan(FftwRealVector::size_type size, FftwRealVector &data, enum Kind transformKind, enum Rigor minimumRigor=MEASURE)
Create an FftwRealToRealPlan.
Kind
Fftw supports many different kinds of real-to-real transforms, these are the ones supported by this w...
Template definition for FftwAllocator class.
FftwRealVector::size_type getSize() const
Retrieve size.
static void forgetWisdom()
Forget all wisdom.
static void exportWisdom(const ::std::string &filename)
Export wisdom to the given file.
Rigor
Fftw has several options for creating plans which substantially impact creation time but can also hav...
C++ wrapper of real-to-real half-complex fftw_plans.
static void importWisdom(const ::std::string &filename)
Import Fftw wisdom from the given file.
enum Kind getKind() const
Retrieve kind.