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

Comparing branches/new_design/OOPSE-3.0/src/brains/SimInfo.hpp (file contents):
Revision 1722 by tim, Tue Nov 9 23:11:39 2004 UTC vs.
Revision 1726 by tim, Wed Nov 10 22:50:03 2004 UTC

# Line 51 | Line 51 | class SimInfo {
51   */
52   class SimInfo {
53      public:
54 +        typedef MoleculeIterator MoleculeIterator;
55          SimInfo();
56          virtual ~SimInfo();
57  
# Line 67 | Line 68 | class SimInfo {
68           */
69          bool removeMolecule(Molecule* mol);
70  
71 +        /** Returns the total number of molecules in the system. */
72 +        int getNGlobalMolecules() {
73 +
74 + #ifdef IS_MPI
75 +        int nmols;
76 +        int totNMols;
77 +
78 +        nmols = getNMolecules();
79 +        MPI_Allreduce(&nmols, &totNMols, 1, MPI_INT,MPI_SUM, MPI_COMM_WORLD);
80 +
81 +        return totNMols;
82 + #else
83 +            return getNMolecules();
84 + #endif
85 +        }
86 +
87 +        /** Returns the total number of atoms in the system. */
88 +        int getNGlobalAtoms() {
89 +
90 + #ifdef IS_MPI
91 +        int totNAtoms;
92 +        MPI_Allreduce(&nAtoms_, &totNAtoms, 1, MPI_INT,MPI_SUM, MPI_COMM_WORLD);
93 +        return totNAtoms;
94 + #else
95 +            return nAtoms_;
96 + #endif
97 +        }
98 +
99 +        /** Returns the total number of cutoff groups in the system. */
100 +        int getNGlobalCutoffGroups() {
101 + #ifdef IS_MPI
102 +        int totNGroups;
103 +        MPI_Allreduce(&nCutoffGroups_, &totNGroups, 1, MPI_INT,MPI_SUM, MPI_COMM_WORLD);
104 +        return totNGroups;
105 + #else
106 +            return nCutoffGroups_;
107 + #endif
108 +        }
109 +        
110          /**
111 <         * Returns the number of molecules.
112 <         * @return the number of molecules in this SimInfo
111 >         * Returns the number of local molecules.
112 >         * @return the number of local molecules
113           */
114          int getNMolecules() {
115              return molecules_.size();
116          }
117  
118 <        /** Returns the total number of atoms in this SimInfo */
118 >        /** Returns the number of local atoms */
119          unsigned int getNAtoms() {
120              return nAtoms_;
121          }
122  
123 <        /** Returns the total number of bonds in this SimInfo */        
123 >        /** Returns the number of local bonds */        
124          unsigned int getNBonds(){
125              return nBonds_;
126          }
127  
128 <        /** Returns the total number of bends in this SimInfo */        
128 >        /** Returns the number of local bends */        
129          unsigned int getNBends() {
130              return nBends_;
131          }
132  
133 <        /** Returns the total number of torsions in this SimInfo */        
133 >        /** Returns the number of local torsions */        
134          unsigned int getNTorsions() {
135              return nTorsions_;
136          }
137  
138 <        /** Returns the total number of rigid bodies in this SimInfo */        
138 >        /** Returns the number of local rigid bodies */        
139          unsigned int getNRigidBodies() {
140              return nRigidBodies_;
141          }
142  
143 <        /** Returns the total number of integrable objects in this SimInfo */
143 >        /** Returns the number of local integrable objects */
144          unsigned int getNIntegrableObjects() {
145              return nIntegrableObjects_;
146          }
147  
148 <        /** Returns the total number of cutoff groups in this SimInfo */
148 >        /** Returns the number of local cutoff groups */
149          unsigned int getNCutoffGroups() {
150              return nCutoffGroups_;
151          }
# Line 120 | Line 160 | class SimInfo {
160           * @return the first molecule, return NULL if there is not molecule in this SimInfo
161           * @param i the iterator of molecule array (user shouldn't change it)
162           */
163 <        Molecule* beginMolecule(std::vector<Molecule*>::iterator& i);
163 >        Molecule* beginMolecule(MoleculeIterator& i);
164  
165          /**
166            * Returns the next avaliable Molecule based on the iterator.
167            * @return the next avaliable molecule, return NULL if reaching the end of the array
168            * @param i the iterator of molecule array
169            */
170 <        Molecule* nextMolecule(std::vector<Molecule*>::iterator& i);
170 >        Molecule* nextMolecule(MoleculeIterator& i);
171  
172          /** Returns the number of degrees of freedom */
173          int getNdf() {
# Line 172 | Line 212 | class SimInfo {
212              globals_ = globals;
213          }
214  
215 <        int* getExcludeList() {
176 <            return exclude_.getExcludeList();
177 <        }
178 <
215 >        /** Returns the velocity of center of mass of the whole system.*/
216          Vector3d getComVel();
217 <        
217 >
218 >        /** Returns the center of the mass of the whole system.*/
219          Vector3d getCom();
220  
221 +        /** Returns the seed (used for random number generator) */
222          int getSeed() {
223              return seed_;
224          }
225  
226 +        /** Sets the seed*/
227          void setSeed(int seed) {
228              seed_ = seed;
229 +        }
230 +
231 +        
232 +        void update();
233 +
234 +
235 +        /** Returns the local index manager */
236 +        LocalIndexManager* getLocalIndexManager() {
237 +            return localIndexMan_;
238          }
239 +
240 +
241 +        /**
242 +         *
243 +         */
244 +        void addMoleculeStamp(MoleculeStamp* molStamp, int nmol);
245 +
246 +        int getMoleculeStampId(int globalIndex) {
247 +            //assert(globalIndex < molStampIds_.size())
248 +            return molStampIds_[globalIndex];
249 +        }
250 +
251 +        /** Returns the molecule stamp */
252 +        MoleculeStamp* getMoleculeStamp(int id) {
253 +            return moleculeStamps_[id];
254 +        }
255          
256 +        /**
257 +         * Finds the processor where a molecule resides
258 +         * @return the id of the processor which contains the molecule
259 +         * @param globalIndex global Index of the molecule
260 +         */
261 +        int getMolToProc(int globalIndex) {
262 +            //assert(globalIndex < molToProcMap_.size());
263 +            return molToProcMap_[globalIndex];
264 +        }
265 +
266 +        /**
267 +         * Finds a molecule with a specified global index
268 +         * @return a pointer point to found molecule
269 +         * @param index
270 +         */
271 +        Molecule* getMoleculeByGlobalIndex(int index) {
272 +            std::map<int, Molecule*> i;
273 +            i = molecules_.find(index);
274 +
275 +            return i != molecules_.end() ? i->second : NULL;
276 +        }
277 +
278 +        friend std::ostream& operator <<(ostream& o, SimInfo& info);
279 +        
280      private:
281  
282          void calcNdf();
283          void calcNdfRaw();
284          void calcNdfTrans();
285  
286 +        int* getExcludeList() {
287 +            return exclude_.getExcludeList();
288 +        }
289 +
290          void addExcludePairs(Molecule* mol);
291          void removeExcludePairs(Molecule* mol);
292  
293 <        int ndf_;
293 >        //degress of freedom
294 >        int ndf_;           /** number of degress of freedom */
295          int ndfRaw_;
296 <        int ndfTrans_;
297 <        
296 >        int ndfTrans_; /**< number of translation degress of freedom */
297 >
298 >        //number of local objects
299          int nAtoms_;
300          int nBonds_;
301          int nBends_;
# Line 214 | Line 309 | class SimInfo {
309          Exclude exclude_;
310          ForceField* forceField_;
311          
312 <        std::vector<Molecule*> molecules_; /**< Molecule array */
313 <        PropertyMap properties_;                  /** Generic Property */
314 <        SnapshotManager* sman_;               /** SnapshotManager */
312 >       std::map<int, Molecule*>  molecules_; /**< Molecule array */
313 >        PropertyMap properties_;                  /**< Generic Property */
314 >        SnapshotManager* sman_;               /**< SnapshotManager */
315  
221        std::vector<std::pair<MoleculeStamp*, int> > moleculeStamps_;
316          Globals* globals_;
317  
318 <        int seed_;
318 >        int seed_; /**< seed for random number generator */
319 >
320 >        LocalIndexManager localIndexMan_;
321 >
322 >        //
323 >        std::vector<int> molToProcMap_;
324 >        std::vector<int> molStampIds_;                                /**< stamp id array of all molecules in the system */
325 >        std::vector<MoleculeStamp*> moleculeStamps_; /**< molecule stamps array */      
326 >
327   };
328  
329   } //namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines