Loading...
Searching...
No Matches
BALL::TFFT1D< ComplexTraits > Class Template Reference

`#include <BALL/MATHS/FFT1D.h>`

Inheritance diagram for BALL::TFFT1D< ComplexTraits >:

## Public Types

typedef std::complex< typename ComplexTraits::ComplexPrecision > | Complex
typedef TRegularData1D< std::complex< typename ComplexTraits::ComplexPrecision > > | ComplexVector
Public Types inherited from BALL::TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > >
typedef Position | IndexType
| The IndexType.
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > > | VectorType
| The type containing an STL vector of the corresponding ValueType.
typedef double | CoordinateType
| The coordinate type.
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::iterator | Iterator
| A mutable iterator.
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::const_iterator | ConstIterator
| A constant iterator.
typedef std::complex< ComplexTraits::ComplexPrecision > | value_type
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::iterator | iterator
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::const_iterator | const_iterator
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::reference | reference
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::const_reference | const_reference
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::pointer | pointer
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::difference_type | difference_type
typedef std::vector< std::complex< ComplexTraits::ComplexPrecision > >::size_type | size_type

## Public Member Functions

Constructors and Destructors
| TFFT1D ()
| Default constructor.
| TFFT1D (const TFFT1D &data)
| Copy constructor.
| TFFT1D (Size ldn, double stepPhys=1., double origin=0., bool inFourierSpace=false)
virtual | ~TFFT1D ()
| Destructor.
Assignment
const TFFT1D & | operator= (const TFFT1D &fft1d)
| Assignment operator.
virtual void | clear ()
virtual void | destroy ()
Public Member Functions inherited from BALL::TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > >
| TRegularData1D ()
| Default constructor.
virtual | ~TRegularData1D ()
| Destructor.
TRegularData1D & | operator= (const TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > > &data)
bool | operator== (const TRegularData1D &data) const
| Equality operator.
BALL_INLINE bool | operator!= (const TRegularData1D &data) const
| Inequality operator.
BALL_INLINE bool | empty () const
| Empty predicate.
bool | isInside (const CoordinateType &x) const
| Test whether a point is inside the grid.
BALL_INLINE ConstIterator | begin () const
BALL_INLINE ConstIterator | end () const
BALL_INLINE size_type | size () const
BALL_INLINE size_type | max_size () const
BALL_INLINE void | swap (TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > > &data)
const std::complex< ComplexTraits::ComplexPrecision > & | getData (const IndexType &index) const
const std::complex< ComplexTraits::ComplexPrecision > & | operator[] (const IndexType &index) const
std::complex< ComplexTraits::ComplexPrecision > | operator() (const CoordinateType &x) const
std::complex< ComplexTraits::ComplexPrecision > | getInterpolatedValue (const CoordinateType &x) const
void | getEnclosingIndices (const CoordinateType &x, Position &lower, Position &upper) const
void | getEnclosingValues (const CoordinateType &x, std::complex< ComplexTraits::ComplexPrecision > &lower, std::complex< ComplexTraits::ComplexPrecision > &upper) const
CoordinateType | getCoordinates (const IndexType &index) const
IndexType | getClosestIndex (const CoordinateType &x) const
IndexType | getLowerIndex (const CoordinateType &x) const
const std::complex< ComplexTraits::ComplexPrecision > & | getClosestValue (const CoordinateType &x) const
BALL_INLINE IndexType | getSize () const
| Return the number of points in the data set.
BALL_INLINE const CoordinateType & | getOrigin () const
BALL_INLINE const CoordinateType & | getSpacing () const
BALL_INLINE void | setOrigin (const CoordinateType &origin)
BALL_INLINE const CoordinateType & | getDimension () const
BALL_INLINE void | setDimension (const CoordinateType &dimension)
void | resize (const IndexType &size)
void | rescale (const IndexType &new_size)
std::complex< ComplexTraits::ComplexPrecision > | calculateMean () const
std::complex< ComplexTraits::ComplexPrecision > | calculateSD () const
void | binaryWrite (const String &filename) const
void | binaryRead (const String &filename)

## Predicates

