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;
184 virtual bool missing(
const int& index)
const = 0;
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(); }
265 if ( index != -1 ) datum = list[index];
267 datum.data_export( array ); }
269 { T datum; datum.data_import( array );
set_data( hkl, datum ); }
275 {
return list[i.index()]; }
278 {
return list[i.index()]; }
290 const T&
operator[] (
const int& index)
const {
return list[index]; }
411 if ( parent_hkl_info != NULL ) {
412 T
null;
null.set_null();
413 list.resize( parent_hkl_info->num_reflections(),
null );
423 T
null;
null.set_null();
424 for (
unsigned int i = 0; i < list.size(); i++ )
425 if ( mask.
missing(i) ) list[i] =
null;
435 if ( ih.index() < 0 ) { T
null;
null.set_null();
return null; }
436 T data = list[ih.index()];
437 if ( ih.
friedel() ) data.friedel();
450 if ( ih.index() < 0 ) { data.set_null();
return false; }
451 data = list[ih.index()];
452 if ( ih.
friedel() ) data.friedel();
465 if ( ih.index() < 0 )
return false;
466 T& ldata = list[ih.index()];
469 if ( ih.
friedel() ) ldata.friedel();
480 int index, sym;
bool friedel;
482 index = parent_hkl_info->index_of( parent_hkl_info->
484 if ( index < 0 ) { T
null;
null.set_null();
return null; }
485 T data = list[index];
486 if (friedel) data.friedel();
487 data.shift_phase( -
hkl.sym_phase_shift( parent_hkl_info->spacegroup().symop(sym) ) );
499 int index, sym;
bool friedel;
501 index = parent_hkl_info->index_of( parent_hkl_info->
503 if ( index < 0 ) { data.set_null();
return false; }
505 if (friedel) data.friedel();
506 data.shift_phase( -
hkl.sym_phase_shift(parent_hkl_info->spacegroup().symop(sym)) );
518 int index, sym;
bool friedel;
519 index = parent_hkl_info->index_of( parent_hkl_info->
521 if ( index < 0 ) {
return false; }
522 T& ldata = list[index];
524 ldata.shift_phase(
hkl.sym_phase_shift(parent_hkl_info->spacegroup().symop(sym)) );
525 if (friedel) ldata.friedel();
539 if ( parent_hkl_info == NULL ) {
542 if ( parent_hkl_info != other.parent_hkl_info )
554 for (
unsigned int i = 0; i < list.size(); i++ ) list[i] = value;
561 HKL_data_base::debug();
562 std::cout <<
"Size " << list.size() <<
"\n";
int index_of(const HKL &rfl) const
reflection index from hkl
Definition: hkl_info.h:100
const Spacegroup & spacegroup() const
get the spacegroup
Definition: hkl_info.h:80
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:463
const int & sym() const
get current symop number
Definition: hkl_info.h:198
int data_size() const
return number of data elements in this type
Definition: hkl_data.h:261
virtual void data_import(const HKL &hkl, const xtype array[])=0
conversion from array (for I/O)
void init(const Spacegroup &spacegroup, const Cell &cell, const HKL_sampling &hkl_sampling)
[CLIPPER2] initialiser: from spacegroup, cell, and HKL_sampling
Definition: hkl_data.h:392
const Resolution & resolution() const
[CLIPPER2] get resolution
Definition: hkl_data.h:166
HKL_data<>
Definition: hkl_data.h:235
void data_export(const HKL &hkl, xtype array[]) const
conversion to array (for I/O)
Definition: hkl_data.h:263
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:310
HKL_data_base.
Definition: hkl_data.h:137
const Cell & cell() const
[CLIPPER2] get cell
Definition: hkl_data.h:164
HKL_data()
null constructor
Definition: hkl_data.h:238
virtual void data_export(const HKL &hkl, xtype array[]) const =0
conversion to array (for I/O)
void update()
update: synchornize info with parent HKL_info
Definition: hkl_data.h:409
bool set_data(const HKL &hkl, const T &data)
set data by hkl (returns false if no equivalent hkl)
Definition: hkl_data.h:516
HKL_data_base()
null constructor
Definition: hkl_data.cpp:75
ftype64 ftype
ftype definition for floating point representation
Definition: clipper_precision.h:58
Fatal message (level = 9)
Definition: clipper_message.h:129
HKL list container and tree root.
Definition: hkl_info.h:63
void shift_phase(const ftype &dphi)
apply phase shift to the data
ftype invresolsq() const
return the inv resol sq for the reflection (assumes index valid)
Definition: hkl_info.h:131
Resolution in angstroms.
Definition: coords.h:69
Spacegroup object.
Definition: spacegroup.h:173
void data_export(xtype array[]) const
conversion to array (for I/O)
Cell object.
Definition: cell.h:122
bool missing(const int &index) const
check if a data entry in the list is marked as 'missing'
Definition: hkl_data.h:259
virtual ~HKL_data_base()
destructor
Definition: hkl_data.h:222
ftype sym_phase_shift(const Symop &op) const
return symmetry phase shift for this HKL under op
Definition: coords.h:707
void data_import(const HKL &hkl, const xtype array[])
conversion from array (for I/O)
Definition: hkl_data.h:268
HKL_info::HKL_reference_coord HKL_reference_coord
HKL HKL_reference_index: see HKL_info.
Definition: hkl_data.h:143
bool get_data(const HKL &hkl, T &data) const
get data by hkl (returns false if no equivalent hkl)
Definition: hkl_data.h:497
HKL reference with index-like behaviour.
Definition: hkl_info.h:152
void compute(const C &op)
Basic computation: fill this data list by function call.
Definition: hkl_data.h:304
ftype invresolsq(const int &index) const
get resolution by reflection index (based on true cell)
Definition: hkl_data.cpp:139
static void message(const T &message)
pass a message
Definition: clipper_message.h:93
String data_names() const
return names of data elements in this type
Definition: hkl_data.h:262
static String data_names()
return names of data elements in this type
const T & operator[](const HKL_info::HKL_reference_index &i) const
get data by reflection HKL_reference_index
Definition: hkl_data.h:274
reflection 'Miller' index
Definition: coords.h:146
static int data_size()
return number of data elements in this type
const HKL & hkl() const
return the current HKL
Definition: hkl_info.h:196
const Cell & base_cell() const
get the parent cell
Definition: hkl_data.h:159
cell description (automatically converts to radians)
Definition: cell.h:92
String type() const
get data type (a list of names corresponding to the im/export values)
Definition: hkl_data.h:258
HKL_data(const Spacegroup &spacegroup, const Cell &cell, const HKL_sampling &hkl_sampling)
[CLIPPER2] constructor: from spacegroup, cell and hkl_sampling
Definition: hkl_data.h:365
Reflection data type objects.
Definition: hkl_data.h:104
HKL_data(const HKL_info &hkl_info)
constructor: from parent hkl_info
Definition: hkl_data.h:348
const bool & friedel() const
get current friedel flag
Definition: hkl_info.h:200
void mask(const HKL_data_base &mask)
Definition: hkl_data.h:421
virtual void mask(const HKL_data_base &mask)=0
mask the data by marking any data missing in 'mask' as missing
void compute(const HKL_data< S > &src, const C &op)
Unary computation: fill this data list by computation from another.
Definition: hkl_data.h:307
virtual int data_size() const =0
return number of data elements in this type
Range< ftype > invresolsq_range() const
get resolution limits of the list (based on true cell and missing data)
Definition: hkl_data.cpp:149
const Cell & cell() const
get the cell
Definition: hkl_info.h:78
HKL_reference_index & next_data(HKL_reference_index &ih) const
increment HKL_reference_index to next non-missing data
Definition: hkl_data.cpp:181
Definition: hkl_data.h:56
HKL_reference_index first() const
return HKL_reference_index pointing to first reflection
Definition: hkl_data.cpp:170
const HKL_info & base_hkl_info() const
get the parent HKL_info object
Definition: hkl_data.h:157
virtual void set_null(const int &index)=0
set data entry in the list to its null value
HKL reference with coord-like behaviour.
Definition: hkl_info.h:184
bool missing() const
return true if data is missing
spacegroup description
Definition: spacegroup.h:74
String extension with simple parsing methods.
Definition: clipper_types.h:65
virtual void init(const HKL_info &hkl_info, const Cell &cell)
initialiser: from parent hkl_info and cell
Definition: hkl_data.cpp:86
void init(const HKL_info &hkl_info, const Cell &cell)
initialiser: from parent hkl_info and cell
Definition: hkl_data.h:382
ObjectCache reference class.
Definition: clipper_memory.h:155
static String type()
return the name of this data type
void set_null()
initialise to 'missing' (all elements are set to null)
void init(const HKL_data_base &hkl_data)
[CLIPPER2] initialiser: from another HKL_data object
Definition: hkl_data.h:402
const Spacegroup & spacegroup() const
[CLIPPER2] get spacegroup
Definition: hkl_data.h:162
ftype64 xtype
xtype definition for import/export of data
Definition: clipper_precision.h:61
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
virtual String type() const =0
get data type (a list of names corresponding to the im/export values)
virtual void update()=0
update: synchornize info with parent HKL_info
std::vector< HKL > hkl
the reflection list
Definition: hkl_info.h:255
HKL_data< T > & operator=(const HKL_data< T > &other)
assignment operator: copies the data from another list
Definition: hkl_data.h:537
virtual String data_names() const =0
return names of data elements in this type
virtual bool missing(const int &index) const =0
check if a data entry in the list is marked as 'missing'
HKL_data(const HKL_info &hkl_info, const Cell &cell)
constructor: from parent hkl_info and cell
Definition: hkl_data.h:356
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
const HKL_info & hkl_info() const
[CLIPPER2] get HKL_info object
Definition: hkl_data.h:170
ObjectCache< HKL_data_cacheobj >::Reference cacheref
object cache ref
Definition: hkl_data.h:213
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:448
HKL_reference_index first_data() const
return HKL_reference_index pointing to first non-missing data
Definition: hkl_data.cpp:175
static Mutex mutex
thread safety
Definition: hkl_data.h:74
void friedel()
apply Friedel transformation to the data
Definition: hkl_data.h:59
bool is_null() const
test if object has been initialised
Definition: hkl_data.cpp:126
const HKL_sampling & hkl_sampling() const
[CLIPPER2] get HKL_sampling
Definition: hkl_data.h:168
HKL sampling of reciprocal space.
Definition: coords.h:553
void data_import(const xtype array[])
conversion from array (for I/O)
HKL_reference_index first() const
return HKL_reference_index pointing to first reflection
Definition: hkl_info.h:243
int num_obs() const
get number of observations in this list (based on missing data)
Definition: hkl_data.cpp:160
void set_null(const int &index)
set data entry in the list to its null value
Definition: hkl_data.h:260
const HKL_sampling & hkl_sampling() const
[CLIPPER2] get HKL_sampling
Definition: hkl_info.h:82
HKL_data(const HKL_data_base &hkl_data)
[CLIPPER2] constructor: from another HKL_data object
Definition: hkl_data.h:374
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:238