30#pragma GCC system_header
47template <
typename _inputT,
typename _outputT,
size_t _rank,
int _cudaGPU = 0>
51std::vector<int> fftwDimVec(
int szX,
int szY,
int szZ );
76template <
typename _inputT,
typename _outputT,
size_t _rank>
77class fftT<_inputT, _outputT, _rank, 0>
81 typedef _inputT inputT;
82 typedef _outputT outputT;
84 static const size_t rank = _rank;
90 typedef Eigen::Array<inputT, -1, -1> eigenArrayInT;
92 typedef Eigen::Array<outputT, -1, -1> eigenArrayOutT;
110 template <
int crank = _rank>
114 bool inPlace =
false,
116 typename std::enable_if<crank == 1>::type * = 0 );
119 template <
int crank = _rank>
124 bool inPlace =
false,
126 typename std::enable_if<crank == 2>::type * = 0 );
129 template <
int crank = _rank>
135 bool inPlace =
false,
137 typename std::enable_if<crank == 3>::type * = 0 );
159 template <
int crank = _rank>
163 bool inPlace =
false,
165 typename std::enable_if<crank == 1>::type * = 0 );
168 template <
int crank = _rank>
173 bool inPlace =
false,
175 typename std::enable_if<crank == 2>::type * = 0 );
178 template <
int crank = _rank>
184 bool inPlace =
false,
186 typename std::enable_if<crank == 3>::type * = 0 );
195 eigenArrayInT &in )
const;
198template <
typename inputT,
typename outputT,
size_t rank>
199fftT<inputT, outputT, rank, 0>::fftT()
203template <
typename inputT,
typename outputT,
size_t rank>
205fftT<inputT, outputT, rank, 0>::fftT(
int nx,
ft::dir ndir,
bool inPlace,
typename std::enable_if<crank == 1>::type * )
209 plan( nx, ndir, inPlace );
212template <
typename inputT,
typename outputT,
size_t rank>
214fftT<inputT, outputT, rank, 0>::fftT(
215 int nx,
int ny,
ft::dir ndir,
bool inPlace,
typename std::enable_if<crank == 2>::type * )
219 plan( nx, ny, ndir, inPlace );
222template <
typename inputT,
typename outputT,
size_t rank>
224fftT<inputT, outputT, rank, 0>::fftT(
225 int nx,
int ny,
int nz,
ft::dir ndir,
bool inPlace,
typename std::enable_if<crank == 3>::type * )
229 plan( nx, ny, nz, ndir, inPlace );
232template <
typename inputT,
typename outputT,
size_t rank>
233fftT<inputT, outputT, rank, 0>::~fftT()
238template <
typename inputT,
typename outputT,
size_t rank>
239void fftT<inputT, outputT, rank, 0>::destroyPlan()
253template <
typename inputT,
typename outputT,
size_t rank>
254ft::dir fftT<inputT, outputT, rank, 0>::direction()
259template <
typename inputT,
typename outputT,
size_t rank>
260void fftT<inputT, outputT, rank, 0>::doPlan(
bool inPlace )
263 inputT *forplan1 =
nullptr;
264 outputT *forplan2 =
nullptr;
278 sz = m_szX * m_szY * m_szZ;
285 forplan2 =
reinterpret_cast<outputT *
>(forplan1);
292 int pdir = FFTW_FORWARD;
295 pdir = FFTW_BACKWARD;
299 #ifndef MX_FFTW_NOOMP
310 #ifndef MX_FFTW_NOOMP
315 if( forplan2 !=
nullptr &&
reinterpret_cast<char *
>(forplan2) !=
reinterpret_cast<char *
>(forplan1) )
320 if( forplan1 !=
nullptr )
326template <
typename inputT,
typename outputT,
size_t rank>
328void fftT<inputT, outputT, rank, 0>::plan(
int nx,
331 typename std::enable_if<crank == 1>::type * )
333 if( m_szX == nx && m_direction == ndir && m_plan )
349template <
typename inputT,
typename outputT,
size_t rank>
351void fftT<inputT, outputT, rank, 0>::plan(
352 int nx,
int ny,
ft::dir ndir,
bool inPlace,
typename std::enable_if<crank == 2>::type * )
354 if( m_szX == nx && m_szY == ny && m_direction == ndir && m_plan )
370template <
typename inputT,
typename outputT,
size_t rank>
372void fftT<inputT, outputT, rank, 0>::plan(
373 int nx,
int ny,
int nz,
ft::dir ndir,
bool inPlace,
typename std::enable_if<crank == 3>::type * )
375 if( m_szX == nx && m_szY == ny && m_szZ == nz && m_direction == ndir && m_plan )
391template <
typename inputT,
typename outputT,
size_t rank>
392void fftT<inputT, outputT, rank, 0>::operator()( outputT *out, inputT *in )
const
397template <
typename inputT,
typename outputT,
size_t rank>
398void fftT<inputT, outputT, rank, 0>::operator()( eigenArrayOutT &out, eigenArrayInT &in )
const
404std::vector<int> fftwDimVec<1>(
int szX,
int szY,
int szZ );
407std::vector<int> fftwDimVec<2>(
int szX,
int szY,
int szZ );
410std::vector<int> fftwDimVec<3>(
int szX,
int szY,
int szZ );
419 #include "fftTcuda.hpp"
Declares and defines templatized wrappers for the fftw library.
realT * fftw_malloc(size_t n)
Call to fftw_malloc, with type cast.
void fftw_free(realT *p)
Call to fftw_free.
void fftw_destroy_plan(typename fftwPlanSpec< realT >::planT plan)
Destroy the given plan.
void fftw_execute_dft(typename fftwTypeSpec< inputDataT, outputDataT >::planT plan, inputDataT *in, outputDataT *out)
Execute the given plan on the given arrays.
fftwTypeSpec< inputDataT, outputDataT >::planT fftw_plan_dft(std::vector< int > n, inputDataT *in, outputDataT *out, int sign, unsigned flags)
Wrapper for the fftwX_plan_dft functions.
dir
Directions of the Fourier Transform.
@ backward
Specifies the backward transform.
@ forward
Specifies the forward transform.
fftwX_plan planT
Specializations typedef planT as fftwf_plan, fftw_plan, fftwl_plan, or fftwq_plan.
std::complex< realT > complexT
The complex data type.
_realT realT
The real data type (_realT is actually defined in specializations).
Declares and defines a true-false virtual type used for boolean template overrides.