Commit c8c182e3 authored by ale's avatar ale

store fftw wisdom in ~

parent c6360473
......@@ -25,6 +25,14 @@
using std::cerr;
using std::endl;
static std::string fftw_wisdom_path() {
static std::string path;
if (path == "") {
path = std::string(getenv("HOME")) + "/.imms_fftw_wisdom";
}
return path;
}
FFTWisdom::FFTWisdom() : shouldexport(true)
{
// Grab FFTW wisdom, if available, on instantiation.
......@@ -34,14 +42,14 @@ FFTWisdom::FFTWisdom() : shouldexport(true)
// in a global, private data structure managed internally by FFTW";
// http://www.fftw.org/fftw3_doc/Words-of-Wisdom_002dSaving-Plans.html#Words-of-Wisdom_002dSaving-Plans
FILE *wisdom = fopen(get_imms_root(".fftw_wisdom").c_str(), "r");
if (wisdom)
{
shouldexport = !fftw_import_wisdom_from_file(wisdom);
fclose(wisdom);
}
else
cerr << "analyzer: Growing wiser. This may take a while." << endl;
FILE *wisdom = fopen(fftw_wisdom_path().c_str(), "r");
if (wisdom)
{
shouldexport = !fftw_import_wisdom_from_file(wisdom);
fclose(wisdom);
}
else
cerr << "analyzer: Growing wiser. This may take a while." << endl;
}
......@@ -50,7 +58,7 @@ FFTWisdom::~FFTWisdom()
if (!shouldexport)
return;
FILE *wisdom = fopen(get_imms_root(".fftw_wisdom").c_str(), "w");
FILE *wisdom = fopen(fftw_wisdom_path().c_str(), "w");
if (wisdom)
{
fftw_export_wisdom_to_file(wisdom);
......
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