Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Header file for the wrapper around FFTW library
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIB_UTILIITIES_FFT_NEKFFTW_H
37 #define NEKTAR_LIB_UTILIITIES_FFT_NEKFFTW_H
38 
40 
46 
47 #include <fftw3.h>
48 
49 namespace Nektar
50 {
51  template <typename Dim, typename DataType>
52  class Array;
53 
54  namespace LibUtilities
55  {
56  class NekFFTW;
57 
58  // A shared pointer to the NekFFTW object
59  typedef boost::shared_ptr<NekFFTW> NekFFTWSharedPtr;
60 
61  class NekFFTW: public NektarFFT
62  {
63  public:
64 
65  /// Creates an instance of this class
66  static NektarFFTSharedPtr create(int N)
67  {
69  }
70 
71  /// Name of class
72  static std::string className;
73 
74  // constructor (initialisation of the FFTW planes and fill up the m_FFTW_w vector)
75  NekFFTW(int N);
76 
77  // Distructor
78  virtual ~NekFFTW();
79 
80 
81 
82  virtual void v_FFTFwdTrans(Array<OneD,NekDouble> &inarray, Array<OneD,NekDouble> &outarray);
83 
84  virtual void v_FFTBwdTrans(Array<OneD,NekDouble> &inarray, Array<OneD,NekDouble> &outarray);
85 
86 
87 
88  protected:
89 
90  Array<OneD,NekDouble> m_FFTW_w; // weights to convert arrays form Nektar++ to FFTW format
91  Array<OneD,NekDouble> m_FFTW_w_inv; // weights to convert arrays from FFTW to Nektar++ format
92 
95 
96  Array<OneD,NekDouble> m_wsp; // Workspace area for transforms
97 
98  fftw_plan plan_backward; // plan to execute a backward FFT in FFTW
99  fftw_plan plan_forward; // plan to execute a forward FFT in FFTW
100  /**
101  * Reshuffling routines to put the coefficients in Nektar++/FFTW format.
102  * The routines take as an input the number of points N, the vector of coeffcients
103  * and the vector containing the weights of the numerical integration.
104  * The routines modify directly the coef vector.
105  */
107 
109 
110 
111 
112  private:
113  };
114 
115  }//end namespace LibUtilities
116 }//end of namespace Nektar
117 #endif //NEKTAR_LIB_UTILIITIES_FFT_NEKFFTW_H
Array< OneD, NekDouble > coef
Definition: NekFFTW.h:94
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Array< OneD, NekDouble > m_FFTW_w_inv
Definition: NekFFTW.h:91
boost::shared_ptr< NekFFTW > NekFFTWSharedPtr
Definition: NekFFTW.h:56
Array< OneD, NekDouble > phys
Definition: NekFFTW.h:93
Array< OneD, NekDouble > m_FFTW_w
Definition: NekFFTW.h:90
virtual void v_FFTFwdTrans(Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NekFFTW.cpp:83
static NektarFFTSharedPtr create(int N)
Creates an instance of this class.
Definition: NekFFTW.h:66
virtual void v_FFTBwdTrans(Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NekFFTW.cpp:97
Array< OneD, NekDouble > m_wsp
Definition: NekFFTW.h:96
void Reshuffle_FFTW2Nek(Array< OneD, NekDouble > &coef)
Definition: NekFFTW.cpp:111
void Reshuffle_Nek2FFTW(Array< OneD, NekDouble > &coef)
Definition: NekFFTW.cpp:130
static std::string className
Name of class.
Definition: NekFFTW.h:72
boost::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:56