50 data[l1] = renumData[l2];
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].real(out[0]);
154 result[nBy2].real(out[nBy2]);
155 for (label i = 1; i < nBy2; ++i)
157 result[i].real(out[i]);
158 result[i].imag(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].real();
202 inPtr[i][1] =
field[i].imag();
216 fftw_plan_dft(
rank, nn.
begin(), inPtr, outPtr, dir, FFTW_ESTIMATE);
223 field[i].real(outPtr[i][0]);
224 field[i].imag(outPtr[i][1]);
227 fftw_destroy_plan(plan);
233 if (dir == FORWARD_TRANSFORM)
235 fftRenumber(
field, nn);
244 const tmp<complexField>& tfield,
287 forwardTransform(tfield().
component(cmpt), nn)
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)
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
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.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
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...
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)
::Foam::direction rank(const expressions::valueTypeCode) noexcept
The vector-space rank associated with given valueTypeCode.
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.