Clipper
|
FFTmap_p1: low level P1 map used for calculating FFTs. More...
#include <fftmap.h>
Public Member Functions | |
FFTmap_p1 () | |
Null constructor. | |
FFTmap_p1 (const FFTmap_p1 &other) | |
Copy constructor. | |
FFTmap_p1 (const Grid_sampling &grid_sam, const FFTtype type=Default) | |
Constructor: takes grid. | |
const FFTmap_p1 & | operator= (const FFTmap_p1 &other) |
Assignment operator. | |
void | init (const Grid_sampling &grid_sam, const FFTtype type=Default) |
initialiser: takes grid | |
void | reset () |
Reset. | |
const Grid_sampling & | grid_real () const |
Return real space grid. | |
const Grid & | grid_reci () const |
Return reciprocal space grid (i.e. half real grid + 1 section). | |
bool | uniq_reci (const Coord_grid &c) const |
Test whether a coordinate is in the valid part of the recip. grid. | |
void | fft_h_to_x (const ftype &scale) |
Transform to real space. | |
void | fft_x_to_h (const ftype &scale) |
Transform to reciprocal space. | |
std::complex< ffttype > | get_hkl (const HKL &hkl) const |
get reciprocal space data: slow form with hemisphere check | |
void | set_hkl (const HKL &hkl, const std::complex< ffttype > &f) |
set reciprocal space data: slow form with hemisphere check | |
const std::complex< ffttype > & | cplx_data (const Coord_grid &c) const |
get reciprocal space data | |
std::complex< ffttype > & | cplx_data (const Coord_grid &c) |
set reciprocal space data | |
const ffttype & | real_data (const Coord_grid &c) const |
get real space data | |
ffttype & | real_data (const Coord_grid &c) |
set real space data | |
void | debug () const |
Static Public Member Functions | |
static FFTtype & | default_type () |
set/get default optimisation type | |
Protected Types | |
enum | FFTmode { NONE, RECI, REAL, OTHER } |
Protected Member Functions | |
const FFTmap_p1 & | copy (const FFTmap_p1 &other) |
copy function | |
Protected Attributes | |
FFTmode | mode |
real or reciprocal space? | |
FFTtype | type_ |
optimisation options | |
Grid_sampling | grid_sam_ |
unit cell grid | |
Grid | grid_reci_ |
reciprocal space grid | |
Grid | grid_real_ |
real space grid | |
Grid | grid_half_ |
half grid (for marking unique) | |
Matrix< char > | req_kl |
Matrix< char > | req_uv |
reci section lookup | |
std::vector< char > | req_l |
std::vector< char > | req_u |
real section lookup | |
std::vector< ffttype > | datavec |
vector for the data | |
ffttype * | data_r |
pointer to real data | |
std::complex< ffttype > * | data_c |
pointer to complex data | |
Static Protected Attributes | |
static FFTtype | default_type_ = FFTmap_base::Estimate |
default optimisation options |
FFTmap_p1: low level P1 map used for calculating FFTs.
This is a pure real P1 map, with an extra section in reciprocal space to allow generation of the full set of resiprocal space magnitudes. Access is by Coord_grid in both spaces, and indices must be non-negative and in range. The first and last sections along the half-length direction only have half the elements stored, the contents of the other half is ignored.
clipper::FFTmap_p1::FFTmap_p1 | ( | ) |
Null constructor.
For later initialisation: see init()
clipper::FFTmap_p1::FFTmap_p1 | ( | const Grid_sampling & | grid_sam, |
const FFTtype | type = Default |
||
) |
Constructor: takes grid.
Construct an FFTmap_p1 for a given spacegroup, cell, and grid. The map values are initialised to zero.
The FFTmap_p1 is initially in neither real nor reciprocal spce, however as soon as one of the 'set' methods is called, it will be defined as in either real or reciprocal space until the next fft.
grid_sam | The grid sampling of the unit cell. |
type | Can be FFTmap_p1::Measure, FFTmap_p1::Estimate. Measure performs slow precalculation (first time only) to get faster FFT. |
References init().
void clipper::FFTmap_p1::init | ( | const Grid_sampling & | grid_sam, |
const FFTtype | type = Default |
||
) |
initialiser: takes grid
Initialise an FFTmap_p1 for a given spacegroup, cell, and grid. The map values are initialised to zero.
The FFTmap_p1 is initially in neither real nor reciprocal spce, however as soon as one of the 'set' methods is called, it will be defined as in either real or reciprocal space until the next fft.
grid_sam | The grid sampling of the unit cell. |
type | Can be FFTmap_p1::Measure, FFTmap_p1::Estimate. Measure performs slow precalculation (first time only) to get faster FFT. |
References data_c, data_r, datavec, default_type(), grid_half_, grid_real_, grid_reci_, grid_sam_, mode, clipper::Grid::nu(), clipper::Grid_sampling::nu(), clipper::Grid::nv(), clipper::Grid_sampling::nv(), clipper::Grid::nw(), clipper::Grid_sampling::nw(), clipper::Grid::size(), and type_.
Referenced by FFTmap_p1().
void clipper::FFTmap_p1::reset | ( | ) |
const Grid_sampling & clipper::FFTmap_p1::grid_real | ( | ) | const [inline] |
Return real space grid.
References grid_sam_.
Referenced by clipper::FFTmap::get_real_data(), and clipper::FFTmap::grid_sampling().
const Grid & clipper::FFTmap_p1::grid_reci | ( | ) | const [inline] |
Return reciprocal space grid (i.e. half real grid + 1 section).
The reciprocal grid is half-length, plus one section, in the w direction. The remainder of the grid may be generated by Hermitian symmetry. When accessing data with reci_data, the coordinate should always be in this grid. Some points in this grid are redundent, see FFTmap_p1::uniq_reci().
References grid_reci_.
bool clipper::FFTmap_p1::uniq_reci | ( | const Coord_grid & | c | ) | const [inline] |
Test whether a coordinate is in the valid part of the recip. grid.
The w=0 and w=nw/2 sections contain some duplicated points related by a cetre of symmetry. On of these is considered to be significant, and the other redundent. This function returns 'true' for the significant point.
c | The coordinate to test. Must be in grid_reci(). |
References grid_half_, clipper::Grid::nu(), clipper::Grid::nv(), clipper::Grid::nw(), clipper::Coord_grid::u(), clipper::Coord_grid::v(), and clipper::Coord_grid::w().
void clipper::FFTmap_p1::fft_h_to_x | ( | const ftype & | scale | ) |
Transform to real space.
The data is transformed from recirocal to real space. If the FFTmap_p1 is already in real space, no action is taken.
Scale | factor to apply (normally 1/cell_volume). |
References data_c, grid_reci_, grid_sam_, clipper::Mutex::lock(), mode, clipper::FFTmap_base::mutex, clipper::Grid_sampling::nu(), clipper::Grid_sampling::nv(), clipper::Grid_sampling::nw(), clipper::Grid::size(), type_, and clipper::Mutex::unlock().
Referenced by clipper::Xmap< T >::fft_from().
void clipper::FFTmap_p1::fft_x_to_h | ( | const ftype & | scale | ) |
Transform to reciprocal space.
The data is transformed from real to recirocal space. If the FFTmap_p1 is already in reciproal space, no action is taken.
Scale | factor to apply (in addition to 1/N_grid factor) (normally cell_volume). |
References data_c, data_r, grid_reci_, grid_sam_, clipper::Mutex::lock(), mode, clipper::FFTmap_base::mutex, clipper::Grid_sampling::nu(), clipper::Grid_sampling::nv(), clipper::Grid_sampling::nw(), clipper::Grid::size(), clipper::Grid_sampling::size(), type_, and clipper::Mutex::unlock().
Referenced by clipper::Xmap< T >::fft_to().
std::complex< ffttype > clipper::FFTmap_p1::get_hkl | ( | const HKL & | hkl | ) | const |
get reciprocal space data: slow form with hemisphere check
This form returns the data for an HKL. The HKL is converted into a grid reference, and the data, or if necessary the conjugate of the opposite, is returned.
hkl | The HKL of the data. |
References cplx_data(), grid_reci_, grid_sam_, clipper::Grid_sampling::nu(), clipper::Grid_sampling::nv(), clipper::Grid_sampling::nw(), clipper::Grid::nw(), clipper::Coord_grid::u(), clipper::Coord_grid::unit(), clipper::Coord_grid::v(), and clipper::Coord_grid::w().
Referenced by clipper::Xmap< T >::fft_to(), and clipper::FFTmap::get_recip_data().
void clipper::FFTmap_p1::set_hkl | ( | const HKL & | hkl, |
const std::complex< ffttype > & | f | ||
) |
set reciprocal space data: slow form with hemisphere check
This form returns the data for an HKL. The HKL is converted into a grid reference, and the data, and if necessary the conjugate of the opposite, is set.
hkl | The HKL of the data. |
References cplx_data(), grid_reci_, grid_sam_, clipper::Grid::nw(), clipper::Coord_grid::unit(), and clipper::Coord_grid::w().
Referenced by clipper::Xmap< T >::fft_from(), and clipper::FFTmap::set_recip_data().