| [5d1611] | 1 | /* | 
|---|
|  | 2 | * World.hpp | 
|---|
|  | 3 | * | 
|---|
|  | 4 | *  Created on: Feb 3, 2010 | 
|---|
|  | 5 | *      Author: crueger | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #ifndef WORLD_HPP_ | 
|---|
|  | 9 | #define WORLD_HPP_ | 
|---|
|  | 10 |  | 
|---|
| [b34306] | 11 | /*********************************************** includes ***********************************/ | 
|---|
|  | 12 |  | 
|---|
| [7c4e29] | 13 | #include <string> | 
|---|
| [d346b6] | 14 | #include <map> | 
|---|
| [fc1b24] | 15 | #include <vector> | 
|---|
| [354859] | 16 | #include <set> | 
|---|
| [7c4e29] | 17 | #include <boost/thread.hpp> | 
|---|
| [865a945] | 18 | #include <boost/shared_ptr.hpp> | 
|---|
| [5d1611] | 19 |  | 
|---|
| [ead4e6] | 20 | #include "types.hpp" | 
|---|
| [6e97e5] | 21 | #include "Descriptors/SelectiveIterator.hpp" | 
|---|
| [5d1611] | 22 | #include "Patterns/Observer.hpp" | 
|---|
|  | 23 | #include "Patterns/Cacheable.hpp" | 
|---|
| [23b547] | 24 | #include "Patterns/Singleton.hpp" | 
|---|
| [b99bf3] | 25 | #include "Patterns/ObservedContainer.hpp" | 
|---|
| [dc11c9] | 26 | #include "Helpers/Range.hpp" | 
|---|
| [4d72e4] | 27 | #include "AtomSet.hpp" | 
|---|
| [23b547] | 28 |  | 
|---|
| [b34306] | 29 | // include config.h | 
|---|
|  | 30 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 31 | #include <config.h> | 
|---|
|  | 32 | #endif | 
|---|
| [5d1611] | 33 |  | 
|---|
|  | 34 | // forward declarations | 
|---|
| [4d9c01] | 35 | class atom; | 
|---|
| [fc1b24] | 36 | class AtomDescriptor; | 
|---|
| [7a1ce5] | 37 | class AtomDescriptor_impl; | 
|---|
| [43dad6] | 38 | template<typename T> class AtomsCalculation; | 
|---|
| [84c494] | 39 | class Box; | 
|---|
| [43dad6] | 40 | class config; | 
|---|
|  | 41 | class ManipulateAtomsProcess; | 
|---|
| [84c494] | 42 | class Matrix; | 
|---|
| [43dad6] | 43 | class molecule; | 
|---|
| [1c51c8] | 44 | class MoleculeDescriptor; | 
|---|
|  | 45 | class MoleculeDescriptor_impl; | 
|---|
| [43dad6] | 46 | class MoleculeListClass; | 
|---|
|  | 47 | class periodentafel; | 
|---|
|  | 48 | class ThermoStatContainer; | 
|---|
| [5d1611] | 49 |  | 
|---|
| [fa0b18] | 50 |  | 
|---|
| [b34306] | 51 | /****************************************** forward declarations *****************************/ | 
|---|
| [23b547] | 52 |  | 
|---|
| [b34306] | 53 | /********************************************** Class World *******************************/ | 
|---|
| [23b547] | 54 |  | 
|---|
|  | 55 | class World : public Singleton<World>, public Observable | 
|---|
| [5d1611] | 56 | { | 
|---|
| [23b547] | 57 |  | 
|---|
|  | 58 | // Make access to constructor and destructor possible from inside the singleton | 
|---|
|  | 59 | friend class Singleton<World>; | 
|---|
|  | 60 |  | 
|---|
| [b54ac8] | 61 | // necessary for coupling with descriptors | 
|---|
| [7a1ce5] | 62 | friend class AtomDescriptor_impl; | 
|---|
| [865a945] | 63 | friend class AtomDescriptor; | 
|---|
| [1c51c8] | 64 | friend class MoleculeDescriptor_impl; | 
|---|
|  | 65 | friend class MoleculeDescriptor; | 
|---|
| [41aa39] | 66 | // coupling with descriptors over selection | 
|---|
|  | 67 | friend class AtomSelectionDescriptor_impl; | 
|---|
| [cf0ca1] | 68 | friend class MoleculeSelectionDescriptor_impl; | 
|---|
| [865a945] | 69 |  | 
|---|
| [b54ac8] | 70 | // Actions, calculations etc associated with the World | 
|---|
| [7c4e29] | 71 | friend class ManipulateAtomsProcess; | 
|---|
| [b54ac8] | 72 | template<typename> friend class AtomsCalculation; | 
|---|
| [5d1611] | 73 | public: | 
|---|
| [5f1d5b8] | 74 | // some typedefs for the CONSTRUCT_... macros (no "," allows in a single parameter name) | 
|---|
|  | 75 | typedef std::map<atomId_t,atom*> AtomSTLSet; | 
|---|
|  | 76 | typedef std::map<moleculeId_t,molecule*> MoleculeSTLSet; | 
|---|
| [23b547] | 77 |  | 
|---|
|  | 78 | // Types for Atom and Molecule structures | 
|---|
| [5f1d5b8] | 79 | typedef ObservedContainer< AtomSTLSet > AtomSet; | 
|---|
|  | 80 | typedef ObservedContainer< MoleculeSTLSet > MoleculeSet; | 
|---|
| [5d1611] | 81 |  | 
|---|
| [4d72e4] | 82 | typedef ATOMSET(std::vector) AtomComposite; | 
|---|
|  | 83 |  | 
|---|
| [5d1611] | 84 | /***** getter and setter *****/ | 
|---|
| [354859] | 85 | // reference to pointer is used for legacy reason... reference will be removed latter to keep encapsulation of World object | 
|---|
| [02ee15] | 86 | /** | 
|---|
|  | 87 | * returns the periodentafel for the world. | 
|---|
|  | 88 | */ | 
|---|
| [354859] | 89 | periodentafel *&getPeriode(); | 
|---|
| [02ee15] | 90 |  | 
|---|
| [8e1f7af] | 91 | /** | 
|---|
|  | 92 | * returns the configuration for the world. | 
|---|
|  | 93 | */ | 
|---|
|  | 94 | config *&getConfig(); | 
|---|
|  | 95 |  | 
|---|
| [02ee15] | 96 | /** | 
|---|
|  | 97 | * returns the first atom that matches a given descriptor. | 
|---|
|  | 98 | * Do not rely on ordering for descriptors that match more than one atom. | 
|---|
|  | 99 | */ | 
|---|
| [7a1ce5] | 100 | atom* getAtom(AtomDescriptor descriptor); | 
|---|
| [02ee15] | 101 |  | 
|---|
|  | 102 | /** | 
|---|
|  | 103 | * returns a vector containing all atoms that match a given descriptor | 
|---|
|  | 104 | */ | 
|---|
| [4d72e4] | 105 | AtomComposite getAllAtoms(AtomDescriptor descriptor); | 
|---|
|  | 106 | AtomComposite getAllAtoms(); | 
|---|
| [b54ac8] | 107 |  | 
|---|
| [02ee15] | 108 | /** | 
|---|
|  | 109 | * returns a calculation that calls a given function on all atoms matching a descriptor. | 
|---|
|  | 110 | * the calculation is not called at this point and can be used as an action, i.e. be stored in | 
|---|
|  | 111 | * menus, be kept around for later use etc. | 
|---|
|  | 112 | */ | 
|---|
| [0e2a47] | 113 | template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,std::string,AtomDescriptor); | 
|---|
|  | 114 | template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,std::string); | 
|---|
| [b54ac8] | 115 |  | 
|---|
| [02ee15] | 116 | /** | 
|---|
|  | 117 | * get the number of atoms in the World | 
|---|
|  | 118 | */ | 
|---|
| [354859] | 119 | int numAtoms(); | 
|---|
| [02ee15] | 120 |  | 
|---|
| [1c51c8] | 121 | /** | 
|---|
|  | 122 | * returns the first molecule that matches a given descriptor. | 
|---|
|  | 123 | * Do not rely on ordering for descriptors that match more than one molecule. | 
|---|
|  | 124 | */ | 
|---|
|  | 125 | molecule *getMolecule(MoleculeDescriptor descriptor); | 
|---|
|  | 126 |  | 
|---|
|  | 127 | /** | 
|---|
|  | 128 | * returns a vector containing all molecules that match a given descriptor | 
|---|
|  | 129 | */ | 
|---|
|  | 130 | std::vector<molecule*> getAllMolecules(MoleculeDescriptor descriptor); | 
|---|
| [97ebf8] | 131 | std::vector<molecule*> getAllMolecules(); | 
|---|
| [1c51c8] | 132 |  | 
|---|
| [02ee15] | 133 | /** | 
|---|
|  | 134 | * get the number of molecules in the World | 
|---|
|  | 135 | */ | 
|---|
| [354859] | 136 | int numMolecules(); | 
|---|
|  | 137 |  | 
|---|
| [5f612ee] | 138 | /** | 
|---|
|  | 139 | * get the domain size as a symmetric matrix (6 components) | 
|---|
|  | 140 | */ | 
|---|
| [84c494] | 141 | Box& getDomain(); | 
|---|
|  | 142 |  | 
|---|
|  | 143 | /** | 
|---|
|  | 144 | * Set the domain size from a matrix object | 
|---|
|  | 145 | * | 
|---|
|  | 146 | * Matrix needs to be symmetric | 
|---|
|  | 147 | */ | 
|---|
|  | 148 | void setDomain(const Matrix &mat); | 
|---|
| [5f612ee] | 149 |  | 
|---|
|  | 150 | /** | 
|---|
|  | 151 | * set the domain size as a symmetric matrix (6 components) | 
|---|
|  | 152 | */ | 
|---|
|  | 153 | void setDomain(double * matrix); | 
|---|
|  | 154 |  | 
|---|
|  | 155 | /** | 
|---|
|  | 156 | * get the default name | 
|---|
|  | 157 | */ | 
|---|
| [387b36] | 158 | std::string getDefaultName(); | 
|---|
| [5f612ee] | 159 |  | 
|---|
|  | 160 | /** | 
|---|
|  | 161 | * set the default name | 
|---|
|  | 162 | */ | 
|---|
| [387b36] | 163 | void setDefaultName(std::string name); | 
|---|
| [5f612ee] | 164 |  | 
|---|
| [43dad6] | 165 | /** | 
|---|
|  | 166 | * get pointer to World's ThermoStatContainer | 
|---|
|  | 167 | */ | 
|---|
|  | 168 | ThermoStatContainer * getThermostats(); | 
|---|
|  | 169 |  | 
|---|
| [e4b5de] | 170 | /* | 
|---|
|  | 171 | * get the ExitFlag | 
|---|
|  | 172 | */ | 
|---|
|  | 173 | int getExitFlag(); | 
|---|
|  | 174 |  | 
|---|
|  | 175 | /* | 
|---|
|  | 176 | * set the ExitFlag | 
|---|
|  | 177 | */ | 
|---|
|  | 178 | void setExitFlag(int flag); | 
|---|
|  | 179 |  | 
|---|
| [354859] | 180 | /***** Methods to work with the World *****/ | 
|---|
| [02ee15] | 181 |  | 
|---|
|  | 182 | /** | 
|---|
|  | 183 | * create a new molecule. This method should be used whenever any kind of molecule is needed. Assigns a unique | 
|---|
|  | 184 | * ID to the molecule and stores it in the World for later retrieval. Do not create molecules directly. | 
|---|
|  | 185 | */ | 
|---|
| [354859] | 186 | molecule *createMolecule(); | 
|---|
| [02ee15] | 187 |  | 
|---|
| [cbc5fb] | 188 | void destroyMolecule(molecule*); | 
|---|
|  | 189 | void destroyMolecule(moleculeId_t); | 
|---|
|  | 190 |  | 
|---|
| [02ee15] | 191 | /** | 
|---|
|  | 192 | * Create a new atom. This method should be used whenever any atom is needed. Assigns a unique ID and stores | 
|---|
|  | 193 | * the atom in the World. If the atom is not destroyed it will automatically be destroyed when the world ends. | 
|---|
|  | 194 | */ | 
|---|
| [46d958] | 195 | atom *createAtom(); | 
|---|
| [02ee15] | 196 |  | 
|---|
|  | 197 | /** | 
|---|
|  | 198 | * Registers a Atom unknown to world. Needed in some rare cases, e.g. when cloning atoms, or in some unittests. | 
|---|
|  | 199 | * Do not re-register Atoms already known to the world since this will cause double-frees. | 
|---|
|  | 200 | */ | 
|---|
| [46d958] | 201 | int registerAtom(atom*); | 
|---|
| [02ee15] | 202 |  | 
|---|
|  | 203 | /** | 
|---|
|  | 204 | * Delete some atom and erase it from the world. Use this whenever you need to destroy any atom. Do not call delete on | 
|---|
|  | 205 | * atom directly since this will leave the pointer inside the world. | 
|---|
|  | 206 | */ | 
|---|
| [46d958] | 207 | void destroyAtom(atom*); | 
|---|
| [02ee15] | 208 |  | 
|---|
|  | 209 | /** | 
|---|
|  | 210 | * Delete some atom and erase it from the world. Use this whenever you need to destroy any atom. Do not call delete on | 
|---|
|  | 211 | * atom directly since this will leave the pointer inside the world. | 
|---|
|  | 212 | */ | 
|---|
| [cbc5fb] | 213 | void destroyAtom(atomId_t); | 
|---|
| [865a945] | 214 |  | 
|---|
| [88d586] | 215 | /** | 
|---|
|  | 216 | * used when changing an atom Id. | 
|---|
|  | 217 | * Unless you are calling this method from inside an atom don't fiddle with the third parameter. | 
|---|
|  | 218 | * | 
|---|
|  | 219 | * Return value indicates wether the change could be done or not. | 
|---|
|  | 220 | */ | 
|---|
|  | 221 | bool changeAtomId(atomId_t oldId, atomId_t newId, atom* target=0); | 
|---|
|  | 222 |  | 
|---|
| [a7a087] | 223 | /** | 
|---|
|  | 224 | * used when changing an molecule Id. | 
|---|
|  | 225 | * Unless you are calling this method from inside an moleucle don't fiddle with the third parameter. | 
|---|
|  | 226 | * | 
|---|
|  | 227 | * Return value indicates wether the change could be done or not. | 
|---|
|  | 228 | */ | 
|---|
|  | 229 | bool changeMoleculeId(moleculeId_t oldId, moleculeId_t newId, molecule* target=0); | 
|---|
|  | 230 |  | 
|---|
| [02ee15] | 231 | /** | 
|---|
|  | 232 | * Produces a process that calls a function on all Atoms matching a given descriptor. The process is not | 
|---|
|  | 233 | * called at this time, so it can be passed around, stored inside menuItems etc. | 
|---|
|  | 234 | */ | 
|---|
| [7c4e29] | 235 | ManipulateAtomsProcess* manipulateAtoms(boost::function<void(atom*)>,std::string,AtomDescriptor); | 
|---|
| [0e2a47] | 236 | ManipulateAtomsProcess* manipulateAtoms(boost::function<void(atom*)>,std::string); | 
|---|
| [7c4e29] | 237 |  | 
|---|
| [fa0b18] | 238 | /**** | 
|---|
|  | 239 | * Iterators to use internal data structures | 
|---|
|  | 240 | * All these iterators are observed to track changes. | 
|---|
|  | 241 | * There is a corresponding protected section with unobserved iterators, | 
|---|
| [90c4280] | 242 | * which can be used internally when the extra speed is needed | 
|---|
| [fa0b18] | 243 | */ | 
|---|
|  | 244 |  | 
|---|
|  | 245 | typedef SelectiveIterator<atom*,AtomSet,AtomDescriptor>       AtomIterator; | 
|---|
|  | 246 |  | 
|---|
|  | 247 | /** | 
|---|
|  | 248 | * returns an iterator over all Atoms matching a given descriptor. | 
|---|
|  | 249 | * This iterator is observed, so don't keep it around unnecessary to | 
|---|
|  | 250 | * avoid unintended blocking. | 
|---|
|  | 251 | */ | 
|---|
|  | 252 | AtomIterator getAtomIter(AtomDescriptor descr); | 
|---|
|  | 253 | AtomIterator getAtomIter(); | 
|---|
|  | 254 |  | 
|---|
|  | 255 | AtomIterator atomEnd(); | 
|---|
|  | 256 |  | 
|---|
| [e3d865] | 257 | typedef SelectiveIterator<molecule*,MoleculeSet,MoleculeDescriptor>   MoleculeIterator; | 
|---|
| [51be2a] | 258 |  | 
|---|
| [90c4280] | 259 | /** | 
|---|
|  | 260 | * returns an iterator over all Molecules matching a given descriptor. | 
|---|
|  | 261 | * This iterator is observed, so don't keep it around unnecessary to | 
|---|
|  | 262 | * avoid unintended blocking. | 
|---|
|  | 263 | */ | 
|---|
| [5d880e] | 264 | MoleculeIterator getMoleculeIter(MoleculeDescriptor descr); | 
|---|
|  | 265 | MoleculeIterator getMoleculeIter(); | 
|---|
|  | 266 |  | 
|---|
|  | 267 | MoleculeIterator moleculeEnd(); | 
|---|
|  | 268 |  | 
|---|
| [90c4280] | 269 | /******** Selections of molecules and Atoms *************/ | 
|---|
|  | 270 | void clearAtomSelection(); | 
|---|
|  | 271 | void selectAtom(atom*); | 
|---|
|  | 272 | void selectAtom(atomId_t); | 
|---|
|  | 273 | void selectAllAtoms(AtomDescriptor); | 
|---|
|  | 274 | void selectAtomsOfMolecule(molecule*); | 
|---|
|  | 275 | void selectAtomsOfMolecule(moleculeId_t); | 
|---|
| [61d655e] | 276 | void unselectAtom(atom*); | 
|---|
|  | 277 | void unselectAtom(atomId_t); | 
|---|
|  | 278 | void unselectAllAtoms(AtomDescriptor); | 
|---|
|  | 279 | void unselectAtomsOfMolecule(molecule*); | 
|---|
|  | 280 | void unselectAtomsOfMolecule(moleculeId_t); | 
|---|
| [e472eab] | 281 | size_t countSelectedAtoms() const; | 
|---|
|  | 282 | bool isSelected(atom *_atom) const; | 
|---|
|  | 283 | const std::vector<atom *> getSelectedAtoms() const; | 
|---|
| [90c4280] | 284 |  | 
|---|
|  | 285 | void clearMoleculeSelection(); | 
|---|
|  | 286 | void selectMolecule(molecule*); | 
|---|
|  | 287 | void selectMolecule(moleculeId_t); | 
|---|
| [e472eab] | 288 | void selectAllMolecules(MoleculeDescriptor); | 
|---|
| [90c4280] | 289 | void selectMoleculeOfAtom(atom*); | 
|---|
|  | 290 | void selectMoleculeOfAtom(atomId_t); | 
|---|
| [61d655e] | 291 | void unselectMolecule(molecule*); | 
|---|
|  | 292 | void unselectMolecule(moleculeId_t); | 
|---|
| [e472eab] | 293 | void unselectAllMolecules(MoleculeDescriptor); | 
|---|
| [61d655e] | 294 | void unselectMoleculeOfAtom(atom*); | 
|---|
|  | 295 | void unselectMoleculeOfAtom(atomId_t); | 
|---|
| [e472eab] | 296 | size_t countSelectedMolecules() const; | 
|---|
|  | 297 | bool isSelected(molecule *_mol) const; | 
|---|
|  | 298 | const std::vector<molecule *> getSelectedMolecules() const; | 
|---|
| [90c4280] | 299 |  | 
|---|
| [3839e5] | 300 | /******************** Iterators to selections *****************/ | 
|---|
|  | 301 | typedef AtomSet::iterator AtomSelectionIterator; | 
|---|
|  | 302 | AtomSelectionIterator beginAtomSelection(); | 
|---|
|  | 303 | AtomSelectionIterator endAtomSelection(); | 
|---|
|  | 304 |  | 
|---|
|  | 305 | typedef MoleculeSet::iterator MoleculeSelectionIterator; | 
|---|
|  | 306 | MoleculeSelectionIterator beginMoleculeSelection(); | 
|---|
|  | 307 | MoleculeSelectionIterator endMoleculeSelection(); | 
|---|
|  | 308 |  | 
|---|
| [865a945] | 309 | protected: | 
|---|
| [fa0b18] | 310 | /**** | 
|---|
|  | 311 | * Iterators to use internal data structures | 
|---|
|  | 312 | * All these iterators are unobserved for speed reasons. | 
|---|
|  | 313 | * There is a corresponding public section to these methods, | 
|---|
|  | 314 | * which produce observed iterators.*/ | 
|---|
| [1c51c8] | 315 |  | 
|---|
|  | 316 | // Atoms | 
|---|
| [e3d865] | 317 | typedef SelectiveIterator<atom*,AtomSet::set_t,AtomDescriptor>        internal_AtomIterator; | 
|---|
| [865a945] | 318 |  | 
|---|
| [02ee15] | 319 | /** | 
|---|
|  | 320 | * returns an iterator over all Atoms matching a given descriptor. | 
|---|
|  | 321 | * used for internal purposes, like AtomProcesses and AtomCalculations. | 
|---|
|  | 322 | */ | 
|---|
| [fa0b18] | 323 | internal_AtomIterator getAtomIter_internal(AtomDescriptor descr); | 
|---|
| [02ee15] | 324 |  | 
|---|
|  | 325 | /** | 
|---|
| [d2dbac0] | 326 | * returns an iterator to the end of the AtomSet. Due to overloading this iterator | 
|---|
| [02ee15] | 327 | * can be compared to iterators produced by getAtomIter (see the mis-matching types). | 
|---|
|  | 328 | * Thus it can be used to detect when such an iterator is at the end of the list. | 
|---|
|  | 329 | * used for internal purposes, like AtomProcesses and AtomCalculations. | 
|---|
|  | 330 | */ | 
|---|
| [fa0b18] | 331 | internal_AtomIterator atomEnd_internal(); | 
|---|
| [865a945] | 332 |  | 
|---|
| [1c51c8] | 333 | // Molecules | 
|---|
| [e3d865] | 334 | typedef SelectiveIterator<molecule*,MoleculeSet::set_t,MoleculeDescriptor>   internal_MoleculeIterator; | 
|---|
| [51be2a] | 335 |  | 
|---|
| [1c51c8] | 336 |  | 
|---|
|  | 337 | /** | 
|---|
|  | 338 | * returns an iterator over all Molecules matching a given descriptor. | 
|---|
|  | 339 | * used for internal purposes, like MoleculeProcesses and MoleculeCalculations. | 
|---|
|  | 340 | */ | 
|---|
| [e3d865] | 341 | internal_MoleculeIterator getMoleculeIter_internal(MoleculeDescriptor descr); | 
|---|
| [1c51c8] | 342 |  | 
|---|
|  | 343 | /** | 
|---|
|  | 344 | * returns an iterator to the end of the MoleculeSet. Due to overloading this iterator | 
|---|
|  | 345 | * can be compared to iterators produced by getMoleculeIter (see the mis-matching types). | 
|---|
|  | 346 | * Thus it can be used to detect when such an iterator is at the end of the list. | 
|---|
|  | 347 | * used for internal purposes, like MoleculeProcesses and MoleculeCalculations. | 
|---|
|  | 348 | */ | 
|---|
| [e3d865] | 349 | internal_MoleculeIterator moleculeEnd_internal(); | 
|---|
| [1c51c8] | 350 |  | 
|---|
|  | 351 |  | 
|---|
| [afb47f] | 352 | /******* Internal manipulation routines for double callback and Observer mechanism ******/ | 
|---|
|  | 353 | void doManipulate(ManipulateAtomsProcess *); | 
|---|
|  | 354 |  | 
|---|
| [5d1611] | 355 | private: | 
|---|
| [88d586] | 356 |  | 
|---|
|  | 357 | atomId_t getNextAtomId(); | 
|---|
|  | 358 | void releaseAtomId(atomId_t); | 
|---|
|  | 359 | bool reserveAtomId(atomId_t); | 
|---|
| [127a8e] | 360 | void defragAtomIdPool(); | 
|---|
|  | 361 |  | 
|---|
|  | 362 | moleculeId_t getNextMoleculeId(); | 
|---|
|  | 363 | void releaseMoleculeId(moleculeId_t); | 
|---|
|  | 364 | bool reserveMoleculeId(moleculeId_t); | 
|---|
|  | 365 | void defragMoleculeIdPool(); | 
|---|
| [88d586] | 366 |  | 
|---|
| [5d1611] | 367 | periodentafel *periode; | 
|---|
| [8e1f7af] | 368 | config *configuration; | 
|---|
| [84c494] | 369 | Box *cell_size; | 
|---|
| [387b36] | 370 | std::string defaultName; | 
|---|
| [43dad6] | 371 | class ThermoStatContainer *Thermostats; | 
|---|
| [e4b5de] | 372 | int ExitFlag; | 
|---|
| [6e97e5] | 373 | private: | 
|---|
| [127a8e] | 374 |  | 
|---|
| [1a76a6] | 375 | AtomSet atoms; | 
|---|
| [90c4280] | 376 | AtomSet selectedAtoms; | 
|---|
| [dc11c9] | 377 | typedef std::set<range<atomId_t> > atomIdPool_t; | 
|---|
| [127a8e] | 378 | /** | 
|---|
|  | 379 | * stores the pool for all available AtomIds below currAtomId | 
|---|
|  | 380 | * | 
|---|
|  | 381 | * The pool contains ranges of free ids in the form [bottom,top). | 
|---|
|  | 382 | */ | 
|---|
|  | 383 | atomIdPool_t atomIdPool; | 
|---|
| [cbc5fb] | 384 | atomId_t currAtomId; //!< stores the next available Id for atoms | 
|---|
| [127a8e] | 385 | size_t lastAtomPoolSize; //!< size of the pool after last defrag, to skip some defrags | 
|---|
|  | 386 | unsigned int numAtomDefragSkips; | 
|---|
|  | 387 |  | 
|---|
| [d2dbac0] | 388 | MoleculeSet molecules; | 
|---|
| [90c4280] | 389 | MoleculeSet selectedMolecules; | 
|---|
| [dc11c9] | 390 | typedef std::set<range<atomId_t> > moleculeIdPool_t; | 
|---|
| [1a76a6] | 391 | /** | 
|---|
|  | 392 | * stores the pool for all available AtomIds below currAtomId | 
|---|
|  | 393 | * | 
|---|
|  | 394 | * The pool contains ranges of free ids in the form [bottom,top). | 
|---|
|  | 395 | */ | 
|---|
| [127a8e] | 396 | moleculeIdPool_t moleculeIdPool; | 
|---|
| [cbc5fb] | 397 | moleculeId_t currMoleculeId; | 
|---|
| [127a8e] | 398 | size_t lastMoleculePoolSize; //!< size of the pool after last defrag, to skip some defrags | 
|---|
|  | 399 | unsigned int numMoleculeDefragSkips; | 
|---|
| [5d1611] | 400 | private: | 
|---|
| [02ee15] | 401 | /** | 
|---|
|  | 402 | * private constructor to ensure creation of the world using | 
|---|
|  | 403 | * the singleton pattern. | 
|---|
|  | 404 | */ | 
|---|
| [5d1611] | 405 | World(); | 
|---|
| [02ee15] | 406 |  | 
|---|
|  | 407 | /** | 
|---|
|  | 408 | * private destructor to ensure destruction of the world using the | 
|---|
|  | 409 | * singleton pattern. | 
|---|
|  | 410 | */ | 
|---|
| [5d1611] | 411 | virtual ~World(); | 
|---|
|  | 412 |  | 
|---|
|  | 413 | /***** | 
|---|
|  | 414 | * some legacy stuff that is include for now but will be removed later | 
|---|
|  | 415 | *****/ | 
|---|
|  | 416 | public: | 
|---|
| [354859] | 417 | MoleculeListClass *&getMolecules(); | 
|---|
| [4d9c01] | 418 |  | 
|---|
| [5d1611] | 419 | private: | 
|---|
| [354859] | 420 | MoleculeListClass *molecules_deprecated; | 
|---|
| [5d1611] | 421 | }; | 
|---|
|  | 422 |  | 
|---|
|  | 423 | #endif /* WORLD_HPP_ */ | 
|---|