00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef CLIPPER_FFTMAP_SPARSE
00046 #define CLIPPER_FFTMAP_SPARSE
00047
00048
00049 #include "coords.h"
00050
00051 #include <complex>
00052
00053
00054 namespace clipper
00055 {
00056
00057 typedef float ffttype;
00058
00060 class FFTmap_sparse_p1_base {
00061 public:
00062 enum FFTtype { Measure, Estimate, Default };
00063
00064 void init( const Grid_sampling& grid_sam, const FFTtype type = Default );
00066 ~FFTmap_sparse_p1_base();
00068 const Grid_sampling& grid_real() const { return grid_real_; }
00070 const Grid& grid_reci() const { return grid_reci_; }
00071
00073 static FFTtype& default_type() { return default_type_; }
00074 protected:
00076 ffttype* map_uv( const int& u, const int& v );
00078 std::complex<ffttype>* map_kl( const int& k, const int& l );
00079
00080 Grid_sampling grid_real_;
00081 Grid grid_reci_;
00082 FFTtype type_;
00083
00084 Array2d<std::complex<ffttype>*> row_kl;
00085 Array2d<ffttype*> row_uv;
00086
00087 static FFTtype default_type_;
00088 };
00089
00091
00096 class FFTmap_sparse_p1_hx : public FFTmap_sparse_p1_base
00097 {
00098 public:
00100 FFTmap_sparse_p1_hx();
00102 FFTmap_sparse_p1_hx( const Grid_sampling& grid_sam, const FFTtype type = Default );
00103
00104
00105
00106
00108 void set_hkl( const HKL& hkl, const std::complex<ffttype>& f );
00110 std::complex<ffttype>& cplx_data( const Coord_grid& uvw )
00111 { return map_kl( uvw.v(), uvw.w() )[ uvw.u() ]; }
00113 void require_real_data( const Coord_grid& uvw )
00114 { map_uv( uvw.u(), uvw.v() ); }
00116 const ffttype& real_data( const Coord_grid& uvw ) const
00117 { return row_uv( uvw.u(), uvw.v() )[ uvw.w() ]; }
00118
00120 void fft_h_to_x( const ftype& scale );
00121 };
00122
00124
00129 class FFTmap_sparse_p1_xh : public FFTmap_sparse_p1_base
00130 {
00131 public:
00133 FFTmap_sparse_p1_xh();
00135 FFTmap_sparse_p1_xh( const Grid_sampling& grid_sam, const FFTtype type = Default );
00136
00137
00138
00139
00141 ffttype& real_data( const Coord_grid& uvw )
00142 { return map_uv( uvw.u(), uvw.v() )[ uvw.w() ]; }
00144 void require_hkl( const HKL& hkl );
00146 const std::complex<ffttype> get_hkl( const HKL& hkl ) const;
00148 void require_cplx_data( const Coord_grid& hkl )
00149 { map_kl( hkl.v(), hkl.w() ); }
00151 const std::complex<ffttype>& cplx_data( const Coord_grid& hkl ) const
00152 { return row_kl( hkl.v(), hkl.w() )[ hkl.u() ]; }
00153
00155 void fft_x_to_h( const ftype& scale );
00156 };
00157
00158
00159 }
00160
00161 #endif