Loading...
Searching...
No Matches
FFT2D.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_MATHS_TFFT2D_H
#define BALL_MATHS_TFFT2D_H
#ifndef BALL_COMMON_EXCEPTION_H
# include <BALL/COMMON/exception.h>
#endif
#ifndef BALL_DATATYPE_REGULARDATA2D_H
# include <BALL/DATATYPE/regularData2D.h>
#endif
#ifndef BALL_MATHS_VECTOR2_H
# include <BALL/MATHS/vector2.h>
#endif
#include <cmath>
#include <complex>
#include <fftw3.h>
#include <BALL/MATHS/fftwCommon.h>
namespace BALL
{
template <typename ComplexTraits>
class TFFT2D
: public TRegularData2D<std::complex<typename ComplexTraits::ComplexPrecision> >
{
public:
typedef std::complex<typename ComplexTraits::ComplexPrecision> Complex;
typedef TRegularData2D<std::complex<typename ComplexTraits::ComplexPrecision> > ComplexVector;
typedef typename TRegularData2D<std::complex<typename ComplexTraits::ComplexPrecision> >::IndexType IndexType;
BALL_CREATE(TFFT2D)
TFFT2D();
TFFT2D(const TFFT2D &data);
// ldn is not any longer the binary logarithm but the absolute number of grid points
TFFT2D(Size nX, Size nY, double stepPhysX=1., double stepPhysY=1., Vector2 origin=Vector2(0.,0.), bool inFourierSpace=false);
virtual ~TFFT2D();
const TFFT2D& operator = (const TFFT2D& fft_2d);
virtual void clear();
virtual void destroy();
bool operator == (const TFFT2D& fft_2d) const;
// @name Accessors
void doFFT();
void doiFFT();
bool translate(const Vector2& trans_origin);
bool setPhysStepWidth(double new_width_x, double new_width_y);
double getPhysStepWidthX() const;
double getPhysStepWidthY() const;
double getFourierStepWidthX() const;
double getFourierStepWidthY() const;
double getPhysSpaceMinX() const;
double getPhysSpaceMinY() const;
double getPhysSpaceMaxX() const;
double getPhysSpaceMaxY() const;
double getFourierSpaceMinX() const;
double getFourierSpaceMinY() const;
double getFourierSpaceMaxX() const;
double getFourierSpaceMaxY() const;
Size getMaxXIndex() const;
Size getMaxYIndex() const;
Size getNumberOfInverseTransforms() const;
Vector2 getGridCoordinates(Position position) const;
Complex getData(const Vector2& pos) const;
Complex getInterpolatedValue(const Vector2& pos) const;
void setData(const Vector2& pos, Complex val);
Complex& operator[](const Vector2& pos);
const Complex& operator[](const Vector2& pos) const;
const Complex& operator [] (const IndexType& index) const { return TRegularData2D<Complex>::operator [](index); }
Complex& operator [] (const IndexType& index) { return TRegularData2D<Complex>::operator [](index); }
Complex& operator[](const Position& pos)
{
return TRegularData2D<Complex>::operator [] (pos);
}
const Complex& operator[](const Position& pos) const
{
return TRegularData2D<Complex>::operator [] (pos);
}
//
void setNumberOfFFTTransforms(Size num)
{
numPhysToFourier_ = num;
}
//
void setNumberOfiFFTTransforms(Size num)
{
numFourierToPhys_ = num;
}
Complex phase(const Vector2& pos) const;
bool isInFourierSpace() const;
protected:
Size lengthX_, lengthY_;
bool inFourierSpace_;
Size numPhysToFourier_;
Size numFourierToPhys_;
Vector2 origin_;
double stepPhysX_, stepPhysY_;
double stepFourierX_, stepFourierY_;
Vector2 minPhys_, maxPhys_;
Vector2 minFourier_, maxFourier_;
// new version for FFTW3
typename ComplexTraits::FftwPlan planForward_;
typename ComplexTraits::FftwPlan planBackward_;
// to control plan calculation with new fftw3
Size dataLength_;
Complex *dataAdress_;
bool planCalculated_;
};
typedef TFFT2D<BALL_FFTW_DEFAULT_TRAITS> FFT2D;
template <typename ComplexTraits>
const TRegularData2D<typename TFFT2D<ComplexTraits>::Complex>& operator<<
(TRegularData2D<typename TFFT2D<ComplexTraits>::Complex>& to, const TFFT2D<ComplexTraits>& from);
template <typename ComplexTraits>
const RegularData2D& operator << (RegularData2D& to, const TFFT2D<ComplexTraits>& from);
template <typename ComplexTraits>
TFFT2D<ComplexTraits>::TFFT2D()
: TRegularData2D<Complex>(),
dataLength_(0),
dataAdress_(0),
planCalculated_(false)
{
}
template <typename ComplexTraits>
bool TFFT2D<ComplexTraits>::operator == (const TFFT2D<ComplexTraits>& fft2D) const
{
// test whether data_.size() == fft2D.data_.size()
// instead of testing 2 lengths. Better for vector handling.
if (lengthX_ == fft2D.lengthX_ &&
lengthY_ == fft2D.lengthY_ &&
origin_ == fft2D.origin_ &&
stepPhysX_ == fft2D.stepPhysX_ &&
stepPhysY_ == fft2D.stepPhysY_ &&
stepFourierX_ == fft2D.stepFourierX_ &&
stepFourierY_ == fft2D.stepFourierY_ &&
minPhys_ == fft2D.minPhys_ &&
maxPhys_ == fft2D.maxPhys_ &&
minFourier_ == fft2D.minFourier_ &&
maxFourier_ == fft2D.maxFourier_ &&
numPhysToFourier_ == fft2D.numPhysToFourier_ &&
numFourierToPhys_ == fft2D.numFourierToPhys_)
{
Vector2 min = inFourierSpace_ ? minFourier_ : minPhys_;
Vector2 max = inFourierSpace_ ? maxFourier_ : maxPhys_;
double stepX = inFourierSpace_ ? stepFourierX_ : stepPhysX_;
double stepY = inFourierSpace_ ? stepFourierY_ : stepPhysY_;
for (double posX=min.x; posX<=max.x; posX+=stepX)
{
for (double posY=min.y; posY<=max.y; posY+=stepY)
{
if (getData(Vector2(posX,posY)) != fft2D.getData(Vector2(posX,posY)))
{
return false;
}
}
}
return true;
}
return false;
}
template <typename ComplexTraits>
bool TFFT2D<ComplexTraits>::translate(const Vector2& trans_origin)
{
Position internalOriginX = (Position) Maths::rint(trans_origin.x*stepPhysX_);
Position internalOriginY = (Position) Maths::rint(trans_origin.y*stepPhysY_);
if ((internalOriginX <= lengthX_) && (internalOriginY <= lengthY_))
{
origin_.x = trans_origin.x;
origin_.y = trans_origin.y;
minPhys_ = Vector2(-origin_.x,-origin_.y);
maxPhys_ = Vector2(((lengthX_-1)*stepPhysX_)-origin_.x,((lengthY_-1)*stepPhysY_)-origin_.y);
minFourier_ = Vector2(-(lengthX_/2.-1)*stepFourierX_,-(lengthY_/2.-1)*stepFourierY_);
maxFourier_ = Vector2((lengthX_/2.)*stepFourierX_,(lengthY_/2.)*stepFourierY_);
return true;
}
else
{
return false;
}
}
template <typename ComplexTraits>
bool TFFT2D<ComplexTraits>::setPhysStepWidth(double new_width_x, double new_width_y)
{
if ((new_width_x <= 0) || (new_width_y <= 0))
{
return false;
}
else
{
stepPhysX_ = new_width_x;
stepPhysY_ = new_width_y;
stepFourierX_ = 2.*Constants::PI/(stepPhysX_*lengthX_);
stepFourierY_ = 2.*Constants::PI/(stepPhysY_*lengthY_);
minPhys_ = Vector2(-origin_.x,-origin_.y);
maxPhys_ = Vector2(((lengthX_-1)*stepPhysX_)-origin_.x,((lengthY_-1)*stepPhysY_)-origin_.y);
minFourier_ = Vector2(-(lengthX_/2.-1)*stepFourierX_,-(lengthY_/2.-1)*stepFourierY_);
maxFourier_ = Vector2((lengthX_/2.)*stepFourierX_,(lengthY_/2.)*stepFourierY_);
return true;
}
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getPhysStepWidthX() const
{
return stepPhysX_;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getPhysStepWidthY() const
{
return stepPhysY_;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getFourierStepWidthX() const
{
return stepFourierX_;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getFourierStepWidthY() const
{
return stepFourierY_;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getPhysSpaceMinX() const
{
return minPhys_.x;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getPhysSpaceMinY() const
{
return minPhys_.y;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getPhysSpaceMaxX() const
{
return maxPhys_.x;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getPhysSpaceMaxY() const
{
return maxPhys_.y;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getFourierSpaceMinX() const
{
return minFourier_.x;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getFourierSpaceMinY() const
{
return minFourier_.y;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getFourierSpaceMaxX() const
{
return maxFourier_.x;
}
template <typename ComplexTraits>
double TFFT2D<ComplexTraits>::getFourierSpaceMaxY() const
{
return maxFourier_.y;
}
template <typename ComplexTraits>
Size TFFT2D<ComplexTraits>::getMaxXIndex() const
{
return (lengthX_ - 1);
}
template <typename ComplexTraits>
Size TFFT2D<ComplexTraits>::getMaxYIndex() const
{
return (lengthY_ - 1);
}
template <typename ComplexTraits>
Size TFFT2D<ComplexTraits>::getNumberOfInverseTransforms() const
{
return numFourierToPhys_;
}
// new for compatibility with FFT3D
template <typename ComplexTraits>
Vector2 TFFT2D<ComplexTraits>::getGridCoordinates(Position position) const
{
if (!inFourierSpace_)
{
if (position >= ComplexVector::size())
{
throw Exception::OutOfGrid(__FILE__, __LINE__);
}
Vector2 r;
Position x, y;
// AR: ??????
y = position % lengthY_;
x = position / lengthY_;
r.set(-origin_.x + (float)x * stepPhysX_,
-origin_.y + (float)y * stepPhysY_);
return r;
}
else
{
if (position >= ComplexVector::size())
{
throw Exception::OutOfGrid(__FILE__, __LINE__);
}
Vector2 r;
Index x, y;
// AR: ??????
y = position % lengthY_;
x = position / lengthY_;
if (x>=lengthX_/2.)
{
x-=lengthX_;
}
if (y>=lengthY_/2.)
{
y-=lengthY_;
}
r.set((float)x * stepFourierX_,
(float)y * stepFourierY_);
return r;
}
}
template <typename ComplexTraits>
typename TFFT2D<ComplexTraits>::Complex TFFT2D<ComplexTraits>::getData(const Vector2& pos) const
{
Complex result;
double normalization=1.;
if (!inFourierSpace_)
{
result = (*this)[pos];
normalization=1./((float)pow((float)(lengthX_*lengthY_),(int)numFourierToPhys_));
}
else
{
result = (*this)[pos] * phase(pos);
normalization=1./(2.*Constants::PI)*(stepPhysX_*stepPhysY_)/((float)pow((float)(lengthX_*lengthY_),(int)numFourierToPhys_));
}
result *= normalization;
return result;
}
template <typename ComplexTraits>
typename TFFT2D<ComplexTraits>::Complex TFFT2D<ComplexTraits>::getInterpolatedValue(const Vector2& pos) const
{
Complex result;
Vector2 min = inFourierSpace_ ? minFourier_ : minPhys_;
Vector2 max = inFourierSpace_ ? maxFourier_ : maxPhys_;
double stepX = inFourierSpace_ ? stepFourierX_ : stepPhysX_;
double stepY = inFourierSpace_ ? stepFourierY_ : stepPhysY_;
if ( (pos.x < min.x) || (pos.y < min.y)
|| (pos.x > max.x) || (pos.y > max.y) )
{
throw Exception::OutOfGrid(__FILE__, __LINE__);
}
Vector2 h(pos.x - min.x, pos.y - min.y);
double modX = fmod((double)h.x,stepX);
double modY = fmod((double)h.y,stepY);
if (modX==0 && modY ==0) // we are on the grid
{
return getData(pos);
}
double beforeX = floor(h.x/stepX)*stepX+ min.x;
double beforeY = floor(h.y/stepY)*stepY+ min.y;
double afterX = ceil(h.x/stepX)*stepX+ min.x;
double afterY = ceil(h.y/stepY)*stepY+ min.y;
double tx = (pos.x - beforeX)/stepX;
double ty = (pos.y - beforeY)/stepY;
result = getData(Vector2(beforeX,beforeY))*(typename ComplexTraits::ComplexPrecision)((1.-tx)*(1.-ty));
result += getData(Vector2(afterX, beforeY))*(typename ComplexTraits::ComplexPrecision)( tx *(1.-ty));
result += getData(Vector2(beforeX,afterY ))*(typename ComplexTraits::ComplexPrecision)((1.-tx)* ty );
result += getData(Vector2(afterX, afterY ))*(typename ComplexTraits::ComplexPrecision)( tx * ty );
return result;
}
template <typename ComplexTraits>
void TFFT2D<ComplexTraits>::setData(const Vector2& pos, Complex val)
{
Complex dummy;
if (!inFourierSpace_)
{
dummy = Complex(val.real()*((float)pow((float)(lengthX_*lengthY_),(int)numFourierToPhys_)),
val.imag()*((float)pow((float)(lengthX_*lengthY_),(int)numFourierToPhys_)));
(*this)[pos]=dummy;
}
else
{
val*=phase(pos)*(typename ComplexTraits::ComplexPrecision)((2*Constants::PI/(stepPhysX_*stepPhysY_)))
*(typename ComplexTraits::ComplexPrecision)pow((typename ComplexTraits::ComplexPrecision)(lengthX_*lengthY_),(int)numFourierToPhys_);
dummy = val;
(*this)[pos]=dummy;
}
}
template <typename ComplexTraits>
typename TFFT2D<ComplexTraits>::Complex& TFFT2D<ComplexTraits>::operator[](const Vector2& pos)
{
Index internalPos;
if (!inFourierSpace_)
{
Index i, j;
i = (Index) Maths::rint((pos.x+origin_.x)/stepPhysX_);
j = (Index) Maths::rint((pos.y+origin_.y)/stepPhysY_);
internalPos = j + i*lengthY_;
}
else
{
Index i, j;
i = (Index) Maths::rint(pos.x/stepFourierX_);
j = (Index) Maths::rint(pos.y/stepFourierY_);
if (i<0)
{
i+=lengthX_;
}
if (j<0)
{
j+=lengthY_;
}
internalPos = (j + i*lengthY_);
}
if ((internalPos < 0) || (internalPos>=(Index) (lengthX_*lengthY_)))
{
throw Exception::OutOfGrid(__FILE__, __LINE__);
}
return operator [] (internalPos);
}
template <typename ComplexTraits>
const typename TFFT2D<ComplexTraits>::Complex& TFFT2D<ComplexTraits>::operator[](const Vector2& pos) const
{
Index internalPos;
if (!inFourierSpace_)
{
Index i, j;
i = (Index) Maths::rint((pos.x+origin_.x)/stepPhysX_);
j = (Index) Maths::rint((pos.y+origin_.y)/stepPhysY_);
internalPos = j + i*lengthY_;
}
else
{
Index i, j;
i = (Index) Maths::rint(pos.x/stepFourierX_);
j = (Index) Maths::rint(pos.y/stepFourierY_);
if (i<0)
{
i+=lengthX_;
}
if (j<0)
{
j+=lengthY_;
}
internalPos = (j + i*lengthY_);
}
if ((internalPos < 0) || (internalPos>=(Index) (lengthX_*lengthY_)))
{
throw Exception::OutOfGrid(__FILE__, __LINE__);
}
return operator [] (internalPos);
}
template <typename ComplexTraits>
typename TFFT2D<ComplexTraits>::Complex TFFT2D<ComplexTraits>::phase(const Vector2& pos) const
{
double phase = 2.*Constants::PI*( Maths::rint(pos.x/stepFourierX_)*Maths::rint(origin_.x/stepPhysX_)
/lengthX_
+ Maths::rint(pos.y/stepFourierY_)*Maths::rint(origin_.y/stepPhysY_)
/lengthY_ );
Complex result = Complex(cos(phase), sin(phase));
return result;
}
template <typename ComplexTraits>
bool TFFT2D<ComplexTraits>::isInFourierSpace() const
{
return inFourierSpace_;
}
template <typename ComplexTraits>
const TRegularData2D<typename TFFT2D<ComplexTraits>::Complex>& operator <<
(TRegularData2D<typename TFFT2D<ComplexTraits>::Complex>& to, const TFFT2D<ComplexTraits>& from)
{
// first decide if the FFT3D data is in Fourier space.
if (!from.isInFourierSpace())
{
// create a new grid
Size lengthX = from.getMaxXIndex()+1;
Size lengthY = from.getMaxYIndex()+1;
TRegularData2D<typename TFFT2D<ComplexTraits>::Complex> newGrid(TRegularData2D<typename TFFT2D<ComplexTraits>::Complex>::IndexType(lengthX, lengthY),
Vector2(from.getPhysSpaceMinX(), from.getPhysSpaceMinY()),
Vector2(from.getPhysSpaceMaxX(), from.getPhysSpaceMaxY()));
// and fill it
double normalization=1./(pow((float)(lengthX*lengthY),from.getNumberOfInverseTransforms()));
typename TFFT2D<ComplexTraits>::Complex dataIn;
typename TFFT2D<ComplexTraits>::Complex dataOut;
for (Position i = 0; i < from.size(); i++)
{
Position x, y;
y = i % lengthY;
x = i / lengthY;
dataIn = from[i];
dataOut = dataIn;
newGrid[x + y*lengthY] = dataOut*(typename ComplexTraits::ComplexPrecision)normalization;
}
to = newGrid;
return to;
}
else
{
// we are in Fourier space
// create a new grid
Size lengthX = from.getMaxXIndex()+1;
Size lengthY = from.getMaxYIndex()+1;
//float stepPhysX = from.getPhysStepWidthX();
//float stepPhysY = from.getPhysStepWidthY();
float stepFourierX = from.getFourierStepWidthX();
float stepFourierY = from.getFourierStepWidthY();
TRegularData2D<typename TFFT2D<ComplexTraits>::Complex> newGrid(TRegularData2D<typename TFFT2D<ComplexTraits>::Complex>::IndexType(lengthX, lengthY),
Vector2(from.getFourierSpaceMinX(),
from.getFourierSpaceMinY()),
Vector2(from.getFourierSpaceMaxX(),
from.getFourierSpaceMaxY()));
// and fill it
// AR: old double normalization=1./(sqrt(2.*Constants::PI))*(stepPhysX*stepPhysY*stepPhysZ)/(pow((float)(lengthX*lengthY*lengthZ),from.getNumberOfInverseTransforms()));
double normalization=1./(2.*Constants::PI)/(pow((float)(lengthX*lengthY),from.getNumberOfInverseTransforms()));
Index x, y;
Vector2 r;
typename TFFT2D<ComplexTraits>::Complex dataIn;
typename TFFT2D<ComplexTraits>::Complex dataOut;
for (Position i = 0; i < from.size(); i++)
{
y = i % lengthY;
x = i / lengthY;
if (x>lengthX/2.)
{
x-=lengthX;
}
if (y>lengthY/2.)
{
y-=lengthY;
}
r.set((float)x * stepFourierX,
(float)y * stepFourierY);
dataIn = from[i];
dataOut = dataIn;
newGrid[x + y*lengthY] = dataOut*(typename ComplexTraits::ComplexPrecision)normalization*from.phase(r);
}
to = newGrid;
return to;
}
}
template <typename ComplexTraits>
const RegularData2D& operator << (RegularData2D& to, const TFFT2D<ComplexTraits>& from)
{
// first decide if the FFT2D data is in Fourier space.
if (!from.isInFourierSpace())
{
// create a new grid
Size lengthX = from.getMaxXIndex()+1;
Size lengthY = from.getMaxYIndex()+1;
RegularData2D newGrid(RegularData2D::IndexType(lengthX, lengthY),
Vector2(from.getPhysSpaceMinX(),
from.getPhysSpaceMinY()),
Vector2(from.getPhysSpaceMaxX(),
from.getPhysSpaceMaxY()));
// and fill it
double normalization = 1./(pow((float)(lengthX*lengthY),from.getNumberOfInverseTransforms()));
typename TFFT2D<ComplexTraits>::Complex dataIn;
typename TFFT2D<ComplexTraits>::Complex dataOut;
typename TFFT2D<ComplexTraits>::IndexType current_index;
typename RegularData2D::IndexType regdat_index;
for (current_index.x = 0; current_index.x < lengthX; current_index.x++)
{
for (current_index.y = 0; current_index.y < lengthY; current_index.y++)
{
regdat_index.x = current_index.x;
regdat_index.y = current_index.y;
dataIn = from[current_index];
dataOut = dataIn;
newGrid[regdat_index] = dataOut.real()*normalization;
}
}
to = newGrid;
return to;
}
else
{
// we are in Fourier space
// create a new grid
Size lengthX = from.getMaxXIndex()+1;
Size lengthY = from.getMaxYIndex()+1;
//float stepPhysX = from.getPhysStepWidthX();
//float stepPhysY = from.getPhysStepWidthY();
float stepFourierX = from.getFourierStepWidthX();
float stepFourierY = from.getFourierStepWidthY();
RegularData2D newGrid(RegularData2D::IndexType(lengthX, lengthY), Vector2(from.getFourierSpaceMinX(), from.getFourierSpaceMinY()), Vector2(from.getFourierSpaceMaxX(), from.getFourierSpaceMaxY()));
// and fill it
// AR: old version double normalization=1./(sqrt(2.*Constants::PI))*(stepPhysX*stepPhysY*stepPhysZ)/(pow((float)(lengthX*lengthY*lengthZ),from.getNumberOfInverseTransforms()));
double normalization=1./(2.*Constants::PI)/(pow((float)(lengthX*lengthY),from.getNumberOfInverseTransforms()));
Index x, y;
signed int xp, yp;
Vector2 r;
typename TFFT2D<ComplexTraits>::Complex dataIn;
typename TFFT2D<ComplexTraits>::Complex dataOut;
RegularData2D::IndexType current_index;
for (Position i = 0; i < from.size(); i++)
{
y = i % lengthY;
x = i / lengthY;
xp = x;
yp = y;
if (xp>=lengthX/2.)
{
xp-=(int)lengthX;
}
if (yp>=lengthY/2.)
{
yp-=(int)lengthY;
}
if (x>=lengthX/2.)
{
x-=(int)(lengthX/2.);
}
else
{
x+=(int)(lengthX/2.);
}
if (y>=lengthY/2.)
{
y-=(int)(lengthY/2.);
}
else
{
y+=(int)(lengthY/2.);
}
r.set((float)xp * stepFourierX,
(float)yp * stepFourierY);
dataIn = from[i];
dataOut = dataIn;
current_index.x = x;
current_index.y = y;
newGrid[current_index] = (dataOut*(typename ComplexTraits::ComplexPrecision)normalization*from.phase(r)).real();
}
to = newGrid;
return to;
}
}
}
#endif // BALL_MATHS_TFFT2D_H
exception.h
BALL::Exception::OutOfGrid
Definition COMMON/exception.h:351
BALL::TFFT2D
Definition FFT2D.h:43
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getMaxXIndex
Size getMaxXIndex() const
BALL::TFFT2D::setNumberOfFFTTransforms
void setNumberOfFFTTransforms(Size num)
Definition FFT2D.h:271
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getFourierSpaceMinX
double getFourierSpaceMinX() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getPhysSpaceMinY
double getPhysSpaceMinY() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::minPhys_
Vector2 minPhys_
Definition FFT2D.h:301
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getData
Complex getData(const Vector2 &pos) const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::stepFourierX_
double stepFourierX_
Definition FFT2D.h:300
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::numFourierToPhys_
Size numFourierToPhys_
Definition FFT2D.h:297
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getPhysStepWidthY
double getPhysStepWidthY() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::maxPhys_
Vector2 maxPhys_
Definition FFT2D.h:301
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::stepPhysX_
double stepPhysX_
Definition FFT2D.h:299
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::stepFourierY_
double stepFourierY_
Definition FFT2D.h:300
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::maxFourier_
Vector2 maxFourier_
Definition FFT2D.h:302
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getPhysStepWidthX
double getPhysStepWidthX() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::setData
void setData(const Vector2 &pos, Complex val)
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getPhysSpaceMaxY
double getPhysSpaceMaxY() const
BALL::TFFT2D::operator[]
const Complex & operator[](const Position &pos) const
Definition FFT2D.h:265
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getFourierSpaceMaxY
double getFourierSpaceMaxY() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getPhysSpaceMinX
double getPhysSpaceMinX() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::setPhysStepWidth
bool setPhysStepWidth(double new_width_x, double new_width_y)
BALL::TFFT2D::isInFourierSpace
bool isInFourierSpace() const
Definition FFT2D.h:762
BALL::TFFT2D::operator[]
Complex & operator[](const Vector2 &pos)
Definition FFT2D.h:665
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::lengthY_
Size lengthY_
Definition FFT2D.h:294
BALL::TFFT2D::operator[]
Complex & operator[](const Position &pos)
Definition FFT2D.h:256
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::numPhysToFourier_
Size numPhysToFourier_
Definition FFT2D.h:296
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::inFourierSpace_
bool inFourierSpace_
Definition FFT2D.h:295
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::doFFT
void doFFT()
BALL::TFFT2D::setNumberOfiFFTTransforms
void setNumberOfiFFTTransforms(Size num)
Definition FFT2D.h:277
BALL::TFFT2D::IndexType
TRegularData2D< std::complex< typenameComplexTraits::ComplexPrecision > >::IndexType IndexType
Definition FFT2D.h:48
BALL::TFFT2D::phase
Complex phase(const Vector2 &pos) const
Definition FFT2D.h:749
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::lengthX_
Size lengthX_
Definition FFT2D.h:294
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getNumberOfInverseTransforms
Size getNumberOfInverseTransforms() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::minFourier_
Vector2 minFourier_
Definition FFT2D.h:302
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getInterpolatedValue
Complex getInterpolatedValue(const Vector2 &pos) const
BALL::TFFT2D::Complex
std::complex< typename ComplexTraits::ComplexPrecision > Complex
Definition FFT2D.h:46
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::stepPhysY_
double stepPhysY_
Definition FFT2D.h:299
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::dataLength_
Size dataLength_
Definition FFT2D.h:310
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::doiFFT
void doiFFT()
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::translate
bool translate(const Vector2 &trans_origin)
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getMaxYIndex
Size getMaxYIndex() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::planForward_
BALL_FFTW_DEFAULT_TRAITS::FftwPlan planForward_
Definition FFT2D.h:305
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getFourierSpaceMaxX
double getFourierSpaceMaxX() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getFourierSpaceMinY
double getFourierSpaceMinY() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::planBackward_
BALL_FFTW_DEFAULT_TRAITS::FftwPlan planBackward_
Definition FFT2D.h:306
BALL::TFFT2D::TFFT2D
TFFT2D()
Default constructor.
Definition FFT2D.h:334
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::clear
virtual void clear()
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getFourierStepWidthX
double getFourierStepWidthX() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::planCalculated_
bool planCalculated_
Definition FFT2D.h:312
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getFourierStepWidthY
double getFourierStepWidthY() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::origin_
Vector2 origin_
Definition FFT2D.h:298
BALL::TFFT2D::ComplexVector
TRegularData2D< std::complex< typename ComplexTraits::ComplexPrecision > > ComplexVector
Definition FFT2D.h:47
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::dataAdress_
Complex * dataAdress_
Definition FFT2D.h:311
BALL::TFFT2D::operator==
bool operator==(const TFFT2D &fft_2d) const
Definition FFT2D.h:343
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getGridCoordinates
Vector2 getGridCoordinates(Position position) const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::getPhysSpaceMaxX
double getPhysSpaceMaxX() const
BALL::TFFT2D< BALL_FFTW_DEFAULT_TRAITS >::destroy
virtual void destroy()
BALL::TRegularData2D::IndexType::x
Position x
Definition regularData2D.h:56
BALL::TRegularData2D::IndexType::y
Position y
Definition regularData2D.h:58
BALL::TRegularData2D
Definition regularData2D.h:38
BALL::TRegularData2D< std::complex< typename ComplexTraits::ComplexPrecision > >::size
BALL_INLINE size_type size() const
Definition regularData2D.h:173
BALL::TRegularData2D< std::complex< ComplexTraits::ComplexPrecision > >::TRegularData2D
TRegularData2D()
Definition regularData2D.h:418
BALL::TRegularData2D::operator[]
const ValueType & operator[](const IndexType &index) const
Definition regularData2D.h:206
BALL::TVector2::set
void set(const T &value)
Definition vector2.h:459
BALL::TVector2::y
T y
Definition vector2.h:376
BALL::TVector2::x
T x
Definition vector2.h:372
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
fftwCommon.h
BALL::operator<<
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
BALL::Vector2
TVector2< float > Vector2
Definition vector2.h:771
BALL::Constants::PI
BALL_EXTERN_VARIABLE const double PI
PI.
Definition constants.h:35
BALL::Maths::rint
double rint(double x)
round to integral value in floating-point format
Definition MATHS/common.h:327
BALL
Definition constants.h:13
BALL::RegularData2D
TRegularData2D< float > RegularData2D
Definition regularData2D.h:414
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
BALL::FFT2D
TFFT2D< BALL_FFTW_DEFAULT_TRAITS > FFT2D
Definition FFT2D.h:318
BALL::Complex
std::complex< BALL_COMPLEX_PRECISION > Complex
Definition complex.h:21
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
regularData2D.h
vector2.h