Changes in src/World.hpp [43dad6:cf0ca1]
- File:
-
- 1 edited
-
src/World.hpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/World.hpp
r43dad6 rcf0ca1 23 23 #include "Patterns/Cacheable.hpp" 24 24 #include "Patterns/Singleton.hpp" 25 #include "Patterns/ObservedContainer.hpp" 25 26 26 27 // include config.h … … 34 35 class AtomDescriptor_impl; 35 36 template<typename T> class AtomsCalculation; 37 class Box; 36 38 class config; 37 39 class ManipulateAtomsProcess; 40 class Matrix; 38 41 class molecule; 39 42 class MoleculeDescriptor; … … 43 46 class ThermoStatContainer; 44 47 48 45 49 /****************************************** forward declarations *****************************/ 46 50 … … 58 62 friend class MoleculeDescriptor_impl; 59 63 friend class MoleculeDescriptor; 64 // coupling with descriptors over selection 65 friend class AtomSelectionDescriptor_impl; 66 friend class MoleculeSelectionDescriptor_impl; 60 67 61 68 // Actions, calculations etc associated with the World … … 65 72 66 73 // Types for Atom and Molecule structures 67 typedef std::map<atomId_t,atom*> AtomSet;68 typedef std::map<moleculeId_t,molecule*> MoleculeSet;74 typedef ObservedContainer<std::map<atomId_t,atom*> > AtomSet; 75 typedef ObservedContainer<std::map<moleculeId_t,molecule*> > MoleculeSet; 69 76 70 77 /***** getter and setter *****/ … … 125 132 * get the domain size as a symmetric matrix (6 components) 126 133 */ 127 double * getDomain(); 134 Box& getDomain(); 135 136 /** 137 * Set the domain size from a matrix object 138 * 139 * Matrix needs to be symmetric 140 */ 141 void setDomain(const Matrix &mat); 128 142 129 143 /** … … 207 221 ManipulateAtomsProcess* manipulateAtoms(boost::function<void(atom*)>,std::string); 208 222 223 /**** 224 * Iterators to use internal data structures 225 * All these iterators are observed to track changes. 226 * There is a corresponding protected section with unobserved iterators, 227 * which can be used internally when the extra speed is needed 228 */ 229 230 typedef SelectiveIterator<atom*,AtomSet,AtomDescriptor> AtomIterator; 231 232 /** 233 * returns an iterator over all Atoms matching a given descriptor. 234 * This iterator is observed, so don't keep it around unnecessary to 235 * avoid unintended blocking. 236 */ 237 AtomIterator getAtomIter(AtomDescriptor descr); 238 AtomIterator getAtomIter(); 239 240 AtomIterator atomEnd(); 241 242 typedef SelectiveIterator<molecule*,MoleculeSet,MoleculeDescriptor> MoleculeIterator; 243 244 /** 245 * returns an iterator over all Molecules matching a given descriptor. 246 * This iterator is observed, so don't keep it around unnecessary to 247 * avoid unintended blocking. 248 */ 249 MoleculeIterator getMoleculeIter(MoleculeDescriptor descr); 250 MoleculeIterator getMoleculeIter(); 251 252 MoleculeIterator moleculeEnd(); 253 254 /******** Selections of molecules and Atoms *************/ 255 void clearAtomSelection(); 256 void selectAtom(atom*); 257 void selectAtom(atomId_t); 258 void selectAllAtoms(AtomDescriptor); 259 void selectAtomsOfMolecule(molecule*); 260 void selectAtomsOfMolecule(moleculeId_t); 261 void unselectAtom(atom*); 262 void unselectAtom(atomId_t); 263 void unselectAllAtoms(AtomDescriptor); 264 void unselectAtomsOfMolecule(molecule*); 265 void unselectAtomsOfMolecule(moleculeId_t); 266 267 void clearMoleculeSelection(); 268 void selectMolecule(molecule*); 269 void selectMolecule(moleculeId_t); 270 void selectAllMoleculess(MoleculeDescriptor); 271 void selectMoleculeOfAtom(atom*); 272 void selectMoleculeOfAtom(atomId_t); 273 void unselectMolecule(molecule*); 274 void unselectMolecule(moleculeId_t); 275 void unselectAllMoleculess(MoleculeDescriptor); 276 void unselectMoleculeOfAtom(atom*); 277 void unselectMoleculeOfAtom(atomId_t); 278 279 /******************** Iterators to selections *****************/ 280 typedef AtomSet::iterator AtomSelectionIterator; 281 AtomSelectionIterator beginAtomSelection(); 282 AtomSelectionIterator endAtomSelection(); 283 284 typedef MoleculeSet::iterator MoleculeSelectionIterator; 285 MoleculeSelectionIterator beginMoleculeSelection(); 286 MoleculeSelectionIterator endMoleculeSelection(); 287 209 288 protected: 210 /**** Iterators to use internal data structures */ 289 /**** 290 * Iterators to use internal data structures 291 * All these iterators are unobserved for speed reasons. 292 * There is a corresponding public section to these methods, 293 * which produce observed iterators.*/ 211 294 212 295 // Atoms 213 typedef SelectiveIterator<atom*,AtomSet ,AtomDescriptor>AtomIterator;296 typedef SelectiveIterator<atom*,AtomSet::set_t,AtomDescriptor> internal_AtomIterator; 214 297 215 298 /** … … 217 300 * used for internal purposes, like AtomProcesses and AtomCalculations. 218 301 */ 219 AtomIterator getAtomIter(AtomDescriptor descr);302 internal_AtomIterator getAtomIter_internal(AtomDescriptor descr); 220 303 221 304 /** … … 225 308 * used for internal purposes, like AtomProcesses and AtomCalculations. 226 309 */ 227 AtomIterator atomEnd();310 internal_AtomIterator atomEnd_internal(); 228 311 229 312 // Molecules 230 231 typedef SelectiveIterator<molecule*,MoleculeSet,MoleculeDescriptor> MoleculeIterator; 313 typedef SelectiveIterator<molecule*,MoleculeSet::set_t,MoleculeDescriptor> internal_MoleculeIterator; 314 232 315 233 316 /** … … 235 318 * used for internal purposes, like MoleculeProcesses and MoleculeCalculations. 236 319 */ 237 MoleculeIterator getMoleculeIter(MoleculeDescriptor descr);320 internal_MoleculeIterator getMoleculeIter_internal(MoleculeDescriptor descr); 238 321 239 322 /** … … 243 326 * used for internal purposes, like MoleculeProcesses and MoleculeCalculations. 244 327 */ 245 MoleculeIterator moleculeEnd();328 internal_MoleculeIterator moleculeEnd_internal(); 246 329 247 330 … … 254 337 void releaseAtomId(atomId_t); 255 338 bool reserveAtomId(atomId_t); 339 void defragAtomIdPool(); 340 341 moleculeId_t getNextMoleculeId(); 342 void releaseMoleculeId(moleculeId_t); 343 bool reserveMoleculeId(moleculeId_t); 344 void defragMoleculeIdPool(); 256 345 257 346 periodentafel *periode; 258 347 config *configuration; 259 static double*cell_size;348 Box *cell_size; 260 349 std::string defaultName; 261 350 class ThermoStatContainer *Thermostats; 262 351 int ExitFlag; 263 public: 352 private: 353 264 354 AtomSet atoms; 265 private: 266 std::set<atomId_t> atomIdPool; //<!stores the pool for all available AtomIds below currAtomId 355 AtomSet selectedAtoms; 356 typedef std::set<std::pair<atomId_t, atomId_t> > atomIdPool_t; 357 /** 358 * stores the pool for all available AtomIds below currAtomId 359 * 360 * The pool contains ranges of free ids in the form [bottom,top). 361 */ 362 atomIdPool_t atomIdPool; 267 363 atomId_t currAtomId; //!< stores the next available Id for atoms 364 size_t lastAtomPoolSize; //!< size of the pool after last defrag, to skip some defrags 365 unsigned int numAtomDefragSkips; 366 268 367 MoleculeSet molecules; 368 MoleculeSet selectedMolecules; 369 typedef std::set<std::pair<moleculeId_t, moleculeId_t> > moleculeIdPool_t; 370 /** 371 * stores the pool for all available AtomIds below currAtomId 372 * 373 * The pool contains ranges of free ids in the form [bottom,top). 374 */ 375 moleculeIdPool_t moleculeIdPool; 269 376 moleculeId_t currMoleculeId; 377 size_t lastMoleculePoolSize; //!< size of the pool after last defrag, to skip some defrags 378 unsigned int numMoleculeDefragSkips; 270 379 private: 271 380 /**
Note:
See TracChangeset
for help on using the changeset viewer.
