#include <BALL/MATHS/FFT1D.h>
Public Types | |
typedef std::complex< typename ComplexTraits::ComplexPrecision > | Complex |
typedef TRegularData1D < std::complex< typename ComplexTraits::ComplexPrecision > > | ComplexVector |
Public Member Functions | |
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 throw (Exception::OutOfGrid) |
Complex | getInterpolatedValue (const double pos) const throw (Exception::OutOfGrid) |
void | setData (double pos, Complex val) throw (Exception::OutOfGrid) |
Complex & | operator[] (const double pos) throw (Exception::OutOfGrid) |
const Complex & | operator[] (const double pos) const throw (Exception::OutOfGrid) |
Complex & | operator[] (const Position &pos) throw (Exception::OutOfGrid) |
const Complex & | operator[] (const Position &pos) const throw (Exception::OutOfGrid) |
void | setNumberOfFFTTransforms (Size num) |
void | setNumberOfiFFTTransforms (Size num) |
bool | isInFourierSpace () const |
Complex | phase (const double pos) const |
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 () |
Predicates | |
bool | operator== (const TFFT1D &fft1d) const |
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_ |
A class to perform Fast Fourier Transforms and inverse Fast Fourier Transforms on regularly spaced one dimensional data.
typedef std::complex<typename ComplexTraits::ComplexPrecision> BALL::TFFT1D< ComplexTraits >::Complex |
typedef TRegularData1D<std::complex<typename ComplexTraits::ComplexPrecision> > BALL::TFFT1D< ComplexTraits >::ComplexVector |
BALL::TFFT1D< ComplexTraits >::TFFT1D | ( | ) | [inline] |
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.
BALL::TFFT1D< ComplexTraits >::TFFT1D | ( | const TFFT1D< ComplexTraits > & | data | ) |
Copy constructor.
BALL::TFFT1D< ComplexTraits >::TFFT1D | ( | Size | ldn, | |
double | stepPhys = 1. , |
|||
double | origin = 0. , |
|||
bool | inFourierSpace = false | |||
) |
Detailed constructor.
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 |
virtual BALL::TFFT1D< ComplexTraits >::~TFFT1D | ( | ) | [virtual] |
Destructor.
virtual void BALL::TFFT1D< ComplexTraits >::clear | ( | ) | [virtual] |
Clear the contents.
Reimplemented from BALL::TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > >.
virtual void BALL::TFFT1D< ComplexTraits >::destroy | ( | ) | [virtual] |
Clear the contents and reset all attributes.
void BALL::TFFT1D< ComplexTraits >::doFFT | ( | ) |
Perform a single fast fourier transform on the data.
void BALL::TFFT1D< ComplexTraits >::doiFFT | ( | ) |
Perform a single inverse fourier transform on the data.
TFFT1D< ComplexTraits >::Complex BALL::TFFT1D< ComplexTraits >::getData | ( | const double | pos | ) | const throw (Exception::OutOfGrid) [inline] |
Returns the data at the grid position closest to pos , and automatically includes the correct phase factor and normalization.
Referenced by BALL::TFFT1D< ComplexTraits >::operator==().
double BALL::TFFT1D< ComplexTraits >::getFourierSpaceMax | ( | ) | const [inline] |
Returns the maximal position of the grid in fourier space.
References BALL::TFFT1D< ComplexTraits >::maxFourier_.
double BALL::TFFT1D< ComplexTraits >::getFourierSpaceMin | ( | ) | const [inline] |
Returns the minimal position of the grid in fourier space.
References BALL::TFFT1D< ComplexTraits >::minFourier_.
double BALL::TFFT1D< ComplexTraits >::getFourierStepWidth | ( | ) | const [inline] |
Returns the step width in fourier space.
References BALL::TFFT1D< ComplexTraits >::stepFourier_.
double BALL::TFFT1D< ComplexTraits >::getGridCoordinates | ( | Position | position | ) | const [inline] |
AR: Returns the grid coordinate corresponding to the position.
References BALL::TFFT1D< ComplexTraits >::inFourierSpace_, BALL::TFFT1D< ComplexTraits >::length_, BALL::TFFT1D< ComplexTraits >::origin_, BALL::TRegularData1D< ValueType >::size(), BALL::TFFT1D< ComplexTraits >::stepFourier_, and BALL::TFFT1D< ComplexTraits >::stepPhys_.
TFFT1D< ComplexTraits >::Complex BALL::TFFT1D< ComplexTraits >::getInterpolatedValue | ( | const double | pos | ) | const throw (Exception::OutOfGrid) [inline] |
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.
References BALL::Maths::floor(), BALL::Constants::h, BALL::Maths::max(), and BALL::Maths::min().
Size BALL::TFFT1D< ComplexTraits >::getMaxIndex | ( | ) | const [inline] |
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.
References BALL::TFFT1D< ComplexTraits >::length_.
Size BALL::TFFT1D< ComplexTraits >::getNumberOfInverseTransforms | ( | ) | const [inline] |
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.
References BALL::TFFT1D< ComplexTraits >::numFourierToPhys_.
double BALL::TFFT1D< ComplexTraits >::getPhysSpaceMax | ( | ) | const [inline] |
Returns the maximal position of the grid in physical space.
References BALL::TFFT1D< ComplexTraits >::maxPhys_.
double BALL::TFFT1D< ComplexTraits >::getPhysSpaceMin | ( | ) | const [inline] |
Returns the minimal position of the grid in physical space.
References BALL::TFFT1D< ComplexTraits >::minPhys_.
double BALL::TFFT1D< ComplexTraits >::getPhysStepWidth | ( | ) | const [inline] |
Returns the step width in physical space.
References BALL::TFFT1D< ComplexTraits >::stepPhys_.
bool BALL::TFFT1D< ComplexTraits >::isInFourierSpace | ( | ) | const [inline] |
AR: Returns true if the data is considered to be in Fourier space, false otherwise.
References BALL::TFFT1D< ComplexTraits >::inFourierSpace_.
const TFFT1D& BALL::TFFT1D< ComplexTraits >::operator= | ( | const TFFT1D< ComplexTraits > & | fft1d | ) |
Assignment operator.
bool BALL::TFFT1D< ComplexTraits >::operator== | ( | const TFFT1D< ComplexTraits > & | fft1d | ) | const [inline] |
Equality operator.
References BALL::TFFT1D< ComplexTraits >::getData(), BALL::TFFT1D< ComplexTraits >::inFourierSpace_, BALL::Maths::max(), BALL::TFFT1D< ComplexTraits >::maxFourier_, BALL::TFFT1D< ComplexTraits >::maxPhys_, BALL::Maths::min(), BALL::TFFT1D< ComplexTraits >::minFourier_, BALL::TFFT1D< ComplexTraits >::minPhys_, BALL::TFFT1D< ComplexTraits >::numFourierToPhys_, BALL::TFFT1D< ComplexTraits >::numPhysToFourier_, BALL::TFFT1D< ComplexTraits >::origin_, BALL::TFFT1D< ComplexTraits >::planCalculated_, BALL::TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > >::size(), BALL::TRegularData1D< ValueType >::size(), BALL::TFFT1D< ComplexTraits >::stepFourier_, and BALL::TFFT1D< ComplexTraits >::stepPhys_.
const Complex& BALL::TFFT1D< ComplexTraits >::operator[] | ( | const Position & | pos | ) | const throw (Exception::OutOfGrid) [inline] |
AR: Access the (raw) data at Position pos. Const method.
References BALL::TFFT1D< ComplexTraits >::operator[]().
Complex& BALL::TFFT1D< ComplexTraits >::operator[] | ( | const Position & | pos | ) | throw (Exception::OutOfGrid) [inline] |
AR: Access the (raw) data at Position pos
References BALL::TFFT1D< ComplexTraits >::operator[]().
const TFFT1D< ComplexTraits >::Complex & BALL::TFFT1D< ComplexTraits >::operator[] | ( | const double | pos | ) | const throw (Exception::OutOfGrid) [inline] |
Access the data at the grid position closest to pos . This function returns the "raw" data at that position.
References BALL::Maths::rint().
TFFT1D< ComplexTraits >::Complex & BALL::TFFT1D< ComplexTraits >::operator[] | ( | const double | pos | ) | throw (Exception::OutOfGrid) [inline] |
Access the data at the grid position closest to pos . This function returns the "raw" data at that position.
References BALL::Maths::rint().
Referenced by BALL::TFFT1D< ComplexTraits >::operator[]().
TFFT1D< ComplexTraits >::Complex BALL::TFFT1D< ComplexTraits >::phase | ( | const double | pos | ) | const [inline] |
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".
References BALL::TFFT1D< ComplexTraits >::length_, BALL::TFFT1D< ComplexTraits >::origin_, BALL::Maths::rint(), BALL::TFFT1D< ComplexTraits >::stepFourier_, and BALL::TFFT1D< ComplexTraits >::stepPhys_.
void BALL::TFFT1D< ComplexTraits >::setData | ( | double | pos, | |
Complex | val | |||
) | throw (Exception::OutOfGrid) [inline] |
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.
void BALL::TFFT1D< ComplexTraits >::setNumberOfFFTTransforms | ( | Size | num | ) | [inline] |
References BALL::TFFT1D< ComplexTraits >::numPhysToFourier_.
void BALL::TFFT1D< ComplexTraits >::setNumberOfiFFTTransforms | ( | Size | num | ) | [inline] |
References BALL::TFFT1D< ComplexTraits >::numFourierToPhys_.
bool BALL::TFFT1D< ComplexTraits >::setPhysStepWidth | ( | double | new_width | ) | [inline] |
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 .
References BALL::TFFT1D< ComplexTraits >::length_, BALL::TFFT1D< ComplexTraits >::maxFourier_, BALL::TFFT1D< ComplexTraits >::maxPhys_, BALL::TFFT1D< ComplexTraits >::minFourier_, BALL::TFFT1D< ComplexTraits >::minPhys_, BALL::TFFT1D< ComplexTraits >::origin_, BALL::TFFT1D< ComplexTraits >::stepFourier_, and BALL::TFFT1D< ComplexTraits >::stepPhys_.
bool BALL::TFFT1D< ComplexTraits >::translate | ( | double | trans_origin | ) | [inline] |
Translate the origin in physical space about transOrigin . If the result is out of bounds, the function does nothing and returns false .
References BALL::TFFT1D< ComplexTraits >::length_, BALL::TFFT1D< ComplexTraits >::maxFourier_, BALL::TFFT1D< ComplexTraits >::maxPhys_, BALL::TFFT1D< ComplexTraits >::minFourier_, BALL::TFFT1D< ComplexTraits >::minPhys_, BALL::TFFT1D< ComplexTraits >::origin_, BALL::Maths::rint(), BALL::TFFT1D< ComplexTraits >::stepFourier_, and BALL::TFFT1D< ComplexTraits >::stepPhys_.
Complex* BALL::TFFT1D< ComplexTraits >::dataAdress_ [protected] |
bool BALL::TFFT1D< ComplexTraits >::inFourierSpace_ [protected] |
Size BALL::TFFT1D< ComplexTraits >::length_ [protected] |
double BALL::TFFT1D< ComplexTraits >::maxFourier_ [protected] |
double BALL::TFFT1D< ComplexTraits >::maxPhys_ [protected] |
double BALL::TFFT1D< ComplexTraits >::minFourier_ [protected] |
double BALL::TFFT1D< ComplexTraits >::minPhys_ [protected] |
Size BALL::TFFT1D< ComplexTraits >::numFourierToPhys_ [protected] |
Size BALL::TFFT1D< ComplexTraits >::numPhysToFourier_ [protected] |
double BALL::TFFT1D< ComplexTraits >::origin_ [protected] |
The origin of the data set.
Reimplemented from BALL::TRegularData1D< std::complex< ComplexTraits::ComplexPrecision > >.
Referenced by BALL::TFFT1D< ComplexTraits >::getGridCoordinates(), BALL::TFFT1D< ComplexTraits >::operator==(), BALL::TFFT1D< ComplexTraits >::phase(), BALL::TFFT1D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT1D< ComplexTraits >::translate().
ComplexTraits::FftwPlan BALL::TFFT1D< ComplexTraits >::planBackward_ [protected] |
bool BALL::TFFT1D< ComplexTraits >::planCalculated_ [protected] |
Referenced by BALL::TFFT1D< ComplexTraits >::operator==().
ComplexTraits::FftwPlan BALL::TFFT1D< ComplexTraits >::planForward_ [protected] |
double BALL::TFFT1D< ComplexTraits >::stepFourier_ [protected] |
Referenced by BALL::TFFT1D< ComplexTraits >::getFourierStepWidth(), BALL::TFFT1D< ComplexTraits >::getGridCoordinates(), BALL::TFFT1D< ComplexTraits >::operator==(), BALL::TFFT1D< ComplexTraits >::phase(), BALL::TFFT1D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT1D< ComplexTraits >::translate().
double BALL::TFFT1D< ComplexTraits >::stepPhys_ [protected] |
Referenced by BALL::TFFT1D< ComplexTraits >::getGridCoordinates(), BALL::TFFT1D< ComplexTraits >::getPhysStepWidth(), BALL::TFFT1D< ComplexTraits >::operator==(), BALL::TFFT1D< ComplexTraits >::phase(), BALL::TFFT1D< ComplexTraits >::setPhysStepWidth(), and BALL::TFFT1D< ComplexTraits >::translate().