HILA
Loading...
Searching...
No Matches
fft.h File Reference
#include "plumbing/defs.h"
#include "datatypes/cmplx.h"
#include "plumbing/coordinates.h"
#include "plumbing/field.h"
#include "plumbing/timing.h"
#include <fftw3.h>
#include "plumbing/fft_fftw_transform.h"
Include dependency graph for fft.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  hila_fft< cmplx_t >
 

Functions

size_t pencil_get_buffer_offsets (const Direction dir, const size_t elements, CoordinateVector &offset, CoordinateVector &nmin)
 
void init_pencil_direction (Direction d)
 Initialize fft direction - defined in fft.cpp.
 
template<typename T >
void FFT_field (const Field< T > &input, Field< T > &result, const CoordinateVector &directions, fft_direction fftdir=fft_direction::forward)
 
template<typename T >
void FFT_field (const Field< T > &input, Field< T > &result, fft_direction fftdir=fft_direction::forward)
 
int FFT_complex_to_real_loc (const CoordinateVector &cv)
 

Function Documentation

◆ FFT_complex_to_real_loc()

int FFT_complex_to_real_loc ( const CoordinateVector cv)
inline

FFT_complex_to_real; Field must be a complex-valued field, result is a real field of the same number type Not optimized, should not be used on a hot path

Because the complex field must have the property f(-x) = f(L-x) = f(x)^*, only half of the values in input field are significant, the routine does the appropriate symmetrization.

Routine FFT_complex_to_real_loc(CoordinateVector cv) gives the significant values at location cv: = +1 significant complex value, = 0 significant real part, imag ignored = -1 value ignored here Example: in 2d 8x8 lattice the sites are: (* = (0,0), value 0)

  • + + + - - - - - - - 0 + + + 0
  • + + + - - - - - - - + + + + +
  • + + + - - - - after centering - - - + + + + + 0 + + + 0 - - - (0,0) to center - - - + + + + +
  • + + + + - - - --------------—> - - - * + + + 0
  • + + + + - - - - - - - + + + -
  • + + + + - - - - - - - + + + -
  • + + + 0 - - - - - - - + + + -

Definition at line 504 of file fft.h.

◆ FFT_field() [1/2]

template<typename T >
void FFT_field ( const Field< T > &  input,
Field< T > &  result,
const CoordinateVector directions,
fft_direction  fftdir = fft_direction::forward 
)
inline

Complex-to-complex FFT transform of a field input, result in result. input and result can be same, "in-place". Both input and output are of type Field<T>, where T must contain complex type, Complex<float> or Complex<double>. directions: if directions[dir] == false (or 0), transform is not done to direction dir. fftdir: direction of the transform itself: fft_direction::forward (default) x -> k fft_direction::inverse k-> x FFT is unnormalized: transform + inverse transform yields source multiplied by the product of the size of the lattice to active directions If all directions are active, result = source * lattice.volume():

Definition at line 376 of file fft.h.

◆ FFT_field() [2/2]

template<typename T >
void FFT_field ( const Field< T > &  input,
Field< T > &  result,
fft_direction  fftdir = fft_direction::forward 
)
inline

Complex-to-complex FFT transform of a field input, result in result. Same as FFT_field(input,result,directions,fftdir) with all directions active.

Definition at line 405 of file fft.h.

◆ init_pencil_direction()

void init_pencil_direction ( Direction  dir)

Initialize fft direction - defined in fft.cpp.

Initialize fft direction - defined in fft.cpp.

Definition at line 61 of file fft.cpp.

◆ pencil_get_buffer_offsets()

size_t pencil_get_buffer_offsets ( const Direction  dir,
const size_t  elements,
CoordinateVector offset,
CoordinateVector nmin 
)

Build offsets to buffer arrays: Fastest Direction = dir, offset 1 next fastest index of complex_t elements in T, offset elem_offset and then other directions, in order Returns element_offset and sets offset and nmin vectors

Definition at line 39 of file fft.cpp.