60 for (label i=0; i<nn[ii]; i++)
96 List<complex> renumData(data);
104 label ii(0), l1(0), l2(0);
122 const label
n =
field.size();
123 const label nBy2 =
n/2;
132 for (label i=0; i <
n; ++i)
138 fftw_plan plan = fftw_plan_r2r_1d
151 auto& result = tresult.ref();
153 result[0].Re() = out[0];
154 result[nBy2].Re() = out[nBy2];
155 for (label i = 1; i < nBy2; ++i)
157 result[i].Re() = out[i];
158 result[i].Im() = out[
n - i];
161 fftw_destroy_plan(plan);
182 transformDirection dir
186 const label
N =
field.size();
188 fftw_complex* inPtr =
189 static_cast<fftw_complex*
>(fftw_malloc(
sizeof(fftw_complex)*
N));
190 fftw_complex* outPtr =
191 static_cast<fftw_complex*
>(fftw_malloc(
sizeof(fftw_complex)*
N));
194 if (dir == REVERSE_TRANSFORM)
196 fftRenumber(
field, nn);
201 inPtr[i][0] =
field[i].Re();
202 inPtr[i][1] =
field[i].Im();
214 const label rank = nn.
size();
216 fftw_plan_dft(rank, nn.
begin(), inPtr, outPtr, dir, FFTW_ESTIMATE);
223 field[i].Re() = outPtr[i][0];
224 field[i].Im() = outPtr[i][1];
227 fftw_destroy_plan(plan);
233 if (dir == FORWARD_TRANSFORM)
235 fftRenumber(
field, nn);
244 const tmp<complexField>& tfield,
282 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
287 forwardTransform(tfield().
component(cmpt), nn)
305 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
310 reverseTransform(tfield().
component(cmpt), nn)
void size(const label n)
Older name for setAddressableSize.
static tmp< complexField > reverseTransform(const tmp< complexField > &field, const UList< int > &nn)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
#define forAll(list, i)
Loop across all elements in list.
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.
scalarField Im(const UList< complex > &cf)
Extract imag component.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
scalarField Re(const UList< complex > &cf)
Extract real component.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Database for solution data, solver performance and other reduced data.
static tmp< complexField > forwardTransform(const tmp< complexField > &field, const UList< int > &nn)
const Vector< label > N(dict.get< Vector< label >>("N"))
static tmp< complexField > realTransform1D(const scalarField &field)
Transform real-value data.
void clear()
Clear exponents - resets to be dimensionless.
static void fftRenumberRecurse(List< complex > &data, List< complex > &renumData, const UList< int > &nn, label nnprod, label ii, label l1, label l2)
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
A class for managing temporary objects.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
static void transform(complexField &field, const UList< int > &nn, transformDirection fftDirection)
Transform complex-value data.