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