ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/brains/SimInfo.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/brains/SimInfo.hpp (file contents):
Revision 1733 by tim, Fri Nov 12 06:19:04 2004 UTC vs.
Revision 1739 by tim, Mon Nov 15 18:02:15 2004 UTC

# Line 38 | Line 38
38   #include <utility>
39  
40   #include "brains/fSimulation.h"
41 + #include "brains/SimInfo.hpp"
42   #include "primitives/Molecule.hpp"
43   #include "types/MoleculeStamp.hpp"
44   #include "utils/PropertyMap.hpp"
# Line 47 | Line 48 | namespace oopse{
48  
49   /**
50   * @class SimInfo SimInfo.hpp "brains/SimInfo.hpp"
51 < * @brief
51 > * @brief As one of the heavy weight class of OOPSE, SimInfo
52 > * One of the major changes in SimInfo class is the data struct. It only maintains a list of molecules.
53 > * And the Molecule class will maintain all of the concrete objects (atoms, bond, bend, torsions, rigid bodies,
54 > * cutoff groups, constrains).
55 > * Another major change is the index. No matter single version or parallel version,  atoms and
56 > * rigid bodies have both global index and local index. Local index is not important to molecule as well as
57 > * cutoff group.
58   */
59   class SimInfo {
60      public:
61 <        typedef MoleculeIterator MoleculeIterator;
61 >        typedef std::map<int, Molecule*>::iterator  MoleculeIterator;
62  
63          /**
64           * Constructor of SimInfo
# Line 60 | Line 67 | class SimInfo {
67           * @param ff pointer of a concrete ForceField instance
68           * @param globals
69           * @note
63         * <p>
64         * The major change of SimInfo
65         * </p>
70           */
71          SimInfo(const std::vector<std::pair<MoleculeStamp*, int> >& molStampPairs, ForceField* ff, Globals* globals);
72          virtual ~SimInfo();
# Line 94 | Line 98 | class SimInfo {
98          int getNGlobalCutoffGroups() {
99              return nGlobalCutoffGroups_;
100          }
101 +
102 +        /**
103 +         * Returns the total number of integrable objects (total number of rigid bodies plus the total number
104 +         * of atoms which do not belong to the rigid bodies) in the system
105 +         */
106 +        int getNGlobalIntegrableObjects() {
107 +            return nGlobalIntegrableObjects_;
108 +        }
109          
110          /**
111           * Returns the number of local molecules.
# Line 226 | Line 238 | class SimInfo {
238  
239          /** Returns the local index manager */
240          LocalIndexManager* getLocalIndexManager() {
241 <            return localIndexMan_;
241 >            return &localIndexMan_;
242          }
243  
244          int getMoleculeStampId(int globalIndex) {
# Line 251 | Line 263 | class SimInfo {
263              return i != molecules_.end() ? i->second : NULL;
264          }
265  
266 <        /** Returns the unique atom types of local processor in an array */
267 <        std::set<AtomType*> SimInfo::getUniqueAtomTypes();
266 >        /** Calculate the maximum cutoff radius based on the atom types */
267 >        double calcMaxCutoffRadius();
268  
269 +        double getRcut() {
270 +            return rcut_;
271 +        }
272 +
273 +        double getRsw() {
274 +            return rsw_;
275 +        }
276 +        
277          std::string getFinalConfigFileName() {
278              return finalConfigFileName_;
279          }
# Line 262 | Line 282 | class SimInfo {
282              finalConfigFileName_ = fileName;
283          }
284  
265
285          std::string getDumpFileName() {
286              return dumpFileName_;
287          }
# Line 279 | Line 298 | class SimInfo {
298              statFileName_ = fileName;
299          }
300  
301 +        /**
302 +         * Returns the pointer of internal globalGroupMembership_ array. This array will be filled by SimCreator class
303 +         * @see #SimCreator::setGlobalIndex
304 +         */  
305          int* getGlobalGroupMembershipPointer() {
306              return globalGroupMembership_[0];
307 +        }
308 +
309 +        /**
310 +         * Returns the pointer of internal globalMolMembership_ array. This array will be filled by SimCreator class
311 +         * @see #SimCreator::setGlobalIndex
312 +         */        
313 +        int* getGlobalMolMembershipPointer() {
314 +            return globalMolMembership_[0];
315          }
316  
317 +
318 +        bool isFortranInitialized() {
319 +            return fortranInitialized_;
320 +        }
321 +        
322          //below functions are just forward functions
323          //To compose or to inherit is always a hot debate. In general, is-a relation need subclassing, in the
324          //the other hand, has-a relation need composing.
# Line 327 | Line 363 | class SimInfo {
363          
364      private:
365  
366 +        
367 +        /** Returns the unique atom types of local processor in an array */
368 +        std::set<AtomType*> SimInfo::getUniqueAtomTypes();
369 +
370 +        /** fill up the simtype struct*/
371          void setupSimType();
372  
373          /**
# Line 335 | Line 376 | class SimInfo {
376           */
377          void setupFortranSim();
378  
379 +        /** Figure out the radius of cutoff, radius of switching function and pass them to fortran */
380 +        void setupCutoff();
381 +
382          /** Calculates the number of degress of freedom in the whole system */
383          void calcNdf();
384          void calcNdfRaw();
# Line 344 | Line 388 | class SimInfo {
388          void removeExcludePairs(Molecule* mol);
389  
390          /**
391 <         * Adds molecule stamps into
391 >         * Adds molecule stamp and the total number of the molecule with same molecule stamp in the whole
392 >         * system.
393           */
394          void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
395  
# Line 360 | Line 405 | class SimInfo {
405          int nGlobalMols_;       /**< number of molecules in the system */
406          int nGlobalAtoms_;   /**< number of atoms in the system */
407          int nGlobalCutoffGroups_; /**< number of cutoff groups in this system */
408 +        int nGlobalIntegrableObjects_; /**< number of integrable objects in this system */
409  
410          /**
411           * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
# Line 367 | Line 413 | class SimInfo {
413           * It is filled by SimCreator once and only once, since it is never changed during the simulation.
414           */
415          std::vector<int> globalGroupMembership_;
416 +
417 +        /**
418 +         * the size of globalGroupMembership_  is nGlobalAtoms. Its index is  global index of an atom, and the
419 +         * corresponding content is the global index of molecule this atom belong to.
420 +         * It is filled by SimCreator once and only once, since it is never changed during the simulation.
421 +         */
422 +        std::vector<int> globalMolMembership_;        
423 +
424          
425          std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */
426          std::vector<MoleculeStamp*> moleculeStamps_;      /**< molecule stamps array */        
# Line 389 | Line 443 | class SimInfo {
443          Globals* globals_;
444          int seed_; /**< seed for random number generator */
445  
446 +        /**
447 +         * The reason to have a local index manager is that when molecule is migrating to other processors,
448 +         * the atoms and the rigid-bodies will release their local indices to LocalIndexManager. Combining the
449 +         * information of molecule migrating to current processor, Migrator class can query  the LocalIndexManager
450 +         * to make a efficient data moving plan.
451 +         */        
452          LocalIndexManager localIndexMan_;
453  
454 +        //file names
455          std::string finalConfigFileName_;
456          std::string dumpFileName_;
457          std::string statFileName_;
458 +
459 +        double rcut_;       /**< cutoff radius*/
460 +        double rsw_;        /**< radius of switching function*/
461 +
462 +        bool fortranInitialized_; /**< flag indicate whether fortran side is initialized */
463          
464   #ifdef IS_MPI
465      //in Parallel version, we need MolToProc
# Line 409 | Line 475 | class SimInfo {
475              return molToProcMap_[globalIndex];
476          }
477  
478 +        /**
479 +         * Returns the pointer of internal molToProcMap array. This array will be filled by SimCreator class
480 +         * @see #SimCreator::divideMolecules
481 +         */
482          int* getMolToProcMapPointer() {
483              return &molToProcMap_[0];
484          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines