Diana Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
QFFTW3Wisdom Class Reference

Singleton class for handling FFTW3 wisdom. More...

Public Member Functions

bool ExportWisdomToFile (const char *outFile)
 Save the accumulated wisdom to file. More...
 
bool ImportWisdomFromFile (const char *inFile)
 Load wisdom from file. More...
 
bool ImportSystemWisdom ()
 Load wisdom from a system file. More...
 
bool ForgetWisdom (void)
 Forget any accumulated wisdom. More...
 

Static Public Member Functions

static QFFTW3WisdomGet ()
 Access to the singleton class. More...
 

Protected Member Functions

 QFFTW3Wisdom ()
 Default ctor. More...
 
 ~QFFTW3Wisdom ()
 Default dtor. More...
 

Protected Attributes

bool fLocalWisdom
 Local wisdom used. More...
 
bool fSavingWisdom
 Saving wisdom. More...
 
std::string fWisdomFile
 The file from which the wisdom was loaded. More...
 
std::string fLocalFile
 The file to save the wisdom. More...
 

Static Protected Attributes

static QFFTW3WisdomfInstance
 Pointer to the singleton instance. More...
 

Detailed Description

Singleton class for handling FFTW3 wisdom.

Author
J. Ouellet

Whenever FFTW3 performs an FFT of an array of size N, it creates a 'plan'. Several plans are tested and the fastest is selected. This plan is stored in internal memory as FFTW3 'widsdom'. Thus whenever a new plan of size N needs to be created, the fastest is already known and does not need to be tested. This lasts for the duration of the program.

This wisdom can be stored to and loaded from a file so that the testing does not need to be performed again in new programs.

This class handles the storing and loading of this wisdom.

The purpose of its being a singleton class is to allow for more complex behavior, like loading wisdom only at the first call, and saving it back to a file automatically upon the program's termination. Though this can be disabled.

Definition at line 35 of file QFFTW3.hh.

Constructor & Destructor Documentation

◆ QFFTW3Wisdom()

QFFTW3Wisdom::QFFTW3Wisdom ( )
protected

Default ctor.

Protected ctor attempts to load system wisdom, then searches likely directories for wisdom files.

Definition at line 17 of file QFFTW3.cc.

References ImportSystemWisdom().

◆ ~QFFTW3Wisdom()

QFFTW3Wisdom::~QFFTW3Wisdom ( )
protected

Default dtor.

Protected dtor attempts to save wisdom.

Definition at line 33 of file QFFTW3.cc.

References ExportWisdomToFile(), fLocalWisdom, fSavingWisdom, and fWisdomFile.

Member Function Documentation

◆ ExportWisdomToFile()

bool QFFTW3Wisdom::ExportWisdomToFile ( const char *  outFile)

Save the accumulated wisdom to file.

Export ALL accumulated wisdom to a file.

Definition at line 37 of file QFFTW3.cc.

Referenced by ~QFFTW3Wisdom().

◆ ForgetWisdom()

bool QFFTW3Wisdom::ForgetWisdom ( void  )

Forget any accumulated wisdom.

Discard any wisdom accumulated by the program. Frees any allocated memory.

Definition at line 66 of file QFFTW3.cc.

◆ Get()

static QFFTW3Wisdom* QFFTW3Wisdom::Get ( )
static

Access to the singleton class.

Referenced by QFFTW3::QFFTW3().

◆ ImportSystemWisdom()

bool QFFTW3Wisdom::ImportSystemWisdom ( )

Load wisdom from a system file.

Import the wisdom saved in a system file (e.g. /etc/fftw/wisdom). This replaces ALL wisdom accumulated by the program.

Definition at line 59 of file QFFTW3.cc.

Referenced by QFFTW3Wisdom().

◆ ImportWisdomFromFile()

bool QFFTW3Wisdom::ImportWisdomFromFile ( const char *  inFile)

Load wisdom from file.

Import the wisdom saved in the file. This replaces ALL wisdom accumulated by the program.

Definition at line 47 of file QFFTW3.cc.

Member Data Documentation

◆ fInstance

QFFTW3Wisdom* QFFTW3Wisdom::fInstance
staticprotected

Pointer to the singleton instance.

Definition at line 92 of file QFFTW3.hh.

◆ fLocalFile

std::string QFFTW3Wisdom::fLocalFile
protected

The file to save the wisdom.

Definition at line 118 of file QFFTW3.hh.

◆ fLocalWisdom

bool QFFTW3Wisdom::fLocalWisdom
protected

Local wisdom used.

This flags that we are using some local wisdom and that if fSaving is set, that we can save to the local file.

Definition at line 100 of file QFFTW3.hh.

Referenced by ~QFFTW3Wisdom().

◆ fSavingWisdom

bool QFFTW3Wisdom::fSavingWisdom
protected

Saving wisdom.

After the program accumulates wisdom, the new wisdom can be saved to a local file.

Definition at line 108 of file QFFTW3.hh.

Referenced by ~QFFTW3Wisdom().

◆ fWisdomFile

std::string QFFTW3Wisdom::fWisdomFile
protected

The file from which the wisdom was loaded.

Definition at line 113 of file QFFTW3.hh.

Referenced by ~QFFTW3Wisdom().


The documentation for this class was generated from the following files: