Changes in src/molecule.hpp [5be798:e39e7a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.hpp
r5be798 re39e7a 22 22 23 23 #include <string> 24 25 #include <boost/bimap/bimap.hpp> 26 #include <boost/bimap/unordered_set_of.hpp> 27 #include <boost/bimap/multiset_of.hpp> 28 #include <boost/optional.hpp> 29 #include <boost/shared_ptr.hpp> 24 30 25 31 #include "AtomIdSet.hpp" … … 115 121 MoleculeNameChanged, 116 122 IndexChanged, 123 BoundingBoxChanged, 117 124 AboutToBeRemoved, 118 125 NotificationType_MAX … … 238 245 bool changeAtomNr(int oldNr, int newNr, atom* target=0); 239 246 247 friend bool atom::changeId(atomId_t newId); 248 /** 249 * used when changing an ParticleInfo::Id. 250 * Note that this number is global (and the molecule uses it to know which atoms belong to it) 251 * 252 * @param oldId old Id 253 * @param newId new Id to set 254 * @return indicates wether the change could be done or not. 255 */ 256 bool changeAtomId(int oldId, int newId); 257 240 258 /** Updates the internal lookup fro local to global indices. 241 259 * … … 260 278 261 279 public: 280 281 /** Structure for the required information on the bounding box. 282 * 283 */ 284 struct BoundingBoxInfo { 285 //!> position of center 286 Vector position; 287 //!> radius of sphere 288 double radius; 289 290 /** Equivalence operator for bounding box. 291 * 292 * \return true - both bounding boxes have same position and radius 293 */ 294 bool operator==(const BoundingBoxInfo &_other) const 295 { return (radius == _other.radius) && (position == _other.position); } 296 297 /** Inequivalence operator for bounding box. 298 * 299 * \return true - bounding boxes have either different positions or different radii or both 300 */ 301 bool operator!=(const BoundingBoxInfo &_other) const 302 { return !(*this == _other); } 303 }; 304 305 private: 306 307 /** Returns the current bounding box. 308 * 309 * \return Shape with center and extension of box 310 */ 311 BoundingBoxInfo updateBoundingBox() const; 312 313 // stuff for keeping bounding box up-to-date efficiently 314 315 //!> Cacheable for the bounding box, ptr such that 316 boost::shared_ptr< Cacheable<BoundingBoxInfo> > BoundingBox; 317 /** Bimap storing atomic ids and the component per axis. 318 * 319 * We need a bimap in order to have the components sorted and be able to 320 * access max and min values in linear time and also access the ids in 321 * constant time in order to update the map, when atoms move, are inserted, 322 * or removed. 323 */ 324 typedef boost::bimaps::bimap< 325 boost::bimaps::unordered_set_of< atomId_t >, 326 boost::bimaps::multiset_of< double, std::greater<double> > 327 > AtomDistanceMap_t; 328 std::vector<AtomDistanceMap_t> BoundingBoxSweepingAxis; 329 330 public: 331 332 /** Returns the current bounding box of this molecule. 333 * 334 * \return bounding box info with center and radius 335 */ 336 BoundingBoxInfo getBoundingBox() const; 262 337 263 338 /** Function to create a bounding spherical shape for the currently associated atoms.
Note:
See TracChangeset
for help on using the changeset viewer.