5#ifndef BALL_MATHS_TFFT1D_H
6#define BALL_MATHS_TFFT1D_H
8#ifndef BALL_COMMON_EXCEPTION_H
12#ifndef BALL_DATATYPE_REGULARDATA1D_H
36 template <
typename ComplexTraits>
38 :
public TRegularData1D<std::complex<typename ComplexTraits::ComplexPrecision> >
42 typedef std::complex<typename ComplexTraits::ComplexPrecision>
Complex;
67 TFFT1D(
Size ldn,
double stepPhys = 1.,
double origin = 0.,
bool inFourierSpace = false);
97 bool operator == (const
TFFT1D& fft1d) const;
200 const
Complex& operator [] (const
double pos) const;
284 template <
typename ComplexTraits>
295 template <
typename ComplexTraits>
315 for (
double pos=min; pos<=max; pos+=step)
329 template <
typename ComplexTraits>
350 template <
typename ComplexTraits>
371 template <
typename ComplexTraits>
377 template <
typename ComplexTraits>
383 template <
typename ComplexTraits>
389 template <
typename ComplexTraits>
395 template <
typename ComplexTraits>
401 template <
typename ComplexTraits>
407 template <
typename ComplexTraits>
413 template <
typename ComplexTraits>
420 template <
typename ComplexTraits>
459 template <
typename ComplexTraits>
463 double normalization=1.;
467 result = (*this)[pos];
472 result = (*this)[pos]*
phase(pos);
477 result *= normalization;
482 template <
typename ComplexTraits>
491 if ((pos < min) || (pos > max))
496 double h = pos - min;
497 double mod = fmod(h,step);
504 double before = floor(h/step)*step+ min;
505 double after = ceil(h/step)*step+ min;
507 double t = (pos - before)/step;
509 result =
getData(before)*(
typename ComplexTraits::ComplexPrecision)(1.-t);
510 result +=
getData(after)*(
typename ComplexTraits::ComplexPrecision)t;
515 template <
typename ComplexTraits>
521 dummy =
Complex(val.real()*((
typename ComplexTraits::ComplexPrecision)pow((
typename ComplexTraits::ComplexPrecision)(
length_),(
int)
numFourierToPhys_)),
522 val.imag()*((
typename ComplexTraits::ComplexPrecision)pow((
typename ComplexTraits::ComplexPrecision)(
length_),(
int)
numFourierToPhys_)));
529 *(
typename ComplexTraits::ComplexPrecision)pow((
typename ComplexTraits::ComplexPrecision)
length_,(
int)
numFourierToPhys_);
537 template <
typename ComplexTraits>
556 if ((internalPos < 0) || (internalPos>=(
Index)
length_))
561 return operator [] ((
Position)internalPos);
564 template <
typename ComplexTraits>
583 if ((internalPos < 0) || (internalPos>=(
Index)
length_))
588 return operator [] ((
Position)internalPos);
591 template <
typename ComplexTraits>
602 template <
typename ComplexTraits>
673 template <
typename ComplexTraits>
691 newGrid[i] = from[i].real()*normalization;
732 x-=(int)(lengthX/2.);
736 x+=(int)(lengthX/2.);
740 r = ((float)xp * stepFourierX);
742 newGrid[i] = (from[i]*(
typename ComplexTraits::ComplexPrecision)normalization*from.
phase(r)).real();
bool translate(double trans_origin)
double getFourierSpaceMax() const
double getGridCoordinates(Position position) const
void setNumberOfFFTTransforms(Size num)
BALL_FFTW_DEFAULT_TRAITS::FftwPlan planForward_
std::complex< typename ComplexTraits::ComplexPrecision > Complex
void setData(double pos, Complex val)
BALL_FFTW_DEFAULT_TRAITS::FftwPlan planBackward_
const Complex & operator[](const Position &pos) const
bool isInFourierSpace() const
Complex getInterpolatedValue(const double pos) const
Complex phase(const double pos) const
double getPhysStepWidth() const
Size getNumberOfInverseTransforms() const
TRegularData1D< std::complex< typename ComplexTraits::ComplexPrecision > > ComplexVector
Complex getData(const double pos) const
bool setPhysStepWidth(double new_width)
void setNumberOfiFFTTransforms(Size num)
TFFT1D()
Default constructor.
bool operator==(const TFFT1D &fft1d) const
double getFourierSpaceMin() const
Complex & operator[](const double pos)
double getPhysSpaceMin() const
double getFourierStepWidth() const
double getPhysSpaceMax() const
BALL_INLINE size_type size() const
BALL_INLINE void setDimension(const CoordinateType &dimension)
BALL_INLINE void setOrigin(const CoordinateType &origin)
const ValueType & operator[](const IndexType &index) const
#define BALL_CREATE(name)
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
BALL_EXTERN_VARIABLE const double PI
PI.
TRegularData1D< float > RegularData1D
TFFT1D< BALL_FFTW_DEFAULT_TRAITS > FFT1D
std::complex< BALL_COMPLEX_PRECISION > Complex