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