1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Multi-dimensional renumbering used in the Numerical Recipes
26 fft routine. This version is recursive, so works in n-d :
27 determined by the length of array nn
29 \*---------------------------------------------------------------------------*/
31 #include "fftRenumber.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 // recursively evaluate the indexing necessary to do the folding of
41 // the fft data. We recurse until we have the indexing ncessary for
42 // the folding in all directions.
44 void fftRenumberRecurse
47 List<complex>& renumData,
57 // we've worked out the renumbering scheme. Now copy
58 // the components across
60 data[l1] = complex(renumData[l2].Re(),renumData[l2].Im());
64 // do another level of folding. First work out the
65 // multiplicative value of the index
70 for (label i=0; i<nn[ii]; i++)
72 // now evaluate the indices (both from array 1 and to
73 // array 2). These get multiplied by nnprod to (cumulatively)
74 // find the real position in the list corresponding to
75 // this set of indices.
87 // go to the next level of recursion.
104 // fftRenumber : fold the n-d data array to get the fft components in
107 #include "fftRenumber.H"
115 List<complex> renumData(data);
118 for (label i=0; i<nn.size(); i++)
123 label ii(0), l1(0), l2(0);
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // ************************************************************************* //