LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
util::LArFFTWPlan Class Reference

#include "LArFFTWPlan.h"

Public Member Functions

 LArFFTWPlan (int transformSize, const std::string &option)
 
 ~LArFFTWPlan ()
 

Public Attributes

void * fPlan
 
void * rPlan
 
void * fIn
 
void * fOut
 
void * rIn
 
void * rOut
 

Private Member Functions

unsigned int MapFFTWOption ()
 

Private Attributes

int fSize
 
int fFreqSize
 
int * fN
 
std::string fOption
 

Static Private Attributes

static std::mutex mutex_
 

Detailed Description

Definition at line 13 of file LArFFTWPlan.h.

Constructor & Destructor Documentation

util::LArFFTWPlan::LArFFTWPlan ( int  transformSize,
const std::string &  option 
)

Definition at line 6 of file LArFFTWPlan.cxx.

References fFreqSize, fIn, fN, fOut, fPlan, fSize, MapFFTWOption(), mutex_, rIn, rOut, and rPlan.

7  : fSize(transformSize), fOption(option)
8 {
9 
10  std::lock_guard<std::mutex> lock(mutex_);
11 
12  fFreqSize = fSize / 2 + 1;
13  fN = new int[1];
14  fN[0] = fSize;
15 
16  fIn = fftw_malloc(sizeof(double) * fSize);
17  fOut = fftw_malloc(sizeof(fftw_complex) * fFreqSize);
18  fPlan = (void*)fftw_plan_dft_r2c(1, fN, (double*)fIn, (fftw_complex*)fOut, MapFFTWOption());
19 
20  rIn = fftw_malloc(sizeof(fftw_complex) * fFreqSize);
21  rOut = fftw_malloc(sizeof(double) * fSize);
22  rPlan = (void*)fftw_plan_dft_c2r(1, fN, (fftw_complex*)rIn, (double*)rOut, MapFFTWOption());
23 }
std::string fOption
Definition: LArFFTWPlan.h:30
static std::mutex mutex_
Definition: LArFFTWPlan.h:26
unsigned int MapFFTWOption()
Definition: LArFFTWPlan.cxx:45
util::LArFFTWPlan::~LArFFTWPlan ( )

Definition at line 25 of file LArFFTWPlan.cxx.

References fIn, fN, fOut, fPlan, rIn, rOut, and rPlan.

26 {
27  fftw_destroy_plan((fftw_plan)fPlan);
28  fPlan = 0;
29  fftw_free(fIn);
30  fIn = 0;
31  fftw_free((fftw_complex*)fOut);
32  fOut = 0;
33 
34  fftw_destroy_plan((fftw_plan)rPlan);
35  rPlan = 0;
36  fftw_free((fftw_complex*)rIn);
37  rIn = 0;
38  fftw_free(rOut);
39  rOut = 0;
40 
41  delete[] fN;
42  fN = 0;
43 }

Member Function Documentation

unsigned int util::LArFFTWPlan::MapFFTWOption ( )
private

Definition at line 45 of file LArFFTWPlan.cxx.

References fOption.

Referenced by LArFFTWPlan().

46 {
47  std::transform(fOption.begin(), fOption.end(), fOption.begin(), ::toupper);
48  if (fOption.find("ES") != string::npos) return FFTW_ESTIMATE;
49  if (fOption.find("M") != string::npos) return FFTW_MEASURE;
50  if (fOption.find("P") != string::npos) return FFTW_PATIENT;
51  if (fOption.find("EX") != string::npos) return FFTW_EXHAUSTIVE;
52  return FFTW_ESTIMATE;
53 }
std::string fOption
Definition: LArFFTWPlan.h:30

Member Data Documentation

int util::LArFFTWPlan::fFreqSize
private

Definition at line 28 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan().

void* util::LArFFTWPlan::fIn

Definition at line 20 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan(), and ~LArFFTWPlan().

int* util::LArFFTWPlan::fN
private

Definition at line 29 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan(), and ~LArFFTWPlan().

std::string util::LArFFTWPlan::fOption
private

Definition at line 30 of file LArFFTWPlan.h.

Referenced by MapFFTWOption().

void* util::LArFFTWPlan::fOut

Definition at line 21 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan(), and ~LArFFTWPlan().

void* util::LArFFTWPlan::fPlan

Definition at line 18 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan(), and ~LArFFTWPlan().

int util::LArFFTWPlan::fSize
private

Definition at line 27 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan().

std::mutex util::LArFFTWPlan::mutex_
staticprivate

Definition at line 26 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan().

void* util::LArFFTWPlan::rIn

Definition at line 22 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan(), and ~LArFFTWPlan().

void* util::LArFFTWPlan::rOut

Definition at line 23 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan(), and ~LArFFTWPlan().

void* util::LArFFTWPlan::rPlan

Definition at line 19 of file LArFFTWPlan.h.

Referenced by LArFFTWPlan(), and ~LArFFTWPlan().


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