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 
48 namespace Nektar
49 {
50  template <typename Dim, typename DataType>
51  class Array;
52 
53  namespace LibUtilities
54  {
55  class NekFFTW;
56 
57  // A shared pointer to the NekFFTW object
58  typedef std::shared_ptr<NekFFTW> NekFFTWSharedPtr;
59 
60  class NekFFTW: public NektarFFT
61  {
62  public:
63 
64  /// Creates an instance of this class
65  static NektarFFTSharedPtr create(int N)
66  {
68  }
69 
70  /// Name of class
71  static std::string className;
72 
73  // constructor (initialisation of the FFTW planes and fill up the m_FFTW_w vector)
74  NekFFTW(int N);
75 
76  // Distructor
77  virtual ~NekFFTW();
78 
79 
80 
81  virtual void v_FFTFwdTrans(Array<OneD,NekDouble> &inarray, Array<OneD,NekDouble> &outarray);
82 
83  virtual void v_FFTBwdTrans(Array<OneD,NekDouble> &inarray, Array<OneD,NekDouble> &outarray);
84 
85 
86 
87  protected:
88 
89  Array<OneD,NekDouble> m_FFTW_w; // weights to convert arrays form Nektar++ to FFTW format
90  Array<OneD,NekDouble> m_FFTW_w_inv; // weights to convert arrays from FFTW to Nektar++ format
91 
94 
95  Array<OneD,NekDouble> m_wsp; // Workspace area for transforms
96 
97  fftw_plan plan_backward; // plan to execute a backward FFT in FFTW
98  fftw_plan plan_forward; // plan to execute a forward FFT in FFTW
99  /**
100  * Reshuffling routines to put the coefficients in Nektar++/FFTW format.
101  * The routines take as an input the number of points N, the vector of coeffcients
102  * and the vector containing the weights of the numerical integration.
103  * The routines modify directly the coef vector.
104  */
106 
108 
109 
110 
111  private:
112  };
113 
114  }//end namespace LibUtilities
115 }//end of namespace Nektar
116 #endif //NEKTAR_LIB_UTILIITIES_FFT_NEKFFTW_H
Array< OneD, NekDouble > m_FFTW_w_inv
Definition: NekFFTW.h:90
Array< OneD, NekDouble > m_FFTW_w
Definition: NekFFTW.h:89
Array< OneD, NekDouble > m_wsp
Definition: NekFFTW.h:95
Array< OneD, NekDouble > coef
Definition: NekFFTW.h:93
static NektarFFTSharedPtr create(int N)
Creates an instance of this class.
Definition: NekFFTW.h:65
virtual void v_FFTBwdTrans(Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NekFFTW.cpp:96
Array< OneD, NekDouble > phys
Definition: NekFFTW.h:92
static std::string className
Name of class.
Definition: NekFFTW.h:71
void Reshuffle_Nek2FFTW(Array< OneD, NekDouble > &coef)
Definition: NekFFTW.cpp:129
void Reshuffle_FFTW2Nek(Array< OneD, NekDouble > &coef)
Definition: NekFFTW.cpp:110
virtual void v_FFTFwdTrans(Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NekFFTW.cpp: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:55
std::shared_ptr< NekFFTW > NekFFTWSharedPtr
Definition: NekFFTW.h:55
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1