fft.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2016-2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fft
29 
30 Description
31  Fast fourier transform using the fftw library.
32 
33  The complex transform field is returned in the field supplied. The
34  direction of transform is supplied as an argument (-1 = forward, 1 =
35  reverse). The dimensionality and organisation of the array of values
36  in space is supplied in the nn indexing array.
37 
38 Note
39  The fftw library uses int only (no longs) for its dimensionality.
40 
41 SourceFiles
42  fft.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef fft_H
47 #define fft_H
48 
49 #include "complexFields.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 class fft
57 {
58 
59 public:
60 
62  {
63  FORWARD_TRANSFORM = -1,
65  };
66 
67  static void fftRenumberRecurse
68  (
69  List<complex>& data,
70  List<complex>& renumData,
71  const UList<int>& nn,
72  label nnprod,
73  label ii,
74  label l1,
75  label l2
76  );
77 
78  //- fftRenumber: fold the n-d data array to get the fft components in
79  //- the right places.
80  static void fftRenumber(List<complex>& data, const UList<int>& nn);
81 
82  //- Transform real-value data
83  // - uses the fftw real to half-complex method
84  // - result size is field.size()/2 + 1
86 
87 
88  //- Transform real-value data
89  // - uses the fftw real to half-complex method
90  // - result size is field.size()/2 + 1
92 
93 
94  //- Transform complex-value data
95  static void transform
96  (
98  const UList<int>& nn,
99  transformDirection fftDirection
100  );
101 
102 
104  (
105  const tmp<complexField>& field,
106  const UList<int>& nn
107  );
108 
109 
111  (
112  const tmp<complexField>& field,
113  const UList<int>& nn
114  );
115 
116 
118  (
120  const UList<int>& nn
121  );
122 
123 
125  (
127  const UList<int>& nn
128  );
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
rDeltaTY field()
static tmp< complexField > reverseTransform(const tmp< complexField > &field, const UList< int > &nn)
Definition: fft.C:252
Fast fourier transform using the fftw library.
Definition: fft.H:51
Specialisations of Field<T> for complex and complexVector.
static void fftRenumber(List< complex > &data, const UList< int > &nn)
fftRenumber: fold the n-d data array to get the fft components in the right places.
Definition: fft.C:87
transformDirection
Definition: fft.H:56
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
static tmp< complexField > forwardTransform(const tmp< complexField > &field, const UList< int > &nn)
Definition: fft.C:236
The sign +1 = FFTW_BACKWARD.
Definition: fft.H:59
static tmp< complexField > realTransform1D(const scalarField &field)
Transform real-value data.
Definition: fft.C:113
The sign -1 = FFTW_FORWARD.
Definition: fft.H:58
static void fftRenumberRecurse(List< complex > &data, List< complex > &renumData, const UList< int > &nn, label nnprod, label ii, label l1, label l2)
Definition: fft.C:28
A class for managing temporary objects.
Definition: HashPtrTable.H:50
static void transform(complexField &field, const UList< int > &nn, transformDirection fftDirection)
Transform complex-value data.
Definition: fft.C:172
Namespace for OpenFOAM.