Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/World.hpp

    rcf0ca1 r43dad6  
    2323#include "Patterns/Cacheable.hpp"
    2424#include "Patterns/Singleton.hpp"
    25 #include "Patterns/ObservedContainer.hpp"
    2625
    2726// include config.h
     
    3534class AtomDescriptor_impl;
    3635template<typename T> class AtomsCalculation;
    37 class Box;
    3836class config;
    3937class ManipulateAtomsProcess;
    40 class Matrix;
    4138class molecule;
    4239class MoleculeDescriptor;
     
    4643class ThermoStatContainer;
    4744
    48 
    4945/****************************************** forward declarations *****************************/
    5046
     
    6258friend class MoleculeDescriptor_impl;
    6359friend class MoleculeDescriptor;
    64 // coupling with descriptors over selection
    65 friend class AtomSelectionDescriptor_impl;
    66 friend class MoleculeSelectionDescriptor_impl;
    6760
    6861// Actions, calculations etc associated with the World
     
    7265
    7366  // Types for Atom and Molecule structures
    74   typedef ObservedContainer<std::map<atomId_t,atom*> > AtomSet;
    75   typedef ObservedContainer<std::map<moleculeId_t,molecule*> > MoleculeSet;
     67  typedef std::map<atomId_t,atom*> AtomSet;
     68  typedef std::map<moleculeId_t,molecule*> MoleculeSet;
    7669
    7770  /***** getter and setter *****/
     
    132125   * get the domain size as a symmetric matrix (6 components)
    133126   */
    134   Box& getDomain();
    135 
    136   /**
    137    * Set the domain size from a matrix object
    138    *
    139    * Matrix needs to be symmetric
    140    */
    141   void setDomain(const Matrix &mat);
     127  double * getDomain();
    142128
    143129  /**
     
    221207  ManipulateAtomsProcess* manipulateAtoms(boost::function<void(atom*)>,std::string);
    222208
    223   /****
    224    * Iterators to use internal data structures
    225    * All these iterators are observed to track changes.
    226    * There is a corresponding protected section with unobserved iterators,
    227    * which can be used internally when the extra speed is needed
    228    */
    229 
    230   typedef SelectiveIterator<atom*,AtomSet,AtomDescriptor>       AtomIterator;
    231 
    232   /**
    233    * returns an iterator over all Atoms matching a given descriptor.
    234    * This iterator is observed, so don't keep it around unnecessary to
    235    * avoid unintended blocking.
    236    */
    237   AtomIterator getAtomIter(AtomDescriptor descr);
    238   AtomIterator getAtomIter();
    239 
    240   AtomIterator atomEnd();
    241 
    242   typedef SelectiveIterator<molecule*,MoleculeSet,MoleculeDescriptor>   MoleculeIterator;
    243 
    244   /**
    245    * returns an iterator over all Molecules matching a given descriptor.
    246    * This iterator is observed, so don't keep it around unnecessary to
    247    * avoid unintended blocking.
    248    */
    249   MoleculeIterator getMoleculeIter(MoleculeDescriptor descr);
    250   MoleculeIterator getMoleculeIter();
    251 
    252   MoleculeIterator moleculeEnd();
    253 
    254   /******** Selections of molecules and Atoms *************/
    255   void clearAtomSelection();
    256   void selectAtom(atom*);
    257   void selectAtom(atomId_t);
    258   void selectAllAtoms(AtomDescriptor);
    259   void selectAtomsOfMolecule(molecule*);
    260   void selectAtomsOfMolecule(moleculeId_t);
    261   void unselectAtom(atom*);
    262   void unselectAtom(atomId_t);
    263   void unselectAllAtoms(AtomDescriptor);
    264   void unselectAtomsOfMolecule(molecule*);
    265   void unselectAtomsOfMolecule(moleculeId_t);
    266 
    267   void clearMoleculeSelection();
    268   void selectMolecule(molecule*);
    269   void selectMolecule(moleculeId_t);
    270   void selectAllMoleculess(MoleculeDescriptor);
    271   void selectMoleculeOfAtom(atom*);
    272   void selectMoleculeOfAtom(atomId_t);
    273   void unselectMolecule(molecule*);
    274   void unselectMolecule(moleculeId_t);
    275   void unselectAllMoleculess(MoleculeDescriptor);
    276   void unselectMoleculeOfAtom(atom*);
    277   void unselectMoleculeOfAtom(atomId_t);
    278 
    279   /******************** Iterators to selections *****************/
    280   typedef AtomSet::iterator AtomSelectionIterator;
    281   AtomSelectionIterator beginAtomSelection();
    282   AtomSelectionIterator endAtomSelection();
    283 
    284   typedef MoleculeSet::iterator MoleculeSelectionIterator;
    285   MoleculeSelectionIterator beginMoleculeSelection();
    286   MoleculeSelectionIterator endMoleculeSelection();
    287 
    288209protected:
    289   /****
    290    * Iterators to use internal data structures
    291    * All these iterators are unobserved for speed reasons.
    292    * There is a corresponding public section to these methods,
    293    * which produce observed iterators.*/
     210  /**** Iterators to use internal data structures */
    294211
    295212  // Atoms
    296   typedef SelectiveIterator<atom*,AtomSet::set_t,AtomDescriptor>        internal_AtomIterator;
     213  typedef SelectiveIterator<atom*,AtomSet,AtomDescriptor> AtomIterator;
    297214
    298215  /**
     
    300217   * used for internal purposes, like AtomProcesses and AtomCalculations.
    301218   */
    302   internal_AtomIterator getAtomIter_internal(AtomDescriptor descr);
     219  AtomIterator getAtomIter(AtomDescriptor descr);
    303220
    304221  /**
     
    308225   * used for internal purposes, like AtomProcesses and AtomCalculations.
    309226   */
    310   internal_AtomIterator atomEnd_internal();
     227  AtomIterator atomEnd();
    311228
    312229  // Molecules
    313   typedef SelectiveIterator<molecule*,MoleculeSet::set_t,MoleculeDescriptor>   internal_MoleculeIterator;
    314 
     230
     231  typedef SelectiveIterator<molecule*,MoleculeSet,MoleculeDescriptor> MoleculeIterator;
    315232
    316233  /**
     
    318235   * used for internal purposes, like MoleculeProcesses and MoleculeCalculations.
    319236   */
    320   internal_MoleculeIterator getMoleculeIter_internal(MoleculeDescriptor descr);
     237  MoleculeIterator getMoleculeIter(MoleculeDescriptor descr);
    321238
    322239  /**
     
    326243   * used for internal purposes, like MoleculeProcesses and MoleculeCalculations.
    327244   */
    328   internal_MoleculeIterator moleculeEnd_internal();
     245  MoleculeIterator moleculeEnd();
    329246
    330247
     
    337254  void releaseAtomId(atomId_t);
    338255  bool reserveAtomId(atomId_t);
    339   void defragAtomIdPool();
    340 
    341   moleculeId_t getNextMoleculeId();
    342   void releaseMoleculeId(moleculeId_t);
    343   bool reserveMoleculeId(moleculeId_t);
    344   void defragMoleculeIdPool();
    345256
    346257  periodentafel *periode;
    347258  config *configuration;
    348   Box *cell_size;
     259  static double *cell_size;
    349260  std::string defaultName;
    350261  class ThermoStatContainer *Thermostats;
    351262  int ExitFlag;
    352 private:
    353 
     263public:
    354264  AtomSet atoms;
    355   AtomSet selectedAtoms;
    356   typedef std::set<std::pair<atomId_t, atomId_t> > atomIdPool_t;
    357   /**
    358    * stores the pool for all available AtomIds below currAtomId
    359    *
    360    * The pool contains ranges of free ids in the form [bottom,top).
    361    */
    362   atomIdPool_t atomIdPool;
     265private:
     266  std::set<atomId_t> atomIdPool; //<!stores the pool for all available AtomIds below currAtomId
    363267  atomId_t currAtomId; //!< stores the next available Id for atoms
    364   size_t lastAtomPoolSize; //!< size of the pool after last defrag, to skip some defrags
    365   unsigned int numAtomDefragSkips;
    366 
    367268  MoleculeSet molecules;
    368   MoleculeSet selectedMolecules;
    369   typedef std::set<std::pair<moleculeId_t, moleculeId_t> > moleculeIdPool_t;
    370   /**
    371    * stores the pool for all available AtomIds below currAtomId
    372    *
    373    * The pool contains ranges of free ids in the form [bottom,top).
    374    */
    375   moleculeIdPool_t moleculeIdPool;
    376269  moleculeId_t currMoleculeId;
    377   size_t lastMoleculePoolSize; //!< size of the pool after last defrag, to skip some defrags
    378   unsigned int numMoleculeDefragSkips;
    379270private:
    380271  /**
Note: See TracChangeset for help on using the changeset viewer.