45 #ifndef CLIPPER_HKL_DATA
46 #define CLIPPER_HKL_DATA
61 Key(
const Spgr_descr& spgr_descr,
const Cell& cell_descr,
const HKL_sampling& hkl_sam ) : spgr_descr_(spgr_descr), cell_descr_(cell_descr), hkl_sampling_(hkl_sam) {}
62 const Spgr_descr& spgr_descr()
const {
return spgr_descr_; }
63 const Cell_descr& cell_descr()
const {
return cell_descr_; }
64 const HKL_sampling& hkl_sampling()
const {
return hkl_sampling_; }
72 bool matches(
const Key& hkl_data_cachekey )
const;
180 virtual void update() = 0;
184 virtual bool missing(
const int& index)
const = 0;
186 virtual void set_null(
const int& index) = 0;
199 HKL_reference_index
first()
const;
203 HKL_reference_index&
next_data( HKL_reference_index& ih )
const;
209 const Cell* parent_cell;
210 bool cell_matches_parent;
259 bool missing(
const int& index)
const {
return list[index].missing(); }
260 void set_null(
const int& index) { list[index].set_null(); }
264 { T datum;
get_data( hkl, datum ); datum.data_export( array ); }
266 { T datum; datum.data_import( array );
set_data( hkl, datum ); }
272 {
return list[i.index()]; }
275 {
return list[i.index()]; }
287 const T&
operator[] (
const int& index)
const {
return list[index]; }
355 init( hkl_info, cell );
364 init( spacegroup, cell, hkl_sampling );
408 if ( parent_hkl_info != NULL ) {
409 T null; null.set_null();
410 list.resize( parent_hkl_info->num_reflections(), null );
420 T null; null.set_null();
421 for (
int i = 0; i < list.size(); i++ )
422 if ( mask.
missing(i) ) list[i] = null;
432 if ( ih.index() < 0 ) { T null; null.set_null();
return null; }
433 T data = list[ih.index()];
434 if ( ih.
friedel() ) data.friedel();
447 if ( ih.index() < 0 ) { data.set_null();
return false; }
448 data = list[ih.index()];
449 if ( ih.
friedel() ) data.friedel();
462 if ( ih.index() < 0 )
return false;
463 T& ldata = list[ih.index()];
466 if ( ih.
friedel() ) ldata.friedel();
477 int index, sym;
bool friedel;
479 index = parent_hkl_info->index_of( parent_hkl_info->
481 if ( index < 0 ) { T null; null.set_null();
return null; }
482 T data = list[index];
483 if (friedel) data.friedel();
484 data.shift_phase( -hkl.
sym_phase_shift( parent_hkl_info->spacegroup().symop(sym) ) );
496 int index, sym;
bool friedel;
498 index = parent_hkl_info->index_of( parent_hkl_info->
500 if ( index < 0 ) { data.set_null();
return false; }
502 if (friedel) data.friedel();
503 data.shift_phase( -hkl.
sym_phase_shift(parent_hkl_info->spacegroup().symop(sym)) );
515 int index, sym;
bool friedel;
516 index = parent_hkl_info->index_of( parent_hkl_info->
518 if ( index < 0 ) {
return false; }
519 T& ldata = list[index];
521 ldata.shift_phase( hkl.
sym_phase_shift(parent_hkl_info->spacegroup().symop(sym)) );
522 if (friedel) ldata.friedel();
536 if ( parent_hkl_info == NULL ) {
539 if ( parent_hkl_info != other.parent_hkl_info )
551 for (
int i = 0; i < list.size(); i++ ) list[i] = value;
558 HKL_data_base::debug();
559 std::cout <<
"Size " << list.size() <<
"\n";
HKL_info::HKL_reference_coord HKL_reference_coord
HKL HKL_reference_index: see HKL_info.
Definition: hkl_data.h:143
bool missing() const
return true if data is missing
HKL_data_base()
null constructor
Definition: hkl_data.cpp:75
HKL_data()
null constructor
Definition: hkl_data.h:238
void mask(const HKL_data_base &mask)
Definition: hkl_data.h:418
HKL_data<>
Definition: hkl_data.h:234
void compute(const HKL_data< S > &src, const C &op)
Unary computation: fill this data list by computation from another.
Definition: hkl_data.h:304
virtual String type() const =0
get data type (a list of names corresponding to the im/export values)
void init(const Spacegroup &spacegroup, const Cell &cell, const Resolution &resolution, const bool &generate=false)
initialiser: Takes spacegroup, cell, and resolution
Definition: hkl_info.cpp:112
static String data_names()
return names of data elements in this type
virtual ~HKL_data_base()
destructor
Definition: hkl_data.h:222
Fatal message (level = 9)
Definition: clipper_message.h:129
const HKL & hkl() const
return the current HKL
Definition: hkl_info.h:196
void init(const HKL_info &hkl_info, const Cell &cell)
initialiser: from parent hkl_info and cell
Definition: hkl_data.h:379
bool is_null() const
test if object has been initialised
Definition: hkl_data.cpp:126
static int data_size()
return number of data elements in this type
virtual void data_import(const HKL &hkl, const xtype array[])=0
conversion from array (for I/O)
const HKL_info & base_hkl_info() const
get the parent HKL_info object
Definition: hkl_data.h:157
void data_export(xtype array[]) const
conversion to array (for I/O)
void data_import(const HKL &hkl, const xtype array[])
conversion from array (for I/O)
Definition: hkl_data.h:265
bool set_data(const HKL_info::HKL_reference_coord &ih, const T &data)
set data by HKL_reference_coord (returns false if no equivalent hkl)
Definition: hkl_data.h:460
HKL sampling of reciprocal space.
Definition: coords.h:552
const Spacegroup & spacegroup() const
get the spacegroup
Definition: hkl_info.h:80
virtual void init(const HKL_info &hkl_info, const Cell &cell)
initialiser: from parent hkl_info and cell
Definition: hkl_data.cpp:86
Range< ftype > invresolsq_range() const
get resolution limits of the list (based on true cell and missing data)
Definition: hkl_data.cpp:149
const int & sym() const
get current symop number
Definition: hkl_info.h:198
HKL reference with index-like behaviour.
Definition: hkl_info.h:151
void data_import(const xtype array[])
conversion from array (for I/O)
cell description (automatically converts to radians)
Definition: cell.h:91
Resolution in angstroms.
Definition: coords.h:68
Definition: hkl_data.h:58
spacegroup description
Definition: spacegroup.h:73
virtual String data_names() const =0
return names of data elements in this type
ObjectCache< HKL_data_cacheobj >::Reference cacheref
object cache ref
Definition: hkl_data.h:213
ftype64 ftype
ftype definition for floating point representation
Definition: clipper_precision.h:58
HKL_reference_index & next_data(HKL_reference_index &ih) const
increment HKL_reference_index to next non-missing data
Definition: hkl_data.cpp:181
HKL list container and tree root.
Definition: hkl_info.h:62
const Cell & base_cell() const
get the parent cell
Definition: hkl_data.h:159
ObjectCache reference class.
Definition: clipper_memory.h:154
const Cell & cell() const
get the cell
Definition: hkl_info.h:78
virtual void update()=0
update: synchornize info with parent HKL_info
Cell object.
Definition: cell.h:121
Spacegroup object.
Definition: spacegroup.h:172
virtual void set_null(const int &index)=0
set data entry in the list to its null value
const HKL_sampling & hkl_sampling() const
[CLIPPER2] get HKL_sampling
Definition: hkl_data.h:168
HKL find_sym(const HKL &rfl, int &sym, bool &friedel) const
find symop no and friedel to bring an HKL into ASU
Definition: hkl_info.cpp:236
HKL_reference_index first_data() const
return HKL_reference_index pointing to first non-missing data
Definition: hkl_data.cpp:175
int num_obs() const
get number of observations in this list (based on missing data)
Definition: hkl_data.cpp:160
std::vector< HKL > hkl
the reflection list
Definition: hkl_info.h:255
virtual bool missing(const int &index) const =0
check if a data entry in the list is marked as 'missing'
const HKL_info & hkl_info() const
[CLIPPER2] get HKL_info object
Definition: hkl_data.h:170
String extension with simple parsing methods.
Definition: clipper_types.h:64
ftype invresolsq(const int &index) const
get resolution by reflection index (based on true cell)
Definition: hkl_data.cpp:139
bool missing(const int &index) const
check if a data entry in the list is marked as 'missing'
Definition: hkl_data.h:259
HKL_reference_index first() const
return HKL_reference_index pointing to first reflection
Definition: hkl_info.h:243
virtual void data_export(const HKL &hkl, xtype array[]) const =0
conversion to array (for I/O)
const Cell & cell() const
[CLIPPER2] get cell
Definition: hkl_data.h:164
void data_export(const HKL &hkl, xtype array[]) const
conversion to array (for I/O)
Definition: hkl_data.h:263
const Spacegroup & spacegroup() const
[CLIPPER2] get spacegroup
Definition: hkl_data.h:162
HKL_data< T > & operator=(const HKL_data< T > &other)
assignment operator: copies the data from another list
Definition: hkl_data.h:534
String type() const
get data type (a list of names corresponding to the im/export values)
Definition: hkl_data.h:258
const Resolution & resolution() const
[CLIPPER2] get resolution
Definition: hkl_data.h:166
Mutex class: used for locking and unlocking shared resources.
Definition: clipper_thread.h:64
HKL_info::HKL_reference_index HKL_reference_index
Basic HKL_reference_index: see HKL_info.
Definition: hkl_data.h:141
void set_null(const int &index)
set data entry in the list to its null value
Definition: hkl_data.h:260
static void message(const T &message)
pass a message
Definition: clipper_message.h:93
void compute(const HKL_data< S1 > &src1, const HKL_data< S2 > &src2, const C &op)
Binary computation: fill this data list by computation from another.
Definition: hkl_data.h:307
static Mutex mutex
thread safety
Definition: hkl_data.h:74
virtual int data_size() const =0
return number of data elements in this type
void friedel()
apply Friedel transformation to the data
int data_size() const
return number of data elements in this type
Definition: hkl_data.h:261
const T & operator[](const HKL_info::HKL_reference_index &i) const
get data by reflection HKL_reference_index
Definition: hkl_data.h:271
ftype64 xtype
xtype definition for import/export of data
Definition: clipper_precision.h:61
void compute(const C &op)
Basic computation: fill this data list by function call.
Definition: hkl_data.h:301
Definition: hkl_data.h:55
HKL reference with coord-like behaviour.
Definition: hkl_info.h:183
String data_names() const
return names of data elements in this type
Definition: hkl_data.h:262
ftype invresolsq() const
return the inv resol sq for the reflection (assumes index valid)
Definition: hkl_info.h:131
HKL_reference_index first() const
return HKL_reference_index pointing to first reflection
Definition: hkl_data.cpp:170
void set_null()
initialise to 'missing' (all elements are set to null)
virtual void mask(const HKL_data_base &mask)=0
mask the data by marking any data missing in 'mask' as missing
Reflection data type objects.
Definition: hkl_data.h:103
static String type()
return the name of this data type
void shift_phase(const ftype &dphi)
apply phase shift to the data
const bool & friedel() const
get current friedel flag
Definition: hkl_info.h:200
ftype sym_phase_shift(const Symop &op) const
return symmetry phase shift for this HKL under op
Definition: coords.h:707
HKL_data_base.
Definition: hkl_data.h:136
void update()
update: synchornize info with parent HKL_info
Definition: hkl_data.h:406
reflection 'Miller' index
Definition: coords.h:145
bool get_data(const HKL_info::HKL_reference_coord &ih, T &data) const
get data by HKL_reference_coord (returns false if no equivalent hkl)
Definition: hkl_data.h:445
const HKL_sampling & hkl_sampling() const
[CLIPPER2] get HKL_sampling
Definition: hkl_info.h:82