50 data[l1] = renumData[l2];
60 for (label i=0; i<nn[ii]; i++)
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)
244 const tmp<complexField>& tfield,
250 transform(tresult.ref(), nn, FORWARD_TRANSFORM);
266 transform(tresult.ref(), nn, REVERSE_TRANSFORM);
284 tresult.ref().replace
287 forwardTransform(tfield().
component(cmpt), nn)
307 tresult.ref().replace
310 reverseTransform(tfield().
component(cmpt), nn)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
iterator begin() noexcept
Return an iterator to begin traversing the UList.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
void size(const label n)
Older name for setAddressableSize.
static constexpr direction nComponents
Number of components in this vector space.
static tmp< complexField > realTransform1D(const scalarField &field)
Transform real-value data.
static tmp< complexField > forwardTransform(const tmp< complexField > &field, const UList< int > &nn)
static void transform(complexField &field, const UList< int > &nn, transformDirection fftDirection)
Transform complex-value data.
@ REVERSE_TRANSFORM
The sign +1 = FFTW_BACKWARD.
@ FORWARD_TRANSFORM
The sign -1 = FFTW_FORWARD.
static tmp< complexField > reverseTransform(const tmp< complexField > &field, const UList< int > &nn)
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 void fftRenumberRecurse(List< complex > &data, List< complex > &renumData, const UList< int > &nn, label nnprod, label ii, label l1, label l2)
A class for managing temporary objects.
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
::Foam::direction rank(const expressions::valueTypeCode) noexcept
The vector-space rank associated with given valueTypeCode.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Field< complex > complexField
Specialisation of Field<T> for complex.
#define forAll(list, i)
Loop across all elements in list.
const Vector< label > N(dict.get< Vector< label > >("N"))