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