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