diff --git a/Device/Resolution/ConvolutionDetectorResolution.cpp b/Device/Resolution/ConvolutionDetectorResolution.cpp index a8b69dcda46731fdb9327d4e9c53a5560529a352..2efebdda96ec7397a4f130fe634c4438fa9324d4 100644 --- a/Device/Resolution/ConvolutionDetectorResolution.cpp +++ b/Device/Resolution/ConvolutionDetectorResolution.cpp @@ -88,7 +88,7 @@ void ConvolutionDetectorResolution::apply1dConvolution(Datafield* df) const kernel.push_back(getIntegratedPDF1d(axis.binCenter(index) - mid_value, step_size)); // Calculate convolution std::vector<double> result; - Convolve().fftconvolve(df->flatVector(), kernel, result); + Convolve().fftconvolve1D(df->flatVector(), kernel, result); // Truncate negative values that can arise because of finite precision of Fourier Transform for (double& e : result) e = std::max(0.0, e); @@ -127,7 +127,7 @@ void ConvolutionDetectorResolution::apply2dConvolution(Datafield* df) const // Calculate convolution std::vector<std::vector<double>> result; - Convolve().fftconvolve(df->values2D(), kernel, result); + Convolve().fftconvolve2D(df->values2D(), kernel, result); df->setVector2D(result); } diff --git a/Device/Resolution/Convolve.cpp b/Device/Resolution/Convolve.cpp index 031124e4de0797b1cb66addf3929de6c4fd6ccbc..14c1fd581098f8ab8d07c9346d0406c2e9905d7c 100644 --- a/Device/Resolution/Convolve.cpp +++ b/Device/Resolution/Convolve.cpp @@ -93,10 +93,7 @@ void Convolve::Workspace::clear() fftw_cleanup(); } -/* ************************************************************************* */ -// convolution in 2d -/* ************************************************************************* */ -void Convolve::fftconvolve(const double2d_t& source, const double2d_t& kernel, double2d_t& result) +void Convolve::fftconvolve2D(const double2d_t& source, const double2d_t& kernel, double2d_t& result) { // set default convolution mode, if not defined if (m_mode == FFTW_UNDEFINED) @@ -128,10 +125,7 @@ void Convolve::fftconvolve(const double2d_t& source, const double2d_t& kernel, d } } -/* ************************************************************************* */ -// convolution in 1d -/* ************************************************************************* */ -void Convolve::fftconvolve(const double1d_t& source, const double1d_t& kernel, double1d_t& result) +void Convolve::fftconvolve1D(const double1d_t& source, const double1d_t& kernel, double1d_t& result) { // we simply create 2d arrays with length of first dimension equal to 1, and call 2d convolution double2d_t source2d, kernel2d; @@ -139,14 +133,11 @@ void Convolve::fftconvolve(const double1d_t& source, const double1d_t& kernel, d kernel2d.push_back(kernel); double2d_t result2d; - fftconvolve(source2d, kernel2d, result2d); + fftconvolve2D(source2d, kernel2d, result2d); ASSERT(result2d.size() == 1); result = result2d[0]; } -/* ************************************************************************* */ -// initialise input and output arrays for fast Fourier transformation -/* ************************************************************************* */ void Convolve::init(int h_src, int w_src, int h_kernel, int w_kernel) { ASSERT(h_src); @@ -244,10 +235,6 @@ void Convolve::init(int h_src, int w_src, int h_kernel, int w_kernel) ASSERT(ws.p_back); } -/* ************************************************************************* */ -// initialise input and output arrays for fast Fourier transformation -/* ************************************************************************* */ - void Convolve::fftw_circular_convolution(const double2d_t& src, const double2d_t& kernel) { ASSERT(ws.h_fftw > 0); diff --git a/Device/Resolution/Convolve.h b/Device/Resolution/Convolve.h index b9e6861cd82472b450043fbf8e22d6732af7da50..64e3476876a6ad443db533b910f5642344191be7 100644 --- a/Device/Resolution/Convolve.h +++ b/Device/Resolution/Convolve.h @@ -54,10 +54,10 @@ public: }; //! convolution in 1D - void fftconvolve(const double1d_t& source, const double1d_t& kernel, double1d_t& result); + void fftconvolve1D(const double1d_t& source, const double1d_t& kernel, double1d_t& result); //! convolution in 2D - void fftconvolve(const double2d_t& source, const double2d_t& kernel, double2d_t& result); + void fftconvolve2D(const double2d_t& source, const double2d_t& kernel, double2d_t& result); //! prepare arrays for 2D convolution of given vectors void init(int h_src, int w_src, int h_kernel, int w_kernel);