Automatic FFTW3 wisdom handling for map65 GUI and shmem m65 runs

This commit is contained in:
Bill Somerville
2021-05-13 12:44:32 +01:00
parent 5d097b8c2b
commit 6bd50b2444
8 changed files with 47 additions and 22 deletions
+21 -1
View File
@@ -1,3 +1,4 @@
#include <fftw3.h>
#ifdef QT5
#include <QtWidgets>
#else
@@ -8,6 +9,11 @@
#include "revision_utils.hpp"
#include "mainwindow.h"
extern "C" {
// Fortran procedures we need
void four2a_ (_Complex float *, int * nfft, int * ndim, int * isign, int * iform, int len);
}
static QtMessageHandler default_message_handler;
void my_message_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
@@ -28,5 +34,19 @@ int main(int argc, char *argv[])
a.setApplicationVersion ("3.0.0-devel");
MainWindow w;
w.show ();
return a.exec ();
auto result = a.exec ();
// clean up lazily initialized FFTW3 resources
{
int nfft {-1};
int ndim {1};
int isign {1};
int iform {1};
// free FFT plan resources
four2a_ (nullptr, &nfft, &ndim, &isign, &iform, 0);
}
fftwf_forget_wisdom ();
fftwf_cleanup ();
return result;
}