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