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_CONTAINER_HKL
00046 #define CLIPPER_CONTAINER_HKL
00047
00048
00049 #include "container_types.h"
00050 #include "hkl_data.h"
00051
00052
00053 namespace clipper
00054 {
00055
00056 extern const HKL_info NullHKL_info;
00057
00058
00060
00063 class CHKL_info : public Container, public HKL_info
00064 {
00065 public:
00067 CHKL_info( const String name = "",
00068 const Spacegroup& spacegroup = NullSpacegroup,
00069 const Cell& cell = NullCell,
00070 const Resolution& resolution = NullResolution,
00071 const bool& generate = false );
00073 CHKL_info( Container& parent, const String name = "",
00074 const bool& generate = false );
00076 void init( const Spacegroup& spacegroup, const Cell& cell,
00077 const Resolution& resolution, const bool& generate = false );
00078
00080 void generate_hkl_list();
00082 void update();
00083 private:
00084 bool generate_;
00085 };
00086
00087
00089
00091 template<class T> class CHKL_data : public Container, public HKL_data<T>
00092 {
00093 public:
00095 CHKL_data() {}
00097 CHKL_data( Container& parent, const String name = "" );
00099 void init( const HKL_info& hkl_info, const Cell& cell );
00101 void init( const Spacegroup& spacegroup, const Cell& cell, const HKL_sampling& hkl_sampling ) { clipper::Message::message( clipper::Message_fatal("CHKL_data deprecated") ); }
00103 void update();
00104
00106 HKL_data<T>& operator =( const HKL_data<T>& other )
00107 { return ( dynamic_cast<HKL_data<T>&>(*this) = other ); }
00109 HKL_data<T>& operator =( const T& value )
00110 { return ( dynamic_cast<HKL_data<T>&>(*this) = value ); }
00111 };
00112
00113
00114
00115
00116
00124 template<class T> CHKL_data<T>::CHKL_data( Container& parent, const String name ) : Container( parent, name )
00125 {
00126 init( NullHKL_info, NullCell );
00127 }
00128
00129
00135 template<class T> void CHKL_data<T>::init( const HKL_info& hkl_info, const Cell& cell )
00136 {
00137
00138 const HKL_info* hp = &hkl_info;
00139 const Cell* cp = &cell;
00140
00141 if ( hp->is_null() ) hp = parent_of_type_ptr<const HKL_info>();
00142 if ( cp->is_null() ) cp = parent_of_type_ptr<const Cell>();
00143
00144 if ( hp != NULL ) {
00145
00146 if ( cp == NULL ) cp = &(hp->cell());
00147
00148 if ( !hp->is_null() && !cp->is_null() )
00149 HKL_data<T>::init( *hp, *cp );
00150 }
00151 Container::update();
00152 }
00153
00154
00160 template<class T> void CHKL_data<T>::update()
00161 {
00162 if ( HKL_data_base::is_null() )
00163 init( NullHKL_info, NullCell );
00164 else
00165 Container::update();
00166 HKL_data<T>::update();
00167 }
00168
00169
00170 }
00171
00172 #endif