Commit 6ae7f5c4 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

fftw3 array engine is fully implemented; remains to be tested

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/branches/libfourier
SVN Revision: 3953
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent d51f8bdf
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* ---- * ----
*
* *
* REVISIONS and CHANGES * REVISIONS and CHANGES
* - 13/05/2011 V1.0 Thomas Forbriger * - 13/05/2011 V1.0 Thomas Forbriger
...@@ -49,7 +48,7 @@ namespace fourier { ...@@ -49,7 +48,7 @@ namespace fourier {
DRFFTWAFFArrayEngine::DRFFTWAFFArrayEngine(const int& nseis, DRFFTWAFFArrayEngine::DRFFTWAFFArrayEngine(const int& nseis,
const int& nsamp) const int& nsamp)
: Mseriesarray(TAseries(nsamp,nseis)), : Mseriesarray(TAseries(nsamp,nseis)),
Mspectrumarray(TAspectrum(DRFFTWAFFArrayEngine::ncoeff(nsamp)),nseis), Mspectrumarray(TAspectrum(DRFFTWAFFArrayEngine::ncoeff(nsamp),nseis)),
Mplanr2c(0), Mplanc2r(0) Mplanr2c(0), Mplanc2r(0)
{ {
this->checkconsistency(); this->checkconsistency();
...@@ -84,14 +83,26 @@ namespace fourier { ...@@ -84,14 +83,26 @@ namespace fourier {
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
//! execute c2r plan
void DRFFTWAFFArrayEngine::c2r()
{
if (Mplanc2r == 0)
{
this->createplanc2r();
}
fftw_execute(Mplanc2r);
} // DRFFTWAFFArrayEngine::c2r()
/*----------------------------------------------------------------------*/
//! execute r2c plan //! execute r2c plan
void DRFFTWAFFArrayEngine::r2c() void DRFFTWAFFArrayEngine::r2c()
{ {
if (Mplanr2c == 0) if (Mplanr2c == 0)
{ {
this->createplanr2c();
} }
fftw_execute(Mplanr2c);
} // DRFFTWAFFArrayEngine::r2c() } // DRFFTWAFFArrayEngine::r2c()
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
...@@ -208,6 +219,31 @@ namespace fourier { ...@@ -208,6 +219,31 @@ namespace fourier {
FOURIER_assert(Mplanr2c!=0, "ERROR: creating c2r plan"); FOURIER_assert(Mplanr2c!=0, "ERROR: creating c2r plan");
} }
} // void DRFFTWAFFArrayEngine::createplanc2r() } // void DRFFTWAFFArrayEngine::createplanc2r()
/*----------------------------------------------------------------------*/
//! Return appropriate scaling factor for sampling interval dt.
DRFFTWAFFArrayEngine::Tsample
DRFFTWAFFArrayEngine::scale_series(const Tsample& dt) const
{
return(1./(Mseriesarray.size(0)*dt));
} // Tsample DRFFTWAFFArrayEngine::scale_series(const Tsample& dt) const
/*----------------------------------------------------------------------*/
//! Return appropriate scaling factor for sampling interval dt.
DRFFTWAFFArrayEngine::Tsample
DRFFTWAFFArrayEngine::scale_spectrum(const Tsample& dt) const
{
return(dt);
} // Tsample DRFFTWAFFArrayEngine::scale_spectrum(const Tsample& dt) const
/*----------------------------------------------------------------------*/
unsigned int DRFFTWAFFArrayEngine::nseries() const
{
return Mseriesarray.size(1);
} // unsigned int DRFFTWAFFArrayEngine::nseries() const
} // namespace fft } // namespace fft
......
...@@ -99,11 +99,11 @@ namespace fourier { ...@@ -99,11 +99,11 @@ namespace fourier {
//! \brief return a reference to the Fourier coefficient arrays //! \brief return a reference to the Fourier coefficient arrays
TAspectrum spectrum() const { return Mspectrumarray; } TAspectrum spectrum() const { return Mspectrumarray; }
//! \brief return the number of series in the arrays //! \brief return the number of series in the arrays
int nseries() const; unsigned int nseries() const;
//! \brief return a reference to the time series i //! \brief return a reference to the time series i
Tseries series(const int& i) const; TAseries series(const int& i) const;
//! \brief return a reference to the Fourier coefficients of series i //! \brief return a reference to the Fourier coefficients of series i
Tspectrum specturm(const int& i) const; TAspectrum specturm(const int& i) const;
private: private:
void checkconsistency(); void checkconsistency();
void createplanr2c(); void createplanr2c();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment