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