From: Erik M. <em...@us...> - 2005-11-11 00:28:53
|
Update of /cvsroot/cctbx/cctbx/include/cctbx/maptbx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7547/include/cctbx/maptbx Modified Files: basic_map.h generic_grid.h Log Message: basic_map now holds a reference to the unit_cell and also exposes the all() method of the accessor in the underlying data. Index: basic_map.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/maptbx/basic_map.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** basic_map.h 5 Oct 2005 19:41:37 -0000 1.5 --- basic_map.h 11 Nov 2005 00:28:42 -0000 1.6 *************** *** 40,49 **** typedef std::vector<grid_type> grid_list_type; typedef std::vector<frac_type> frac_list_type; ! typedef af::tiny<FloatType,2> weight_pair_type; ! typedef af::tiny<weight_pair_type,3> weight_pairs_type; ! // typedef std::vector<FloatType> weight_pair_type; ! // typedef std::vector<weight_pair_type> weight_pairs_type; typedef basic_mapper<void,FloatType,IntType> basic_mapper; ! typedef af::tiny<grid_type,2> grid_pair_type; typedef af::ref<FloatType, af::flex_grid<> > flex_grid_ref; --- 40,47 ---- typedef std::vector<grid_type> grid_list_type; typedef std::vector<frac_type> frac_list_type; ! typedef af::tiny<FloatType,2> weight_pair_type; ! typedef af::tiny<weight_pair_type,3> weight_pairs_type; typedef basic_mapper<void,FloatType,IntType> basic_mapper; ! typedef af::tiny<grid_type,2> grid_pair_type; typedef af::ref<FloatType, af::flex_grid<> > flex_grid_ref; *************** *** 53,56 **** --- 51,58 ---- typedef af::const_ref<FloatType, c_grid_3 > const_c_grid_ref; + typedef cctbx::uctbx::unit_cell tbx_unit_cell; + + typedef cctbx::maptbx::unit_cell unit_cell_tag; + basic_map ( asu const&, *************** *** 60,87 **** tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of ) : out_of_handle_(h_out_of) { this->set_grid_handle(data,space_group,fasu,extents); this->rebuild_transformers(extents,matrix); } basic_map ( ! unit_cell const&, af::versa<FloatType, af::flex_grid<> > const& data, tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of ) : out_of_handle_(h_out_of) { this->set_grid_handle(data); this->rebuild_transformers(extents,matrix); } basic_map ( ! unit_cell const&, af::versa<FloatType, af::c_grid_padded<dimension_3> > const& data, tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of ) : out_of_handle_(h_out_of) { this->set_grid_handle(data); this->rebuild_transformers(extents,matrix); } basic_map ( --- 62,95 ---- tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of, ! tbx_unit_cell const& unitcell ) : out_of_handle_(h_out_of) { this->set_grid_handle(data,space_group,fasu,extents); this->rebuild_transformers(extents,matrix); + this->unit_cell_ = unitcell; } basic_map ( ! unit_cell_tag const&, af::versa<FloatType, af::flex_grid<> > const& data, tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of, ! tbx_unit_cell const& unitcell ) : out_of_handle_(h_out_of) { this->set_grid_handle(data); this->rebuild_transformers(extents,matrix); + this->unit_cell_ = unitcell; } basic_map ( ! unit_cell_tag const&, af::versa<FloatType, af::c_grid_padded<dimension_3> > const& data, tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of, ! tbx_unit_cell const& unitcell ) : out_of_handle_(h_out_of) { this->set_grid_handle(data); this->rebuild_transformers(extents,matrix); + this->unit_cell_ = unitcell; } basic_map ( *************** *** 90,97 **** tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of ) : out_of_handle_(h_out_of) { this->set_grid_handle(data,extents); this->rebuild_transformers(extents,matrix); } basic_map ( basic_map const& bm ) { --- 98,107 ---- tin3_type const& extents, mat3_type const& matrix, ! out_of_handle_type const& h_out_of, ! tbx_unit_cell const& unitcell ) : out_of_handle_(h_out_of) { this->set_grid_handle(data,extents); this->rebuild_transformers(extents,matrix); + this->unit_cell_ = unitcell; } basic_map ( basic_map const& bm ) { *************** *** 99,107 **** --- 109,121 ---- this->out_of_handle_ = bm.out_of_handle_; this->rebuild_transformers(bm.extents_,bm.matrix_); + this->unit_cell_ = bm.unit_cell_; } basic_map& operator = ( basic_map const& bm ) { + if ( this == &bm ) + return *this; this->grid_handle_ = bm.grid_handle_; this->out_of_handle_ = bm.out_of_handle_; this->rebuild_transformers(bm.extents_,bm.matrix_); + this->unit_cell_ = bm.unit_cell_; return *this; } *************** *** 125,128 **** --- 139,145 ---- return this->grid_handle_->focus(); } + af::tiny<IntType,dimension_3> all () const { + return this->grid_handle_->all(); + } FloatType grid_value ( grid_point<IntType> const& coordinate ) const { // does not remap, check, etc. etc. *************** *** 336,344 **** } void set_grid_handle ( af::versa<FloatType,af::flex_grid<> > const& data ) { ! this->grid_handle_ = generic_grid<unit_cell,FloatType,IntType>(data); } void set_grid_handle ( af::versa<FloatType, af::c_grid_padded<dimension_3> > const& data ) { ! this->grid_handle_ = generic_grid<unit_cell,FloatType,IntType>(data); } void set_grid_handle ( --- 353,361 ---- } void set_grid_handle ( af::versa<FloatType,af::flex_grid<> > const& data ) { ! this->grid_handle_ = generic_grid<unit_cell_tag,FloatType,IntType>(data); } void set_grid_handle ( af::versa<FloatType, af::c_grid_padded<dimension_3> > const& data ) { ! this->grid_handle_ = generic_grid<unit_cell_tag,FloatType,IntType>(data); } void set_grid_handle ( *************** *** 354,368 **** this->out_of_handle_ = handle; } private: ! f2g_type frac2grid_; ! f2c_type frac2cart_; ! g2f_type grid2frac_; ! c2f_type cart2frac_; ! c2g_type cart2grid_; ! g2c_type grid2cart_; ! tin3_type extents_; ! mat3_type matrix_; ! grid_handle_type grid_handle_; out_of_handle_type out_of_handle_; }; --- 371,392 ---- this->out_of_handle_ = handle; } + tin3_type extents () const { + return this->extents_; + } + tbx_unit_cell unit_cell () const { + return this->unit_cell_; + } private: ! f2g_type frac2grid_; ! f2c_type frac2cart_; ! g2f_type grid2frac_; ! c2f_type cart2frac_; ! c2g_type cart2grid_; ! g2c_type grid2cart_; ! tin3_type extents_; ! mat3_type matrix_; ! grid_handle_type grid_handle_; out_of_handle_type out_of_handle_; + tbx_unit_cell unit_cell_; }; Index: generic_grid.h =================================================================== RCS file: /cvsroot/cctbx/cctbx/include/cctbx/maptbx/generic_grid.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** generic_grid.h 7 Sep 2005 18:47:59 -0000 1.1 --- generic_grid.h 11 Nov 2005 00:28:42 -0000 1.2 *************** *** 31,34 **** --- 31,35 ---- virtual af::tiny<IntType,dimension_3> last () const = 0; virtual af::tiny<IntType,dimension_3> focus () const = 0; + virtual af::tiny<IntType,dimension_3> all () const = 0; }; *************** *** 126,129 **** --- 127,137 ---- return result; } + virtual af::tiny<IntType,dimension_3> all () const { + af::tiny<IntType,dimension_3> result; + typename af::flex_grid<>::index_type idx = this->versa_ref_.accessor().all(); + for ( std::size_t i=0; i<dimension_3; ++i ) + result[i] = idx[i]; + return result; + } private: tbx_space_group space_group_; *************** *** 227,230 **** --- 235,246 ---- return result; } + virtual af::tiny<IntType,dimension_3> all () const { + af::tiny<IntType,dimension_3> result; + typename af::c_grid_padded<dimension_3>::index_type idx + = this->c_grid_ref_.accessor().all(); + for ( std::size_t i=0; i<dimension_3; ++i ) + result[i] = idx[i]; + return result; + } private: af::versa<FloatType, af::c_grid_padded<dimension_3> > c_grid_data_; *************** *** 327,330 **** --- 343,353 ---- return result; } + virtual af::tiny<IntType,dimension_3> all () const { + af::tiny<IntType,dimension_3> result; + typename af::flex_grid<>::index_type idx = this->versa_ref_.accessor().all(); + for ( std::size_t i=0; i<dimension_3; ++i ) + result[i] = idx[i]; + return result; + } private: af::tiny<IntType,dimension_3> grid_length_; |