1#ifndef MSPASS_ALGORITHMS_DECONVOLUTION_GSLFFTRESOURCES_H
2#define MSPASS_ALGORITHMS_DECONVOLUTION_GSLFFTRESOURCES_H
4#include "mspass/utility/MsPASSError.h"
5#include <gsl/gsl_fft_complex.h>
10namespace mspass::algorithms::deconvolution::detail {
13 void operator()(gsl_fft_complex_wavetable *p)
const noexcept {
15 gsl_fft_complex_wavetable_free(p);
20 void operator()(gsl_fft_complex_workspace *p)
const noexcept {
22 gsl_fft_complex_workspace_free(p);
26using GSLFFTWavetablePtr =
27 std::unique_ptr<gsl_fft_complex_wavetable, GSLFFTWavetableDeleter>;
28using GSLFFTWorkspacePtr =
29 std::unique_ptr<gsl_fft_complex_workspace, GSLFFTWorkspaceDeleter>;
32 GSLFFTWavetablePtr wavetable;
33 GSLFFTWorkspacePtr workspace;
40 const std::string &caller) {
43 caller +
": fft length must be positive",
44 mspass::utility::ErrorSeverity::Fatal);
45 GSLFFTWavetablePtr wavetable(gsl_fft_complex_wavetable_alloc(nfft));
47 throw std::bad_alloc();
48 GSLFFTWorkspacePtr workspace(gsl_fft_complex_workspace_alloc(nfft));
50 throw std::bad_alloc();
51 return {std::move(wavetable), std::move(workspace)};
Base class for error object thrown by MsPASS library routines.
Definition MsPASSError.h:38
Definition GSLFFTResources.h:31
Definition GSLFFTResources.h:12
Definition GSLFFTResources.h:19