SourceXtractorPlusPlus
0.11
Please provide a description of the project.
SEFramework
SEFramework
FFT
FFT.h
Go to the documentation of this file.
1
17
/*
18
* @file SEFramework/FFT/FFT.h
19
* @date 11/09/18
20
* @author Alejandro Alvarez Ayllon
21
*/
22
23
#ifndef _SEFRAMEWORK_FFT_FFT_H
24
#define _SEFRAMEWORK_FFT_FFT_H
25
26
#include <complex>
27
#include <memory>
28
#include <fftw3.h>
29
30
31
namespace
SourceXtractor
{
32
36
template
<
typename
T>
37
struct
FFTTraits
{
38
};
39
43
template
<>
44
struct
FFTTraits
<float> {
45
typedef
fftwf_plan_s
plan_t
;
46
typedef
fftwf_complex
complex_t
;
47
typedef
decltype(fftwf_plan_many_dft_r2c)
func_plan_fwd_t
;
48
typedef
decltype(fftwf_plan_many_dft_c2r)
func_plan_inv_t
;
49
typedef
decltype(fftwf_destroy_plan)
func_destroy_plan_t
;
50
typedef
decltype(fftwf_execute_dft_r2c)
func_execute_fwd_t
;
51
typedef
decltype(fftwf_execute_dft_c2r)
func_execute_inv_t
;
52
53
static
func_plan_fwd_t *
func_plan_fwd
;
54
static
func_plan_inv_t *
func_plan_inv
;
55
static
func_destroy_plan_t *
func_destroy_plan
;
56
static
func_execute_fwd_t *
func_execute_fwd
;
57
static
func_execute_inv_t *
func_execute_inv
;
58
};
59
63
template
<>
64
struct
FFTTraits
<double> {
65
typedef
fftw_plan_s
plan_t
;
66
typedef
fftw_complex
complex_t
;
67
typedef
decltype(fftw_plan_many_dft_r2c)
func_plan_fwd_t
;
68
typedef
decltype(fftw_plan_many_dft_c2r)
func_plan_inv_t
;
69
typedef
decltype(fftw_destroy_plan)
func_destroy_plan_t
;
70
typedef
decltype(fftw_execute_dft_r2c)
func_execute_fwd_t
;
71
typedef
decltype(fftw_execute_dft_c2r)
func_execute_inv_t
;
72
73
static
func_plan_fwd_t *
func_plan_fwd
;
74
static
func_plan_inv_t *
func_plan_inv
;
75
static
func_destroy_plan_t *
func_destroy_plan
;
76
static
func_execute_fwd_t *
func_execute_fwd
;
77
static
func_execute_inv_t *
func_execute_inv
;
78
};
79
86
template
<
typename
T>
87
struct
FFT
{
88
static_assert(
std::is_floating_point<T>::value
,
"FFTTraits only supported for floating point types"
);
89
90
typedef
FFTTraits<T>
fftw_traits
;
91
92
typedef
std::shared_ptr<typename fftw_traits::plan_t>
plan_ptr_t
;
93
typedef
std::complex<T>
complex_t
;
94
112
static
plan_ptr_t
113
createForwardPlan
(
int
howmany,
int
width,
int
height,
std::vector<T>
&in,
std::vector<complex_t>
&out);
114
132
static
plan_ptr_t
133
createInversePlan
(
int
howmany,
int
width,
int
height,
std::vector<complex_t>
&in,
std::vector<T>
&out);
134
144
static
void
executeForward
(
plan_ptr_t
&plan,
std::vector<T>
&in,
std::vector<complex_t>
&out);
145
155
static
void
executeInverse
(
plan_ptr_t
&plan,
std::vector<complex_t>
&in,
std::vector<T>
&out);
156
};
157
170
int
fftRoundDimension
(
int
size);
171
172
}
// end SourceXtractor
173
174
#endif // _SEFRAMEWORK_FFT_FFT_H
SourceXtractor::FFTTraits< float >::func_plan_fwd
static func_plan_fwd_t * func_plan_fwd
Definition:
FFT.h:53
SourceXtractor::fftRoundDimension
int fftRoundDimension(int size)
Definition:
FFT.cpp:49
SourceXtractor::FFT::executeForward
static void executeForward(plan_ptr_t &plan, std::vector< T > &in, std::vector< complex_t > &out)
Definition:
FFT.cpp:244
SourceXtractor::FFT::createInversePlan
static plan_ptr_t createInversePlan(int howmany, int width, int height, std::vector< complex_t > &in, std::vector< T > &out)
Definition:
FFT.cpp:199
std::shared_ptr
STL class.
SourceXtractor::FFTTraits< double >::func_execute_inv_t
decltype(fftw_execute_dft_c2r) typedef func_execute_inv_t
Definition:
FFT.h:71
SourceXtractor::FFTTraits< double >::func_destroy_plan
static func_destroy_plan_t * func_destroy_plan
Definition:
FFT.h:75
SourceXtractor::FFTTraits< double >::func_plan_inv
static func_plan_inv_t * func_plan_inv
Definition:
FFT.h:74
std::vector
STL class.
SourceXtractor::FFTTraits< float >::func_plan_inv_t
decltype(fftwf_plan_many_dft_c2r) typedef func_plan_inv_t
Definition:
FFT.h:48
SourceXtractor::FFTTraits< double >::plan_t
fftw_plan_s plan_t
Definition:
FFT.h:65
SourceXtractor::FFT::fftw_traits
FFTTraits< T > fftw_traits
Definition:
FFT.h:88
SourceXtractor::FFTTraits< double >::func_execute_fwd_t
decltype(fftw_execute_dft_r2c) typedef func_execute_fwd_t
Definition:
FFT.h:70
SourceXtractor::FFTTraits< double >::func_destroy_plan_t
decltype(fftw_destroy_plan) typedef func_destroy_plan_t
Definition:
FFT.h:69
SourceXtractor::FFTTraits< double >::func_plan_fwd_t
decltype(fftw_plan_many_dft_r2c) typedef func_plan_fwd_t
Definition:
FFT.h:67
SourceXtractor::FFTTraits
Wrap FFTW types and functions depending on the primitive type (float or double)
Definition:
FFT.h:37
SourceXtractor::FFTTraits< double >::func_execute_fwd
static func_execute_fwd_t * func_execute_fwd
Definition:
FFT.h:76
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::FFT::plan_ptr_t
std::shared_ptr< typename fftw_traits::plan_t > plan_ptr_t
Definition:
FFT.h:92
SourceXtractor::FFTTraits< float >::func_destroy_plan
static func_destroy_plan_t * func_destroy_plan
Definition:
FFT.h:55
SourceXtractor::FFTTraits< float >::func_plan_inv
static func_plan_inv_t * func_plan_inv
Definition:
FFT.h:54
SourceXtractor::FFTTraits< float >::func_execute_inv_t
decltype(fftwf_execute_dft_c2r) typedef func_execute_inv_t
Definition:
FFT.h:51
SourceXtractor::FFTTraits< float >::func_execute_inv
static func_execute_inv_t * func_execute_inv
Definition:
FFT.h:57
SourceXtractor::FFTTraits< float >::func_execute_fwd_t
decltype(fftwf_execute_dft_r2c) typedef func_execute_fwd_t
Definition:
FFT.h:50
SourceXtractor::FFTTraits< double >::complex_t
fftw_complex complex_t
Definition:
FFT.h:66
SourceXtractor::FFTTraits< float >::complex_t
fftwf_complex complex_t
Definition:
FFT.h:46
SourceXtractor::FFT::createForwardPlan
static plan_ptr_t createForwardPlan(int howmany, int width, int height, std::vector< T > &in, std::vector< complex_t > &out)
Definition:
FFT.cpp:155
SourceXtractor::FFTTraits< double >::func_plan_inv_t
decltype(fftw_plan_many_dft_c2r) typedef func_plan_inv_t
Definition:
FFT.h:68
SourceXtractor::FFTTraits< float >::func_plan_fwd_t
decltype(fftwf_plan_many_dft_r2c) typedef func_plan_fwd_t
Definition:
FFT.h:47
std::is_floating_point
SourceXtractor::FFT::executeInverse
static void executeInverse(plan_ptr_t &plan, std::vector< complex_t > &in, std::vector< T > &out)
Definition:
FFT.cpp:250
SourceXtractor::FFTTraits< float >::plan_t
fftwf_plan_s plan_t
Definition:
FFT.h:45
std::complex
STL class.
SourceXtractor::FFTTraits< float >::func_destroy_plan_t
decltype(fftwf_destroy_plan) typedef func_destroy_plan_t
Definition:
FFT.h:49
SourceXtractor::FFT::complex_t
std::complex< T > complex_t
Definition:
FFT.h:93
SourceXtractor::FFTTraits< double >::func_plan_fwd
static func_plan_fwd_t * func_plan_fwd
Definition:
FFT.h:73
SourceXtractor::FFTTraits< double >::func_execute_inv
static func_execute_inv_t * func_execute_inv
Definition:
FFT.h:77
SourceXtractor::FFT
Wraps the FFTW API with a more C++ like one.
Definition:
FFT.h:87
SourceXtractor::FFTTraits< float >::func_execute_fwd
static func_execute_fwd_t * func_execute_fwd
Definition:
FFT.h:56
Generated by
1.8.18