Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

TFFT1D< ComplexTraits > Class Template Reference
[Fast Fourier Transforms]

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

#include <FFT1D.h>

Inheritance diagram for TFFT1D< ComplexTraits >:

TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > > List of all members.

Public Types

typedef std::complex< typename
ComplexTraits::ComplexPrecision > 
Complex
typedef TRegularData1D< std::complex<
typename ComplexTraits::ComplexPrecision > > 
ComplexVector

Public Member Functions

void doFFT () throw ()
 Perform a single fast fourier transform on the data.
void doiFFT () throw ()
 Perform a single inverse fourier transform on the data.
bool translate (double trans_origin) throw ()
 Translate the origin in physical space about transOrigin .
bool setPhysStepWidth (double new_width) throw ()
 Set the step width in physical space to newWidth .
double getPhysStepWidth () const throw ()
 Returns the step width in physical space.
double getFourierStepWidth () const throw ()
 Returns the step width in fourier space.
double getPhysSpaceMin () const throw ()
 Returns the minimal position of the grid in physical space.
double getPhysSpaceMax () const throw ()
 Returns the maximal position of the grid in physical space.
double getFourierSpaceMin () const throw ()
 Returns the minimal position of the grid in fourier space.
double getFourierSpaceMax () const throw ()
 Returns the maximal position of the grid in fourier space.
Size getMaxIndex () const throw ()
 AR: Return the largest grid position direction.
Size getNumberOfInverseTransforms () const throw ()
 AR: Return the number of inverse transforms that have been carried out using this class.
double getGridCoordinates (Position position) const throw ()
 AR: Returns the grid coordinate corresponding to the position.
Complex getData (const double pos) const throw (Exception::OutOfGrid)
 Returns the data at the grid position closest to pos , and automatically includes the correct phase factor and normalization.
Complex getInterpolatedValue (const double pos) const throw (Exception::OutOfGrid)
 Returns the data at point pos.
void setData (double pos, Complex val) throw (Exception::OutOfGrid)
 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.
Complex & operator[] (const double pos) throw (Exception::OutOfGrid)
 Access the data at the grid position closest to pos .
const Complex & operator[] (const double pos) const throw (Exception::OutOfGrid)
 Access the data at the grid position closest to pos .
Complex & operator[] (const Position &pos) throw (Exception::OutOfGrid)
 AR: Access the (raw) data at Position pos.
const Complex & operator[] (const Position &pos) const throw (Exception::OutOfGrid)
 AR: Access the (raw) data at Position pos.
void setNumberOfFFTTransforms (Size num)
void setNumberOfiFFTTransforms (Size num)
bool isInFourierSpace () const throw ()
 AR: Returns true if the data is considered to be in Fourier space, false otherwise.
Complex phase (const double pos) const throw ()
 Compute the phase factor.
Constructors and Destructors
 throw ()
 Default constructor.
 throw ()
 Copy constructor.
 throw ()
 Detailed constructor.
virtual ~TFFT1D () throw ()
 Destructor.
Assignment
const TFFT1Doperator= (const TFFT1D &fft1d) throw ()
 Assignment operator.
virtual void clear () throw ()
 Clear the contents.
virtual void destroy () throw ()
 Clear the contents and reset all attributes.
Predicates
bool operator== (const TFFT1D &fft1d) const throw ()
 Equality operator.

Protected Attributes

Size length_
bool inFourierSpace_
Size numPhysToFourier_
Size numFourierToPhys_
double origin_
 The origin of the data set.
double stepPhys_
double stepFourier_
double minPhys_
double maxPhys_
double minFourier_
double maxFourier_
ComplexTraits::FftwPlan planForward_
ComplexTraits::FftwPlan planBackward_
Complex * dataAdress_
bool planCalculated_

Detailed Description

template<typename ComplexTraits>
class 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.


Member Function Documentation

template<typename ComplexTraits>
virtual void TFFT1D< ComplexTraits >::clear  )  throw () [virtual]
 

Clear the contents.

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

template<typename ComplexTraits>
virtual void TFFT1D< ComplexTraits >::destroy  )  throw () [virtual]
 

Clear the contents and reset all attributes.