Size | length_
bool | inFourierSpace_
Size | numPhysToFourier_
Size | numFourierToPhys_
double | origin_
double | stepPhys_
double | stepFourier_
double | minPhys_
double | maxPhys_
double | minFourier_
double | maxFourier_
ComplexTraits::FftwPlan | planForward_
ComplexTraits::FftwPlan | planBackward_
Complex * | dataAdress_
bool | planCalculated_
bool | operator== (const TFFT1D &fft1d) const
void | doFFT ()
void | doiFFT ()
bool | translate (double trans_origin)
bool | setPhysStepWidth (double new_width)
double | getPhysStepWidth () const
double | getFourierStepWidth () const
double | getPhysSpaceMin () const
double | getPhysSpaceMax () const
double | getFourierSpaceMin () const
double | getFourierSpaceMax () const
Size | getMaxIndex () const
Size | getNumberOfInverseTransforms () const
double | getGridCoordinates (Position position) const
Complex | getData (const double pos) const
Complex | getInterpolatedValue (const double pos) const
void | setData (double pos, Complex val)
Complex & | operator[] (const double pos)
const Complex & | operator[] (const double pos) const
Complex & | operator[] (const Position &pos)
const Complex & | operator[] (const Position &pos) const
void | setNumberOfFFTTransforms (Size num)
void | setNumberOfiFFTTransforms (Size num)
bool | isInFourierSpace () const
Complex | phase (const double pos) const

## Additional Inherited Members

CoordinateType | origin_
| The origin of the data set.
CoordinateType | dimension_
| The dimension (length).
CoordinateType | spacing_
| The spacing.
VectorType | data_
| The data.

## Detailed Description

template<typename ComplexTraits>
class BALL::TFFT1D< ComplexTraits >

A class to perform Fast Fourier Transforms and inverse Fast Fourier Transforms on regularly spaced one dimensional data.

  This class makes use of the freely available library FFTW, which can be found at http://www.fftw.org coordinate system can be handled automatically. The normaliztion is chosen symmetrically.

Definition at line 37 of file FFT1D.h.

## Member Typedef Documentation

## Complex

template<typename ComplexTraits>

typedef std::complex<typename ComplexTraits::ComplexPrecision> BALL::TFFT1D< ComplexTraits >::Complex

Definition at line 42 of file FFT1D.h.

## ComplexVector

template<typename ComplexTraits>

typedef TRegularData1D<std::complex<typename ComplexTraits::ComplexPrecision> > BALL::TFFT1D< ComplexTraits >::ComplexVector

Definition at line 43 of file FFT1D.h.

## Constructor & Destructor Documentation

## TFFT1D() [1/3]

template<typename ComplexTraits>

BALL::TFFT1D< ComplexTraits >::TFFT1D | ( |  | ) |

Default constructor.

Global assignment operator from FFT2D to TRegularData2D<Complex> Global assignment operator from FFT3D to TRegularData3D<float>. This operator assigns the real part of the complex FFT2D-data to the TRegularData2D<float> to.

Definition at line 285 of file FFT1D.h.

## TFFT1D() [2/3]

template<typename ComplexTraits>

BALL::TFFT1D< ComplexTraits >::TFFT1D | ( | const TFFT1D< ComplexTraits > & | data | ) |

Copy constructor.

## TFFT1D() [3/3]

template<typename ComplexTraits>

BALL::TFFT1D< ComplexTraits >::TFFT1D | ( | Size | ldn,
|  | double | stepPhys = 1.,
|  | double | origin = 0.,
|  | bool | inFourierSpace = false )

Detailed constructor.

Parameters

  ldn | The binary logarithm of the number of grid points (we use the logarithm to ensure that the number of points is a power of two, which is important for the FFT)
  stepPhys | The step width in physical space
  origin | The origin of the coordinate system
  inFourierSpace | Flag to decide whether the data is assumed to be in physical or fourier space

## ~TFFT1D()

template<typename ComplexTraits>

virtual BALL::TFFT1D< ComplexTraits >::~TFFT1D | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## clear()

template<typename ComplexTraits>

virtual void BALL::TFFT1D< ComplexTraits >::clear | ( |  | ) |

virtual

Clear the contents.

Reimplemented from BALL::TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > >.

## destroy()

template<typename ComplexTraits>

virtual void BALL::TFFT1D< ComplexTraits >::destroy | ( |  | ) |

virtual

Clear the contents and reset all attributes.

## doFFT()

template<typename ComplexTraits>

void BALL::TFFT1D< ComplexTraits >::doFFT | ( |  | ) |

Perform a single fast fourier transform on the data.

## doiFFT()

template<typename ComplexTraits>

void BALL::TFFT1D< ComplexTraits >::doiFFT | ( |  | ) |

Perform a single inverse fourier transform on the data.

## getData()

template<typename ComplexTraits>

TFFT1D< ComplexTraits >::Complex BALL::TFFT1D< ComplexTraits >::getData | ( | const double | pos | ) | const

Returns the data at the grid position closest to pos , and automatically includes the correct phase factor and normalization.

