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