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  {
65  };
66 
67  static void fftRenumberRecurse
68  (
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 // ************************************************************************* //
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fft::REVERSE_TRANSFORM
The sign +1 = FFTW_BACKWARD.
Definition: fft.H:63
Foam::fft::transformDirection
transformDirection
Definition: fft.H:60
Foam::fft::reverseTransform
static tmp< complexField > reverseTransform(const tmp< complexField > &field, const UList< int > &nn)
Definition: fft.C:259
Foam::Field< scalar >
Foam::fft::FORWARD_TRANSFORM
The sign -1 = FFTW_FORWARD.
Definition: fft.H:62
Foam::fft
Fast fourier transform using the fftw library.
Definition: fft.H:55
field
rDeltaTY field()
Foam::fft::fftRenumber
static void fftRenumber(List< complex > &data, const UList< int > &nn)
Definition: fft.C:94
Foam::fft::fftRenumberRecurse
static void fftRenumberRecurse(List< complex > &data, List< complex > &renumData, const UList< int > &nn, label nnprod, label ii, label l1, label l2)
Definition: fft.C:35
complexFields.H
Specialisations of Field<T> for complex and complexVector.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fft::transform
static void transform(complexField &field, const UList< int > &nn, transformDirection fftDirection)
Transform complex-value data.
Definition: fft.C:179
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::UList
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:103
Foam::fft::forwardTransform
static tmp< complexField > forwardTransform(const tmp< complexField > &field, const UList< int > &nn)
Definition: fft.C:243
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::fft::realTransform1D
static tmp< complexField > realTransform1D(const scalarField &field)
Transform real-value data.
Definition: fft.C:120