template<typename ComplexTraits>
void TFFT1D< ComplexTraits >::doFFT  )  throw ()
 

Perform a single fast fourier transform on the data.

template<typename ComplexTraits>
void TFFT1D< ComplexTraits >::doiFFT  )  throw ()
 

Perform a single inverse fourier transform on the data.

template<typename ComplexTraits>
TFFT1D< ComplexTraits >::Complex TFFT1D< ComplexTraits >::getData const double  pos  )  const throw (Exception::OutOfGrid)
 

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

template<typename ComplexTraits>
double TFFT1D< ComplexTraits >::getFourierSpaceMax  )  const throw ()
 

Returns the maximal position of the grid in fourier space.

template<typename ComplexTraits>
double TFFT1D< ComplexTraits >::getFourierSpaceMin  )  const throw ()
 

Returns the minimal position of the grid in fourier space.

template<typename ComplexTraits>
double TFFT1D< ComplexTraits >::getFourierStepWidth  )  const throw ()
 

Returns the step width in fourier space.

template<typename ComplexTraits>
double TFFT1D< ComplexTraits >::getGridCoordinates Position  position  )  const throw ()
 

AR: Returns the grid coordinate corresponding to the position.

template<typename ComplexTraits>
TFFT1D< ComplexTraits >::Complex TFFT1D< ComplexTraits >::getInterpolatedValue const double  pos  )  const throw (Exception::OutOfGrid)
 

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.

template<typename ComplexTraits>
Size TFFT1D< ComplexTraits >::getMaxIndex  )  const throw ()
 

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.

template<typename ComplexTraits>
Size TFFT1D< ComplexTraits >::getNumberOfInverseTransforms  )  const throw ()
 

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.

template<typename ComplexTraits>
double TFFT1D< ComplexTraits >::getPhysSpaceMax  )  const throw ()
 

Returns the maximal position of the grid in physical space.

template<typename ComplexTraits>
double TFFT1D< ComplexTraits >::getPhysSpaceMin  )  const throw ()
 

Returns the minimal position of the grid in physical space.

template<typename ComplexTraits>
double TFFT1D< ComplexTraits >::getPhysStepWidth  )  const throw ()
 

Returns the step width in physical space.

template<typename ComplexTraits>
bool TFFT1D< ComplexTraits >::isInFourierSpace  )  const throw ()
 

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

template<typename ComplexTraits>
bool TFFT1D< ComplexTraits >::operator== const TFFT1D< ComplexTraits > &  fft1d  )  const throw ()
 

Equality operator.

template<typename ComplexTraits>
const Complex& TFFT1D< ComplexTraits >::operator[] const Position pos  )  const throw (Exception::OutOfGrid)
 

AR: Access the (raw) data at Position pos.

Const method.

template<typename ComplexTraits>
const TFFT1D< ComplexTraits >::Complex & TFFT1D< ComplexTraits >::operator[] const double  pos  )  const throw (Exception::OutOfGrid)
 

Access the data at the grid position closest to pos .

This function returns the "raw" data at that position.

template<typename ComplexTraits>
TFFT1D< ComplexTraits >::Complex & TFFT1D< ComplexTraits >::operator[] const double  pos  )  throw (Exception::OutOfGrid)
 

Access the data at the grid position closest to pos .

This function returns the "raw" data at that position.

template<typename ComplexTraits>
TFFT1D< ComplexTraits >::Complex TFFT1D< ComplexTraits >::phase const double  pos  )  const throw ()
 

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".

template<typename ComplexTraits>
void TFFT1D< ComplexTraits >::setData double  pos,
Complex  val
throw (Exception::OutOfGrid)
 

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.

template<typename ComplexTraits>
bool TFFT1D< ComplexTraits >::setPhysStepWidth double  new_width  )  throw ()
 

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 .

template<typename ComplexTraits>
TFFT1D< ComplexTraits >::throw  ) 
 

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

template<typename ComplexTraits>
bool TFFT1D< ComplexTraits >::translate double  trans_origin  )  throw ()
 

Translate the origin in physical space about transOrigin .

If the result is out of bounds, the function does nothing and returns false .