ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ModulePW::FFT_Bundle Class Reference

#include <fft_bundle.h>

Collaboration diagram for ModulePW::FFT_Bundle:

Public Member Functions

 FFT_Bundle ()
 
 ~FFT_Bundle ()
 
 FFT_Bundle (std::string device_in, std::string precision_in)
 Constructor with device and precision.
 
void setfft (std::string device_in, std::string precision_in)
 Set device and precision.
 
void initfft (int nx_in, int ny_in, int nz_in, int lixy_in, int rixy_in, int ns_in, int nplane_in, int nproc_in, bool gamma_only_in, bool xprime_in=true, bool mpifft_in=false)
 Initialize the fft parameters.
 
void initfftmode (int fft_mode_in)
 Initialize the fft mode.
 
void setupFFT ()
 
void clearFFT ()
 
void clear ()
 
void resource_handler (const int flag) const
 
template<typename FPTYPE >
FPTYPE * get_rspace_data () const
 Get the real space data.
 
template<typename FPTYPE >
std::complex< FPTYPE > * get_auxr_data () const
 Get the auxr data.
 
template<typename FPTYPE >
std::complex< FPTYPE > * get_auxg_data () const
 Get the auxg data.
 
template<typename FPTYPE >
std::complex< FPTYPE > * get_auxr_3d_data () const
 Get the auxr 3d data.
 
