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