Exceptions

  Exception::OutOfGrid | if pos is outside the grid boundaries

Definition at line 460 of file FFT1D.h.

## getFourierSpaceMax()

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::getFourierSpaceMax | ( |  | ) | const

Returns the maximal position of the grid in fourier space.

Definition at line 402 of file FFT1D.h.

## getFourierSpaceMin()

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::getFourierSpaceMin | ( |  | ) | const

Returns the minimal position of the grid in fourier space.

Definition at line 396 of file FFT1D.h.

## getFourierStepWidth()

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::getFourierStepWidth | ( |  | ) | const

Returns the step width in fourier space.

Definition at line 378 of file FFT1D.h.

## getGridCoordinates()

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::getGridCoordinates | ( | Position | position | ) | const

AR: Returns the grid coordinate corresponding to the position.

Definition at line 421 of file FFT1D.h.

## getInterpolatedValue()

template<typename ComplexTraits>

TFFT1D< ComplexTraits >::Complex BALL::TFFT1D< ComplexTraits >::getInterpolatedValue | ( | const double | pos | ) | const

Returns the data at point pos. If pos is not a point on the grid, the data is linearly interpolated. This method automatically includes the correct phase factor and normalization.

Exceptions

  Exception::OutOfGrid | if pos is outside the grid boundaries

Definition at line 483 of file FFT1D.h.

## getMaxIndex()

template<typename ComplexTraits>

Size BALL::TFFT1D< ComplexTraits >::getMaxIndex | ( |  | ) | const

AR: Return the largest grid position direction. This method returns the maximum position allowed in the grid. As the point in the origin has the indices 0, this method returns the number of points minus one.

Definition at line 408 of file FFT1D.h.

## getNumberOfInverseTransforms()

template<typename ComplexTraits>

Size BALL::TFFT1D< ComplexTraits >::getNumberOfInverseTransforms | ( |  | ) | const

AR: Return the number of inverse transforms that have been carried out using this class. This is an important factor for the normalization of the data.

Definition at line 414 of file FFT1D.h.

## getPhysSpaceMax()

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::getPhysSpaceMax | ( |  | ) | const

Returns the maximal position of the grid in physical space.

Definition at line 390 of file FFT1D.h.

## getPhysSpaceMin()

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::getPhysSpaceMin | ( |  | ) | const

Returns the minimal position of the grid in physical space.

Definition at line 384 of file FFT1D.h.

## getPhysStepWidth()

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::getPhysStepWidth | ( |  | ) | const

Returns the step width in physical space.

Definition at line 372 of file FFT1D.h.

## isInFourierSpace()

template<typename ComplexTraits>

bool BALL::TFFT1D< ComplexTraits >::isInFourierSpace | ( |  | ) | const

AR: Returns true if the data is considered to be in Fourier space, false otherwise.

Definition at line 603 of file FFT1D.h.

## operator=()

template<typename ComplexTraits>

const TFFT1D & BALL::TFFT1D< ComplexTraits >::operator= | ( | const TFFT1D< ComplexTraits > & | fft1d | ) |

Assignment operator.

## operator==()

template<typename ComplexTraits>

bool BALL::TFFT1D< ComplexTraits >::operator== | ( | const TFFT1D< ComplexTraits > & | fft1d | ) | const

Equality operator.

Definition at line 296 of file FFT1D.h.

## operator[]() [1/4]

template<typename ComplexTraits>

TFFT1D< ComplexTraits >::Complex & BALL::TFFT1D< ComplexTraits >::operator[] | ( | const double | pos | ) |

Access the data at the grid position closest to pos . This function returns the "raw" data at that position.

Exceptions

  Exception::OutOfGrid | if pos is outside the grid boundaries

Definition at line 538 of file FFT1D.h.

## operator[]() [2/4]

template<typename ComplexTraits>

const TFFT1D< ComplexTraits >::Complex & BALL::TFFT1D< ComplexTraits >::operator[] | ( | const double | pos | ) | const

Access the data at the grid position closest to pos . This function returns the "raw" data at that position.

Exceptions

  Exception::OutOfGrid | if pos is outside the grid boundaries

Definition at line 565 of file FFT1D.h.

## operator[]() [3/4]

template<typename ComplexTraits>

Complex & BALL::TFFT1D< ComplexTraits >::operator[] | ( | const Position & | pos | ) |

inline

Access the (raw) data at Position pos

Exceptions

  Exception::OutOfGrid | if pos is outside the grid boundaries

Definition at line 206 of file FFT1D.h.

## operator[]() [4/4]

