BALL::TFFT3D< ComplexTraits > Class Template Reference
[Fast Fourier Transforms]

#include <BALL/MATHS/FFT3D.h>

Inheritance diagram for BALL::TFFT3D< ComplexTraits >:
Inheritance graph
[legend]

List of all members.

Public Types

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

Public Member Functions

Constructors and Destructors

 TFFT3D ()
 Default constructor.
 TFFT3D (const TFFT3D &data)
 Copy constructor.
 TFFT3D (Size ldnX, Size ldnY, Size ldnZ, double stepPhysX=1., double stepPhysY=1., double stepPhysZ=1., Vector3 origin=Vector3(0., 0., 0), bool inFourierSpace=false)
virtual ~TFFT3D ()
 Destructor.
Assignment

const TFFT3Doperator= (const TFFT3D &fft_3d)
 Assignment operator.
virtual void clear ()
virtual void destroy ()
Predicates

bool operator== (const TFFT3D &fft3d) const
bool isInFourierSpace () const

void doFFT ()
void doiFFT ()
bool translate (const Vector3 &trans_origin)
bool setPhysStepWidth (double new_width_x, double new_width_y, double new_width_z)
double getPhysStepWidthX () const
double getPhysStepWidthY () const
double getPhysStepWidthZ () const
double getFourierStepWidthX () const
double getFourierStepWidthY () const
double getFourierStepWidthZ () const
double getPhysSpaceMinX () const
double getPhysSpaceMinY () const
double getPhysSpaceMinZ () const
double getPhysSpaceMaxX () const
double getPhysSpaceMaxY () const
double getPhysSpaceMaxZ () const
double getFourierSpaceMinX () const
double getFourierSpaceMinY () const
double getFourierSpaceMinZ () const
double getFourierSpaceMaxX () const
double getFourierSpaceMaxY () const
double getFourierSpaceMaxZ () const
Size getMaxXIndex () const
Size getMaxYIndex () const
Size getMaxZIndex () const
Size getNumberOfInverseTransforms () const
Vector3 getGridCoordinates (Position position) const
Complex getData (const Vector3 &pos) const
Complex getInterpolatedValue (const Vector3 &pos) const
void setData (const Vector3 &pos, Complex val)
Complexoperator[] (const Vector3 &pos)
const Complexoperator[] (const Vector3 &pos) const
Complexoperator[] (const Position &pos)
const Complexoperator[] (const Position &pos) const
void setNumberOfFFTTransforms (Size num)
void setNumberOfiFFTTransforms (Size num)
Complex phase (const Vector3 &pos) const

Protected Attributes

Size lengthX_
Size lengthY_
Size lengthZ_
bool inFourierSpace_
Size numPhysToFourier_
Size numFourierToPhys_
Vector3 origin_
 Origin of the grid (offset).
double stepPhysX_
double stepPhysY_
double stepPhysZ_
double stepFourierX_
double stepFourierY_
double stepFourierZ_
Vector3 minPhys_
Vector3 maxPhys_
Vector3 minFourier_
Vector3 maxFourier_
ComplexTraits::FftwPlan planForward_
ComplexTraits::FftwPlan planBackward_
Size dataLength_
ComplexdataAdress_
bool planCalculated_

Detailed Description

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

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

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

Definition at line 39 of file FFT3D.h.


Member Typedef Documentation

template<typename ComplexTraits>
typedef std::complex<typename ComplexTraits::ComplexPrecision> BALL::TFFT3D< ComplexTraits >::Complex

Definition at line 44 of file FFT3D.h.

template<typename ComplexTraits>
typedef TRegularData3D<std::complex<typename ComplexTraits::ComplexPrecision> > BALL::TFFT3D< ComplexTraits >::ComplexVector

Definition at line 45 of file FFT3D.h.


Constructor & Destructor Documentation

template<typename ComplexTraits >
BALL::TFFT3D< ComplexTraits >::TFFT3D (  )  [inline]

Default constructor.

Definition at line 364 of file FFT3D.h.

template<typename ComplexTraits>
BALL::TFFT3D< ComplexTraits >::TFFT3D ( const TFFT3D< ComplexTraits > &  data  ) 

Copy constructor.

