Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NektarFFT.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File NektarFFT.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 Fast Fourier Transform class in Nektar++
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIB_UTILIITIES_FFT_NEKTARFFT_H
37 #define NEKTAR_LIB_UTILIITIES_FFT_NEKTARFFT_H
38 
42 
43 namespace Nektar
44 {
45  template <typename Dim, typename DataType>
46  class Array;
47 
48  namespace LibUtilities
49  {
50  /**
51  * The NektarFFT class is a virtual class to manage the use of the FFT to do Fwd/Bwd transformations
52  * and convolutions. The function here defined will link to a proper implementation of the FFT algorithm.
53  * Depending on the user definition the functions can link to a class which is a wrapper around the FFTW
54  * library or to a specific FFT implementation.
55  */
56  class NektarFFT;
57 
58  // A shared pointer to the NektarFFT object
59  typedef boost::shared_ptr<NektarFFT> NektarFFTSharedPtr;
60 
61  /// Datatype of the NekFactory used to instantiate classes derived from
62  /// the NektarFFT class.
64 
66 
67  class NektarFFT
68  {
69  public:
70 
71  /// Initialises NektarFFT class members.
73 
74  // Distructor
76 
77  /**
78  * m_N is the dimension of the Fourier transform.
79  * It means that the coefficient vector and the vector of the variable in physical
80  * space have size m_N. It is becasue everything is managed just with real data.
81  */
82  int m_N;
83 
84  /**
85  * Forward transformation to pass from physical to coefficient space using the FFT.
86  * This method will take the place of the Matrix-Vector multiplication
87  * input:
88  * N = number of Fourier points
89  * inarray = vector in physical space (length N)
90  * output:
91  * outarray = vector in coefficient space (length N)
92  */
93  LIB_UTILITIES_EXPORT void FFTFwdTrans(Array<OneD,NekDouble> &phy, Array<OneD,NekDouble> &coef);
94 
95  /**
96  * Backward transformation to pass from coefficient to physical space using the FFT.
97  * This method will take the place of the Matrix-Vector multiplication
98  * input:
99  * N = number of Fourier points
100  * inarrray = vector in coefficient space (length N)
101  * output:
102  * outarray = vector in physical space (length N)
103  */
104  LIB_UTILITIES_EXPORT void FFTBwdTrans(Array<OneD,NekDouble> &coef, Array<OneD,NekDouble> &phys);
105 
106  protected:
107 
108 
109  virtual void v_FFTFwdTrans(Array<OneD,NekDouble> &phys, Array<OneD,NekDouble> &coef);
110 
111  virtual void v_FFTBwdTrans(Array<OneD,NekDouble> &coef, Array<OneD,NekDouble> &phys);
112 
113  private:
114 
115  };
116  }//end namespace LibUtilities
117 }//end of namespace Nektar
118 #endif //NEKTAR_LIB_UTILIITIES_FFT_NEKTARFFT_H