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