template<typename ComplexTraits>
BALL::TFFT3D< ComplexTraits >::TFFT3D ( Size  ldnX,
Size  ldnY,
Size  ldnZ,
double  stepPhysX = 1.,
double  stepPhysY = 1.,
double  stepPhysZ = 1.,
Vector3  origin = Vector3(0., 0., 0),
bool  inFourierSpace = false 
)

Detailed constructor.

Parameters:
ldnX The binary logarithm of the number of grid points in X direction (we use the logarithm to ensure that the number of points is a power of two, which is important for the FFT)
ldnY The binary logarithm of the number of grid points in Y direction
ldnZ The binary logarithm of the number of grid points in Z direction
stepPhysX The step width in X direction in physical space
stepPhysY The step width in Y direction in physical space
stepPhysZ The step width in Z direction 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>
virtual BALL::TFFT3D< ComplexTraits >::~TFFT3D (  )  [virtual]

Destructor.


Member Function Documentation

template<typename ComplexTraits>
virtual void BALL::TFFT3D< ComplexTraits >::clear (  )  [virtual]
template<typename ComplexTraits>
virtual void BALL::TFFT3D< ComplexTraits >::destroy (  )  [virtual]

Clear the contents and reset all attributes.

template<typename ComplexTraits>
void BALL::TFFT3D< ComplexTraits >::doFFT (  ) 

Perform a single fast Fourier transform on the data.

template<typename ComplexTraits>
void BALL::TFFT3D< ComplexTraits >::doiFFT (  ) 

Perform a single inverse Fourier transform on the data.

template<typename ComplexTraits >
TFFT3D< ComplexTraits >::Complex BALL::TFFT3D< ComplexTraits >::getData ( const Vector3 pos  )  const [inline]

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

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

Definition at line 668 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierSpaceMaxX (  )  const [inline]

Returns the maximal position of the grid in Fourier space in X direction.

Definition at line 566 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierSpaceMaxY (  )  const [inline]

Returns the maximal position of the grid in Fourier space in Y direction.

Definition at line 572 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierSpaceMaxZ (  )  const [inline]

Returns the maximal position of the grid in Fourier space in Z direction.

Definition at line 578 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierSpaceMinX (  )  const [inline]

Returns the minimal position of the grid in Fourier space in X direction.

Definition at line 547 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierSpaceMinY (  )  const [inline]

Returns the minimal position of the grid in Fourier space in Y direction.

Definition at line 554 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierSpaceMinZ (  )  const [inline]

Returns the minimal position of the grid in Fourier space in Z direction.

Definition at line 560 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierStepWidthX (  )  const [inline]

Returns the step width in Fourier space in X direction.

Definition at line 493 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierStepWidthY (  )  const [inline]

Returns the step width in Fourier space in Y direction.

Definition at line 499 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getFourierStepWidthZ (  )  const [inline]

Returns the step width in Fourier space in Z direction.

Definition at line 505 of file FFT3D.h.

template<typename ComplexTraits >
Vector3 BALL::TFFT3D< ComplexTraits >::getGridCoordinates ( Position  position  )  const [inline]

Returns the grid coordinate corresponding to the position.

Definition at line 608 of file FFT3D.h.

