BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Convolve::Workspace Class Reference

Description

Workspace for Fourier convolution.

Workspace contains input (source and kernel), intermediate and output arrays to run convolution via fft; 'source' it is our signal, 'kernel' it is our resolution function. Sizes of input arrays are adjusted; output arrays are alocated via fftw3 allocation for maximum performance.

Definition at line 87 of file Convolve.h.

Public Member Functions

 Workspace ()=default
 
 ~Workspace ()
 
void clear ()
 

Private Attributes

double * dst_fft {nullptr}
 result of product of FFT(source) and FFT(kernel) More...
 
int h_dst {0}
 
int h_fftw {0}
 
int h_kernel {0}
 
int h_offset {0}
 
int h_src {0}
 
double * in_kernel {nullptr}
 adjusted input 'kernel' array More...
 
double * in_src {nullptr}
 adjusted input 'source' array More...
 
double * out_kernel {nullptr}
 result of Fourier transformation of kernel More...
 
double * out_src {nullptr}
 result of Fourier transformation of source More...
 
fftw_plan p_back {nullptr}
 
fftw_plan p_forw_kernel {nullptr}
 
fftw_plan p_forw_src {nullptr}
 
int w_dst {0}
 
int w_fftw {0}
 
int w_kernel {0}
 
int w_offset {0}
 
int w_src {0}
 

Friends

class Convolve
 

Constructor & Destructor Documentation

◆ Workspace()

Convolve::Workspace::Workspace ( )
default

◆ ~Workspace()

Convolve::Workspace::~Workspace ( )

Definition at line 29 of file Convolve.cpp.

30 {
31  clear();
32 }

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ clear()

void Convolve::Workspace::clear ( )

Definition at line 34 of file Convolve.cpp.

35 {
36  h_src = 0;
37  w_src = 0;
38  h_kernel = 0;
39  w_kernel = 0;
40 
41  delete[] in_src;
42  in_src = nullptr;
43 
44  if (out_src)
45  fftw_free((fftw_complex*)out_src);
46  out_src = nullptr;
47 
48 
49  delete[] in_kernel;
50  in_kernel = nullptr;
51 
52  if (out_kernel)
53  fftw_free((fftw_complex*)out_kernel);
54  out_kernel = nullptr;
55 
56 
57  delete[] dst_fft;
58  dst_fft = nullptr;
59 
60  // if(dst) delete[] dst;
61  // dst=0;
62 
63  h_offset = 0;
64  w_offset = 0;
65 
66  if (p_forw_src != nullptr)
67  fftw_destroy_plan(p_forw_src);
68  if (p_forw_kernel != nullptr)
69  fftw_destroy_plan(p_forw_kernel);
70  if (p_back != nullptr)
71  fftw_destroy_plan(p_back);
72 
73  fftw_cleanup();
74 }
double * out_src
result of Fourier transformation of source
Definition: Convolve.h:102
fftw_plan p_back
Definition: Convolve.h:113
double * in_src
adjusted input 'source' array
Definition: Convolve.h:100
double * in_kernel
adjusted input 'kernel' array
Definition: Convolve.h:104
double * dst_fft
result of product of FFT(source) and FFT(kernel)
Definition: Convolve.h:108
fftw_plan p_forw_src
Definition: Convolve.h:111
fftw_plan p_forw_kernel
Definition: Convolve.h:112
double * out_kernel
result of Fourier transformation of kernel
Definition: Convolve.h:106

Referenced by ~Workspace(), and Convolve::init().

Friends And Related Function Documentation

◆ Convolve

friend class Convolve
friend

Definition at line 92 of file Convolve.h.

Member Data Documentation

◆ dst_fft

double* Convolve::Workspace::dst_fft {nullptr}
private

result of product of FFT(source) and FFT(kernel)

Definition at line 108 of file Convolve.h.

Referenced by Convolve::fftconvolve(), Convolve::fftw_circular_convolution(), and Convolve::init().

◆ h_dst

int Convolve::Workspace::h_dst {0}
private

Definition at line 109 of file Convolve.h.

Referenced by Convolve::fftconvolve(), and Convolve::init().

◆ h_fftw

int Convolve::Workspace::h_fftw {0}
private

◆ h_kernel

int Convolve::Workspace::h_kernel {0}
private

◆ h_offset

int Convolve::Workspace::h_offset {0}
private

Definition at line 110 of file Convolve.h.

Referenced by Convolve::fftconvolve(), and Convolve::init().

◆ h_src

int Convolve::Workspace::h_src {0}
private

Definition at line 95 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ in_kernel

double* Convolve::Workspace::in_kernel {nullptr}
private

adjusted input 'kernel' array

Definition at line 104 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ in_src

double* Convolve::Workspace::in_src {nullptr}
private

adjusted input 'source' array

Definition at line 100 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ out_kernel

double* Convolve::Workspace::out_kernel {nullptr}
private

result of Fourier transformation of kernel

Definition at line 106 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ out_src

double* Convolve::Workspace::out_src {nullptr}
private

result of Fourier transformation of source

Definition at line 102 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ p_back

fftw_plan Convolve::Workspace::p_back {nullptr}
private

Definition at line 113 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ p_forw_kernel

fftw_plan Convolve::Workspace::p_forw_kernel {nullptr}
private

Definition at line 112 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ p_forw_src

fftw_plan Convolve::Workspace::p_forw_src {nullptr}
private

Definition at line 111 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().

◆ w_dst

int Convolve::Workspace::w_dst {0}
private

Definition at line 109 of file Convolve.h.

Referenced by Convolve::fftconvolve(), and Convolve::init().

◆ w_fftw

int Convolve::Workspace::w_fftw {0}
private

◆ w_kernel

int Convolve::Workspace::w_kernel {0}
private

◆ w_offset

int Convolve::Workspace::w_offset {0}
private

Definition at line 110 of file Convolve.h.

Referenced by Convolve::fftconvolve(), and Convolve::init().

◆ w_src

int Convolve::Workspace::w_src {0}
private

Definition at line 95 of file Convolve.h.

Referenced by Convolve::fftw_circular_convolution(), and Convolve::init().


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