From 209dfec2b4c41d6175642ddf6b90480bb79298e0 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Sun, 7 Jun 2015 10:44:43 +0200 Subject: [PATCH] New adaptor for fftw_complex to C++ complex --- src/fourier/fft/fftw_complex.hpp | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/fourier/fft/fftw_complex.hpp diff --git a/src/fourier/fft/fftw_complex.hpp b/src/fourier/fft/fftw_complex.hpp new file mode 100644 index 0000000..af5d445 --- /dev/null +++ b/src/fourier/fft/fftw_complex.hpp @@ -0,0 +1,42 @@ +#ifndef __COSMOTOOL_FFT_COMPLEX_HPP +#define __COSMOTOOL_FFT_COMPLEX_HPP + +#include +#include + +namespace CosmoTool +{ + template + struct adapt_complex { + }; + + template<> struct adapt_complex { + typedef fftw_complex f_type; + typedef std::complex cpp_complex; + + static inline cpp_complex *adapt(f_type *a) { + return reinterpret_cast(a); + } + }; + + template<> struct adapt_complex { + typedef fftwf_complex f_type; + typedef std::complex cpp_complex; + + static inline cpp_complex *adapt(f_type *a) { + return reinterpret_cast(a); + } + }; + + template<> struct adapt_complex { + typedef fftwl_complex f_type; + typedef std::complex cpp_complex; + + static inline cpp_complex *adapt(f_type *a) { + return reinterpret_cast(a); + } + }; + +} + +#endif \ No newline at end of file