template<typename ComplexTraits >
TFFT3D< ComplexTraits >::Complex BALL::TFFT3D< ComplexTraits >::getInterpolatedValue ( const Vector3 pos  )  const [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 (symmetric) normalization.

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

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

Definition at line 696 of file FFT3D.h.

template<typename ComplexTraits >
Size BALL::TFFT3D< ComplexTraits >::getMaxXIndex (  )  const [inline]

Return the largest grid position for the x direction. This method returns the maximum position allowed in the grid. As the point in the origin has the indices (0, 0, 0), this method returns the number of points in X direction minus one.

Definition at line 584 of file FFT3D.h.

template<typename ComplexTraits >
Size BALL::TFFT3D< ComplexTraits >::getMaxYIndex (  )  const [inline]

Return the largest grid position for the y direction. This method returns the maximum position allowed in the grid. As the point in the origin has the indices (0, 0, 0), this method returns the number of points in Y direction minus one.

Definition at line 590 of file FFT3D.h.

template<typename ComplexTraits >
Size BALL::TFFT3D< ComplexTraits >::getMaxZIndex (  )  const [inline]

Return the largest grid position for the z direction. This method returns the maximum position allowed in the grid. As the point in the origin has the indices (0, 0, 0), this method returns the number of points in Z direction minus one.

Definition at line 596 of file FFT3D.h.

template<typename ComplexTraits >
Size BALL::TFFT3D< ComplexTraits >::getNumberOfInverseTransforms (  )  const [inline]

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 602 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysSpaceMaxX (  )  const [inline]

Returns the maximal position of the grid in physical space in X direction.

Definition at line 529 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysSpaceMaxY (  )  const [inline]

Returns the maximal position of the grid in physical space in Y direction.

Definition at line 535 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysSpaceMaxZ (  )  const [inline]

Returns the maximal position of the grid in physical space in Z direction.

Definition at line 541 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysSpaceMinX (  )  const [inline]

Returns the minimal position of the grid in physical space in X direction.

Definition at line 511 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysSpaceMinY (  )  const [inline]

Returns the minimal position of the grid in physical space in Y direction.

Definition at line 517 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysSpaceMinZ (  )  const [inline]

Returns the minimal position of the grid in physical space in Z direction.

Definition at line 523 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysStepWidthX (  )  const [inline]

Returns the step width in physical space in X direction.

Definition at line 475 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysStepWidthY (  )  const [inline]

Returns the step width in physical space in Y direction.

Definition at line 481 of file FFT3D.h.

template<typename ComplexTraits >
double BALL::TFFT3D< ComplexTraits >::getPhysStepWidthZ (  )  const [inline]

Returns the step width in physical space in Z direction.

Definition at line 487 of file FFT3D.h.

template<typename ComplexTraits >
bool BALL::TFFT3D< ComplexTraits >::isInFourierSpace (  )  const [inline]

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

Definition at line 921 of file FFT3D.h.

template<typename ComplexTraits>
const TFFT3D& BALL::TFFT3D< ComplexTraits >::operator= ( const TFFT3D< ComplexTraits > &  fft_3d  ) 

Assignment operator.

template<typename ComplexTraits >
bool BALL::TFFT3D< ComplexTraits >::operator== ( const TFFT3D< ComplexTraits > &  fft3d  )  const [inline]

Equality operator.

Definition at line 373 of file FFT3D.h.

template<typename ComplexTraits>
const Complex& BALL::TFFT3D< 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 287 of file FFT3D.h.

template<typename ComplexTraits>
Complex& BALL::TFFT3D< 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 278 of file FFT3D.h.

template<typename ComplexTraits >
const TFFT3D< ComplexTraits >::Complex & BALL::TFFT3D< ComplexTraits >::operator[] ( const Vector3 pos  )  const [inline]

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 826 of file FFT3D.h.

template<typename ComplexTraits >
TFFT3D< ComplexTraits >::Complex & BALL::TFFT3D< ComplexTraits >::operator[] ( const Vector3 pos  )  [inline]

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 771 of file FFT3D.h.

template<typename ComplexTraits >
TFFT3D< ComplexTraits >::Complex BALL::TFFT3D< ComplexTraits >::phase ( const Vector3 pos  )  const [inline]

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 891 of file FFT3D.h.

template<typename ComplexTraits >
void BALL::TFFT3D< ComplexTraits >::setData ( const Vector3 pos,
Complex  val 
) [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 (symmetric) normalization.

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

Definition at line 746 of file FFT3D.h.

template<typename ComplexTraits>
void BALL::TFFT3D< ComplexTraits >::setNumberOfFFTTransforms ( Size  num  )  [inline]

Definition at line 293 of file FFT3D.h.

template<typename ComplexTraits>
void BALL::TFFT3D< ComplexTraits >::setNumberOfiFFTTransforms ( Size  num  )  [inline]

Definition at line 299 of file FFT3D.h.

template<typename ComplexTraits >
bool BALL::TFFT3D< ComplexTraits >::setPhysStepWidth ( double  new_width_x,
double  new_width_y,
double  new_width_z 
) [inline]

Set the step width in physical space to {new_width_x, new_width_y, new_width_z}. The step width in Fourier space is automatically adjusted accordingly. {new_width_x, new_width_y and new_width_z} must be positive, otherwise the function does nothing and retuns false .

Definition at line 450 of file FFT3D.h.

template<typename ComplexTraits >
bool BALL::TFFT3D< ComplexTraits >::translate ( const Vector3 trans_origin  )  [inline]

Translate the origin in physical space about {trans_origin}, i.e. the new origin will be located at the former position {trans_origin}. If the result is out of bounds, the function does nothing and returns false .

Definition at line 424 of file FFT3D.h.


Member Data Documentation

template<typename ComplexTraits>
Complex* BALL::TFFT3D< ComplexTraits >::dataAdress_ [protected]

Definition at line 340 of file FFT3D.h.

template<typename ComplexTraits>
Size BALL::TFFT3D< ComplexTraits >::dataLength_ [protected]

Definition at line 339 of file FFT3D.h.

template<typename ComplexTraits>
bool BALL::TFFT3D< ComplexTraits >::inFourierSpace_ [protected]

Definition at line 324 of file FFT3D.h.

template<typename ComplexTraits>
Size BALL::TFFT3D< ComplexTraits >::lengthX_ [protected]

Definition at line 323 of file FFT3D.h.

template<typename ComplexTraits>
Size BALL::TFFT3D< ComplexTraits >::lengthY_ [protected]

Definition at line 323 of file FFT3D.h.

template<typename ComplexTraits>
Size BALL::TFFT3D< ComplexTraits >::lengthZ_ [protected]

Definition at line 323 of file FFT3D.h.

template<typename ComplexTraits>
Vector3 BALL::TFFT3D< ComplexTraits >::maxFourier_ [protected]

Definition at line 331 of file FFT3D.h.

template<typename ComplexTraits>
Vector3 BALL::TFFT3D< ComplexTraits >::maxPhys_ [protected]

Definition at line 330 of file FFT3D.h.

template<typename ComplexTraits>
Vector3 BALL::TFFT3D< ComplexTraits >::minFourier_ [protected]

Definition at line 331 of file FFT3D.h.

template<typename ComplexTraits>
Vector3 BALL::TFFT3D< ComplexTraits >::minPhys_ [protected]

Definition at line 330 of file FFT3D.h.

template<typename ComplexTraits>
Size BALL::TFFT3D< ComplexTraits >::numFourierToPhys_ [protected]

Definition at line 326 of file FFT3D.h.

template<typename ComplexTraits>
Size BALL::TFFT3D< ComplexTraits >::numPhysToFourier_ [protected]

Definition at line 325 of file FFT3D.h.

template<typename ComplexTraits>
Vector3 BALL::TFFT3D< ComplexTraits >::origin_ [protected]

Origin of the grid (offset).

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

Definition at line 327 of file FFT3D.h.

template<typename ComplexTraits>
ComplexTraits::FftwPlan BALL::TFFT3D< ComplexTraits >::planBackward_ [protected]

Definition at line 336 of file FFT3D.h.

template<typename ComplexTraits>
bool BALL::TFFT3D< ComplexTraits >::planCalculated_ [protected]

Definition at line 341 of file FFT3D.h.

template<typename ComplexTraits>
ComplexTraits::FftwPlan BALL::TFFT3D< ComplexTraits >::planForward_ [protected]

Definition at line 335 of file FFT3D.h.

template<typename ComplexTraits>
double BALL::TFFT3D< ComplexTraits >::stepFourierX_ [protected]

Definition at line 329 of file FFT3D.h.

template<typename ComplexTraits>
double BALL::TFFT3D< ComplexTraits >::stepFourierY_ [protected]

Definition at line 329 of file FFT3D.h.

template<typename ComplexTraits>
double BALL::TFFT3D< ComplexTraits >::stepFourierZ_ [protected]

Definition at line 329 of file FFT3D.h.

template<typename ComplexTraits>
double BALL::TFFT3D< ComplexTraits >::stepPhysX_ [protected]

Definition at line 328 of file FFT3D.h.

template<typename ComplexTraits>
double BALL::TFFT3D< ComplexTraits >::stepPhysY_ [protected]

Definition at line 328 of file FFT3D.h.

template<typename ComplexTraits>
double BALL::TFFT3D< ComplexTraits >::stepPhysZ_ [protected]

Definition at line 328 of file FFT3D.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Generated by  doxygen 1.6.3