template<typename ComplexTraits>

const Complex & BALL::TFFT1D< ComplexTraits >::operator[] | ( | const Position & | pos | ) | const

inline

Access the (raw) data at Position pos. Const method.

Exceptions

  Exception::OutOfGrid | if pos is outside the grid boundaries

Definition at line 215 of file FFT1D.h.

## phase()

template<typename ComplexTraits>

TFFT1D< ComplexTraits >::Complex BALL::TFFT1D< ComplexTraits >::phase | ( | const double | pos | ) | const

Compute the phase factor. This computes the phase factor in fourier space that results if the origin of the coordinate system in physical space is not in the "lower left corner".

Definition at line 592 of file FFT1D.h.

## setData()

template<typename ComplexTraits>

void BALL::TFFT1D< ComplexTraits >::setData | ( | double | pos,
|  | Complex | val )

Sets the data point at the grid position closest to pos to the value val , and – if called in fourier space – automatically includes the correct phase factor and normalization.

Exceptions

  Exception::OutOfGrid | if pos is outside the grid boundaries

Definition at line 516 of file FFT1D.h.

## setNumberOfFFTTransforms()

template<typename ComplexTraits>

void BALL::TFFT1D< ComplexTraits >::setNumberOfFFTTransforms | ( | Size | num | ) |

inline

Definition at line 220 of file FFT1D.h.

## setNumberOfiFFTTransforms()

template<typename ComplexTraits>

void BALL::TFFT1D< ComplexTraits >::setNumberOfiFFTTransforms | ( | Size | num | ) |

inline

Definition at line 225 of file FFT1D.h.

## setPhysStepWidth()

template<typename ComplexTraits>

bool BALL::TFFT1D< ComplexTraits >::setPhysStepWidth | ( | double | new_width | ) |

Set the step width in physical space to newWidth . The step width in fourier space is automatically adjusted accordingly. newWidth must be positive, otherwise the function does nothing and retuns false .

Definition at line 351 of file FFT1D.h.

## translate()

template<typename ComplexTraits>

bool BALL::TFFT1D< ComplexTraits >::translate | ( | double | trans_origin | ) |

Translate the origin in physical space about transOrigin . If the result is out of bounds, the function does nothing and returns false .

Definition at line 330 of file FFT1D.h.

## Member Data Documentation

## dataAdress_

template<typename ComplexTraits>

Complex* BALL::TFFT1D< ComplexTraits >::dataAdress_

protected

Definition at line 260 of file FFT1D.h.

## inFourierSpace_

template<typename ComplexTraits>

bool BALL::TFFT1D< ComplexTraits >::inFourierSpace_

protected

Definition at line 245 of file FFT1D.h.

## length_

template<typename ComplexTraits>

Size BALL::TFFT1D< ComplexTraits >::length_

protected

Definition at line 244 of file FFT1D.h.

## maxFourier_

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::maxFourier_

protected

Definition at line 254 of file FFT1D.h.

## maxPhys_

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::maxPhys_

protected

Definition at line 252 of file FFT1D.h.

## minFourier_

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::minFourier_

protected

Definition at line 253 of file FFT1D.h.

## minPhys_

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::minPhys_

protected

Definition at line 251 of file FFT1D.h.

## numFourierToPhys_

template<typename ComplexTraits>

Size BALL::TFFT1D< ComplexTraits >::numFourierToPhys_

protected

Definition at line 247 of file FFT1D.h.

## numPhysToFourier_

template<typename ComplexTraits>

Size BALL::TFFT1D< ComplexTraits >::numPhysToFourier_

protected

Definition at line 246 of file FFT1D.h.

## origin_

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::origin_

protected

Definition at line 248 of file FFT1D.h.

## planBackward_

template<typename ComplexTraits>

ComplexTraits::FftwPlan BALL::TFFT1D< ComplexTraits >::planBackward_

protected

Definition at line 257 of file FFT1D.h.

## planCalculated_

template<typename ComplexTraits>

bool BALL::TFFT1D< ComplexTraits >::planCalculated_

protected

Definition at line 261 of file FFT1D.h.

## planForward_

template<typename ComplexTraits>

ComplexTraits::FftwPlan BALL::TFFT1D< ComplexTraits >::planForward_

protected

Definition at line 256 of file FFT1D.h.

## stepFourier_

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::stepFourier_

protected

Definition at line 250 of file FFT1D.h.

## stepPhys_

template<typename ComplexTraits>

double BALL::TFFT1D< ComplexTraits >::stepPhys_

protected

Definition at line 249 of file FFT1D.h.