template<typename FPTYPE >
void fftzfor (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Forward fft in z direction.
 
template<typename FPTYPE >
void fftxyfor (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Forward fft in x-y direction.
 
template<typename FPTYPE >
void fftzbac (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Backward fft in z direction.
 
template<typename FPTYPE >
void fftxybac (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Backward fft in x-y direction.
 
template<typename FPTYPE >
void fftxyr2c (FPTYPE *in, std::complex< FPTYPE > *out) const
 Real to complex fft in x-y direction.
 
template<typename FPTYPE >
void fftxyc2r (std::complex< FPTYPE > *in, FPTYPE *out) const
 Complex to real fft in x-y direction.
 
template<typename FPTYPE >
void fft3D_forward (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 
template<typename FPTYPE >
void fft3D_backward (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 
template<>
void fftxyfor (std::complex< float > *in, std::complex< float > *out) const
 
template<>
void fftxyfor (std::complex< double > *in, std::complex< double > *out) const
 
template<>
void fftzfor (std::complex< float > *in, std::complex< float > *out) const
 
template<>
void fftzfor (std::complex< double > *in, std::complex< double > *out) const
 
template<>
void fftxybac (std::complex< float > *in, std::complex< float > *out) const
 
template<>
void fftxybac (std::complex< double > *in, std::complex< double > *out) const
 
template<>
void fftzbac (std::complex< float > *in, std::complex< float > *out) const
 
template<>
void fftzbac (std::complex< double > *in, std::complex< double > *out) const
 
template<>
void fftxyr2c (float *in, std::complex< float > *out) const
 
template<>
void fftxyr2c (double *in, std::complex< double > *out) const
 
template<>
void fftxyc2r (std::complex< float > *in, float *out) const
 
template<>
void fftxyc2r (std::complex< double > *in, double *out) const
 
template<>
void fft3D_forward (std::complex< float > *in, std::complex< float > *out) const
 
template<>
void fft3D_forward (std::complex< double > *in, std::complex< double > *out) const
 
template<>
void fft3D_backward (std::complex< float > *in, std::complex< float > *out) const
 
template<>
void fft3D_backward (std::complex< double > *in, std::complex< double > *out) const
 
template<>
float * get_rspace_data () const
 
template<>
double * get_rspace_data () const
 
template<>
std::complex< float > * get_auxr_data () const
 
template<>
std::complex< double > * get_auxr_data () const
 
template<>
std::complex< float > * get_auxg_data () const
 
template<>
std::complex< double > * get_auxg_data () const
 
template<>
std::complex< float > * get_auxr_3d_data () const
 
template<>
std::complex< double > * get_auxr_3d_data () const
 

Private Attributes

int fft_mode = 0
 
bool float_flag = false
 
bool double_flag = false
 
std::shared_ptr< FFT_BASE< float > > fft_float = nullptr
 
std::shared_ptr< FFT_BASE< double > > fft_double = nullptr
 
std::string device = "cpu"
 
std::string precision = "double"
 

Constructor & Destructor Documentation

◆ FFT_Bundle() [1/2]

ModulePW::FFT_Bundle::FFT_Bundle ( )
inline

◆ ~FFT_Bundle()

ModulePW::FFT_Bundle::~FFT_Bundle ( )
Here is the call graph for this function:

◆ FFT_Bundle() [2/2]

ModulePW::FFT_Bundle::FFT_Bundle ( std::string  device_in,
std::string  precision_in 
)
inline

Constructor with device and precision.

Parameters
device_indevice type, cpu or gpu.
precision_inprecision type, single or double.

the function will check the input device and precision, and set the device and precision.

Member Function Documentation

◆ clear()

void ModulePW::FFT_Bundle::clear ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearFFT()

void ModulePW::FFT_Bundle::clearFFT ( )
Here is the caller graph for this function:

◆ fft3D_backward() [1/3]

template<>
void ModulePW::FFT_Bundle::fft3D_backward ( std::complex< double > *  in,
std::complex< double > *  out 
) const

◆ fft3D_backward() [2/3]

template<>
void ModulePW::FFT_Bundle::fft3D_backward ( std::complex< float > *  in,
std::complex< float > *  out 
) const

◆ fft3D_backward() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fft3D_backward ( std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out 
) const

◆ fft3D_forward() [1/3]

template<>
void ModulePW::FFT_Bundle::fft3D_forward ( std::complex< double > *  in,
std::complex< double > *  out 
) const

◆ fft3D_forward() [2/3]

template<>
void ModulePW::FFT_Bundle::fft3D_forward ( std::complex< float > *  in,
std::complex< float > *  out 
) const

◆ fft3D_forward() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fft3D_forward ( std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out 
) const

◆ fftxybac() [1/3]

template<>
void ModulePW::FFT_Bundle::fftxybac ( std::complex< double > *  in,
std::complex< double > *  out 
) const

◆ fftxybac() [2/3]

template<>
void ModulePW::FFT_Bundle::fftxybac ( std::complex< float > *  in,
std::complex< float > *  out 
) const

◆ fftxybac() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fftxybac ( std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out 
) const

Backward fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the backward fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxybac in the accurate fft class.

Here is the caller graph for this function:

◆ fftxyc2r() [1/3]

template<>
void ModulePW::FFT_Bundle::fftxyc2r ( std::complex< double > *  in,
double *  out 
) const

◆ fftxyc2r() [2/3]

template<>
void ModulePW::FFT_Bundle::fftxyc2r ( std::complex< float > *  in,
float *  out 
) const

◆ fftxyc2r() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fftxyc2r ( std::complex< FPTYPE > *  in,
FPTYPE *  out 
) const

Complex to real fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the complex to real fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxyc2r in the accurate fft class.

Here is the caller graph for this function:

◆ fftxyfor() [1/3]

template<>
void ModulePW::FFT_Bundle::fftxyfor ( std::complex< double > *  in,
std::complex< double > *  out 
) const

◆ fftxyfor() [2/3]

template<>
void ModulePW::FFT_Bundle::fftxyfor ( std::complex< float > *  in,
std::complex< float > *  out 
) const

◆ fftxyfor() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fftxyfor ( std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out 
) const

Forward fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the forward fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxyfor in the accurate fft class.

Here is the caller graph for this function:

◆ fftxyr2c() [1/3]

template<>
void ModulePW::FFT_Bundle::fftxyr2c ( double *  in,
std::complex< double > *  out 
) const

◆ fftxyr2c() [2/3]

template<>
void ModulePW::FFT_Bundle::fftxyr2c ( float *  in,
std::complex< float > *  out 
) const

◆ fftxyr2c() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fftxyr2c ( FPTYPE *  in,
std::complex< FPTYPE > *  out 
) const

Real to complex fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the real to complex fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxyr2c in the accurate fft class.

Here is the caller graph for this function:

◆ fftzbac() [1/3]

template<>
void ModulePW::FFT_Bundle::fftzbac ( std::complex< double > *  in,
std::complex< double > *  out 
) const

◆ fftzbac() [2/3]

template<>
void ModulePW::FFT_Bundle::fftzbac ( std::complex< float > *  in,
std::complex< float > *  out 
) const

◆ fftzbac() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fftzbac ( std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out 
) const

Backward fft in z direction.

Parameters
ininput data.
outoutput data.

the function will do the backward many fft in z direction, which is used in the cpu-like fft.As an interface, the function will call the fftzbac in the accurate fft class.

Here is the caller graph for this function:

◆ fftzfor() [1/3]

template<>
void ModulePW::FFT_Bundle::fftzfor ( std::complex< double > *  in,
std::complex< double > *  out 
) const

◆ fftzfor() [2/3]

template<>
void ModulePW::FFT_Bundle::fftzfor ( std::complex< float > *  in,
std::complex< float > *  out 
) const

◆ fftzfor() [3/3]

template<typename FPTYPE >
void ModulePW::FFT_Bundle::fftzfor ( std::complex< FPTYPE > *  in,
std::complex< FPTYPE > *  out 
) const

Forward fft in z direction.

Parameters
ininput data.
outoutput data.

The function will do the forward many fft in z direction, As an interface, the function will call the fftzfor in the accurate fft class. which is used in the cpu-like fft.

Here is the caller graph for this function:

◆ get_auxg_data() [1/3]

template<>
std::complex< float > * ModulePW::FFT_Bundle::get_auxg_data ( ) const

◆ get_auxg_data() [2/3]

template<>
std::complex< double > * ModulePW::FFT_Bundle::get_auxg_data ( ) const

◆ get_auxg_data() [3/3]

template<typename FPTYPE >
std::complex< FPTYPE > * ModulePW::FFT_Bundle::get_auxg_data ( ) const

Get the auxg data.

Returns
std::complex<FPTYPE>* the auxg data.

the function will return the auxg data, which is used in the cpu-like fft.

Here is the caller graph for this function:

◆ get_auxr_3d_data() [1/3]

template<>
std::complex< float > * ModulePW::FFT_Bundle::get_auxr_3d_data ( ) const

◆ get_auxr_3d_data() [2/3]

template<>
std::complex< double > * ModulePW::FFT_Bundle::get_auxr_3d_data ( ) const

◆ get_auxr_3d_data() [3/3]

template<typename FPTYPE >
std::complex< FPTYPE > * ModulePW::FFT_Bundle::get_auxr_3d_data ( ) const

Get the auxr 3d data.

Returns
std::complex<FPTYPE>* the auxr 3d data.

the function will return the auxr 3d data, which is used in the gpu-like fft.

◆ get_auxr_data() [1/3]

template<>
std::complex< float > * ModulePW::FFT_Bundle::get_auxr_data ( ) const

◆ get_auxr_data() [2/3]

template<>
std::complex< double > * ModulePW::FFT_Bundle::get_auxr_data ( ) const

◆ get_auxr_data() [3/3]

template<typename FPTYPE >
std::complex< FPTYPE > * ModulePW::FFT_Bundle::get_auxr_data ( ) const

Get the auxr data.

Returns
std::complex<FPTYPE>* the auxr data.

the function will return the auxr data, which is used in the cpu-like fft.

Here is the caller graph for this function:

◆ get_rspace_data() [1/3]

template<>
float * ModulePW::FFT_Bundle::get_rspace_data ( ) const

◆ get_rspace_data() [2/3]

template<>
double * ModulePW::FFT_Bundle::get_rspace_data ( ) const

◆ get_rspace_data() [3/3]

template<typename FPTYPE >
FPTYPE * ModulePW::FFT_Bundle::get_rspace_data ( ) const

Get the real space data.

Returns
FPTYPE* the real space data.

the function will return the real space data, which is used in the cpu-like fft.

Here is the caller graph for this function:

◆ initfft()

void ModulePW::FFT_Bundle::initfft ( int  nx_in,
int  ny_in,
int  nz_in,
int  lixy_in,
int  rixy_in,
int  ns_in,
int  nplane_in,
int  nproc_in,
bool  gamma_only_in,
bool  xprime_in = true,
bool  mpifft_in = false 
)

Initialize the fft parameters.

Parameters
nx_innumber of grid points in x direction.
ny_innumber of grid points in y direction.
nz_innumber of grid points in z direction.
lixy_inthe position of the left boundary in the x-y plane.
rixy_inthe position of the right boundary in the x-y plane.
ns_innumber of stick whcih is used in the Z direction.
nplane_innumber of x-y planes.
nproc_innumber of processors.
gamma_only_inwhether only gamma point is used.
xprime_inwhether xprime is used.

the function will initialize the many-fft parameters Wheatley in cpu or gpu device.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initfftmode()

void ModulePW::FFT_Bundle::initfftmode ( int  fft_mode_in)
inline

Initialize the fft mode.

Parameters
fft_mode_infft mode.

the function will initialize the fft mode.

Here is the caller graph for this function:

◆ resource_handler()

void ModulePW::FFT_Bundle::resource_handler ( const int  flag) const
Here is the caller graph for this function:

◆ setfft()

void ModulePW::FFT_Bundle::setfft ( std::string  device_in,
std::string  precision_in 
)

Set device and precision.

Parameters
device_indevice type, cpu or gpu.
precision_inprecision type, single or double.

the function will check the input device and precision, and set the device and precision.

Here is the caller graph for this function:

◆ setupFFT()

void ModulePW::FFT_Bundle::setupFFT ( )
Here is the caller graph for this function:

Member Data Documentation

◆ device

std::string ModulePW::FFT_Bundle::device = "cpu"
private

◆ double_flag

bool ModulePW::FFT_Bundle::double_flag = false
private

◆ fft_double

std::shared_ptr<FFT_BASE<double> > ModulePW::FFT_Bundle::fft_double = nullptr
private

◆ fft_float

std::shared_ptr<FFT_BASE<float> > ModulePW::FFT_Bundle::fft_float = nullptr
private

◆ fft_mode

int ModulePW::FFT_Bundle::fft_mode = 0
private

◆ float_flag

bool ModulePW::FFT_Bundle::float_flag = false
private

◆ precision

std::string ModulePW::FFT_Bundle::precision = "double"
private

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