Nektar++
NekFFTW.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: NekFFTW.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Header file for the wrapper around FFTW library
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_LIB_UTILIITIES_FFT_NEKFFTW_H
36#define NEKTAR_LIB_UTILIITIES_FFT_NEKFFTW_H
37
39
45
46#include <fftw3.h>
47
48namespace Nektar
49{
50template <typename Dim, typename DataType> class Array;
51
52namespace LibUtilities
53{
54class NekFFTW;
55
56// A shared pointer to the NekFFTW object
57typedef std::shared_ptr<NekFFTW> NekFFTWSharedPtr;
58
59class NekFFTW : public NektarFFT
60{
61public:
62 /// Creates an instance of this class
64 {
66 }
67
68 /// Name of class
69 static std::string className;
70
71 // constructor (initialisation of the FFTW planes and fill up the m_FFTW_w
72 // vector)
73 NekFFTW(int N);
74
75 // Distructor
76 ~NekFFTW() override;
77
78protected:
80 m_FFTW_w; // weights to convert arrays form Nektar++ to FFTW format
82 m_FFTW_w_inv; // weights to convert arrays from FFTW to Nektar++ format
83
86
87 Array<OneD, NekDouble> m_wsp; // Workspace area for transforms
88
89 fftw_plan m_plan_backward; // plan to execute a backward FFT in FFTW
90 fftw_plan m_plan_forward; // plan to execute a forward FFT in FFTW
91 /**
92 * Reshuffling routines to put the coefficients in Nektar++/FFTW format.
93 * The routines take as an input the number of points N, the vector of
94 * coeffcients and the vector containing the weights of the numerical
95 * integration. The routines modify directly the coef vector.
96 */
98
100
102 Array<OneD, NekDouble> &outarray) override;
103
105 Array<OneD, NekDouble> &outarray) override;
106
107private:
108};
109
110} // end namespace LibUtilities
111} // end of namespace Nektar
112#endif // NEKTAR_LIB_UTILIITIES_FFT_NEKFFTW_H
void v_FFTBwdTrans(Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: NekFFTW.cpp:90
Array< OneD, NekDouble > m_coef
Definition: NekFFTW.h:85
Array< OneD, NekDouble > m_phys
Definition: NekFFTW.h:84
static NektarFFTSharedPtr create(int N)
Creates an instance of this class.
Definition: NekFFTW.h:63
static std::string className
Name of class.
Definition: NekFFTW.h:69
void Reshuffle_Nek2FFTW(Array< OneD, NekDouble > &coef)
Definition: NekFFTW.cpp:122
void v_FFTFwdTrans(Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: NekFFTW.cpp:77
void Reshuffle_FFTW2Nek(Array< OneD, NekDouble > &coef)
Definition: NekFFTW.cpp:103
Array< OneD, NekDouble > m_wsp
Definition: NekFFTW.h:87
Array< OneD, NekDouble > m_FFTW_w
Definition: NekFFTW.h:80
Array< OneD, NekDouble > m_FFTW_w_inv
Definition: NekFFTW.h:82
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:58
std::shared_ptr< NekFFTW > NekFFTWSharedPtr
Definition: NekFFTW.h:57