SIRIUS 7.5.0
Electronic structure library and applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
sirius::fft::Grid Class Reference

Helper class to create FFT grids of given sizes and compute indices in space- and frequency domains. More...

#include <fft3d_grid.hpp>

Inherits std::array< int, 3 >.

Public Member Functions

 Grid ()
 Default constructor. More...
 
 Grid (std::array< int, 3 > initial_dims__)
 Create FFT grid with initial dimensions. More...
 
const std::pair< int, int > & limits (int idim__) const
 Limits of a given dimension. More...
 
int num_points () const
 Total size of the FFT grid. More...
 
template<int d>
int coord_by_freq (int i__) const
 Get coordinate in range [0, N_d) by the frequency index. More...
 
std::array< int, 3 > coord_by_freq (int i0__, int i1__, int i2__) const
 Return {x, y, z} coordinates by frequency indices. More...
 
template<int d>
int freq_by_coord (int x__) const
 Get frequency by coordinate. More...
 
std::array< int, 3 > freq_by_coord (int x__, int y__, int z__) const
 Return 3d vector of frequencies corresponding to {x, y, z} position in the FFT buffer. More...
 
int index_by_coord (int x__, int y__, int z__) const
 Linear index inside FFT buffer by grid coordinates. More...
 
int index_by_freq (int i0__, int i1__, int i2__) const
 Return linear index of a plane-wave harmonic with fractional coordinates (i0, i1, i2) inside FFT buffer. More...
 

Private Member Functions

int find_grid_size (int n)
 Find smallest optimal grid size starting from n. More...
 
void find_grid_size (std::array< int, 3 > initial_dims__)
 Find grid sizes and limits for all three dimensions. More...
 

Private Attributes

std::array< std::pair< int, int >, 3 > grid_limits_
 Reciprocal space range. More...
 

Detailed Description

Helper class to create FFT grids of given sizes and compute indices in space- and frequency domains.

Definition at line 37 of file fft3d_grid.hpp.

Constructor & Destructor Documentation

◆ Grid() [1/2]

sirius::fft::Grid::Grid ( )
inline

Default constructor.

Definition at line 91 of file fft3d_grid.hpp.

◆ Grid() [2/2]

sirius::fft::Grid::Grid ( std::array< int, 3 >  initial_dims__)
inline

Create FFT grid with initial dimensions.

Definition at line 96 of file fft3d_grid.hpp.

Member Function Documentation

◆ find_grid_size() [1/2]

int sirius::fft::Grid::find_grid_size ( int  n)
inlineprivate

Find smallest optimal grid size starting from n.

Definition at line 44 of file fft3d_grid.hpp.

◆ find_grid_size() [2/2]

void sirius::fft::Grid::find_grid_size ( std::array< int, 3 >  initial_dims__)
inlineprivate

Find grid sizes and limits for all three dimensions.

Definition at line 62 of file fft3d_grid.hpp.

◆ limits()

const std::pair< int, int > & sirius::fft::Grid::limits ( int  idim__) const
inline

Limits of a given dimension.

Definition at line 102 of file fft3d_grid.hpp.

◆ num_points()

int sirius::fft::Grid::num_points ( ) const
inline

Total size of the FFT grid.

Definition at line 109 of file fft3d_grid.hpp.

◆ coord_by_freq() [1/2]

template<int d>
int sirius::fft::Grid::coord_by_freq ( int  i__) const
inline

Get coordinate in range [0, N_d) by the frequency index.

Definition at line 116 of file fft3d_grid.hpp.

◆ coord_by_freq() [2/2]

std::array< int, 3 > sirius::fft::Grid::coord_by_freq ( int  i0__,
int  i1__,
int  i2__ 
) const
inline

Return {x, y, z} coordinates by frequency indices.

Definition at line 125 of file fft3d_grid.hpp.

◆ freq_by_coord() [1/2]

template<int d>
int sirius::fft::Grid::freq_by_coord ( int  x__) const
inline

Get frequency by coordinate.

Definition at line 132 of file fft3d_grid.hpp.

◆ freq_by_coord() [2/2]

std::array< int, 3 > sirius::fft::Grid::freq_by_coord ( int  x__,
int  y__,
int  z__ 
) const
inline

Return 3d vector of frequencies corresponding to {x, y, z} position in the FFT buffer.

Definition at line 141 of file fft3d_grid.hpp.

◆ index_by_coord()

int sirius::fft::Grid::index_by_coord ( int  x__,
int  y__,
int  z__ 
) const
inline

Linear index inside FFT buffer by grid coordinates.

Definition at line 147 of file fft3d_grid.hpp.

◆ index_by_freq()

int sirius::fft::Grid::index_by_freq ( int  i0__,
int  i1__,
int  i2__ 
) const
inline

Return linear index of a plane-wave harmonic with fractional coordinates (i0, i1, i2) inside FFT buffer.

Definition at line 153 of file fft3d_grid.hpp.

Member Data Documentation

◆ grid_limits_

std::array<std::pair<int, int>, 3> sirius::fft::Grid::grid_limits_
private

Reciprocal space range.

Definition at line 41 of file fft3d_grid.hpp.


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