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

Comparing branches/new_design/OOPSE-4/src/primitives/Molecule.hpp (file contents):
Revision 1906 by tim, Tue Jan 4 22:18:36 2005 UTC vs.
Revision 1907 by tim, Thu Jan 6 22:31:07 2005 UTC

# Line 62 | Line 62 | class Molecule {
62          typedef std::vector<RigidBody*>::iterator RigidBodyIterator;
63          typedef std::vector<CutoffGroup*>::iterator CutoffGroupIterator;
64          typedef std::vector<StuntDouble*>::iterator IntegrableObjectIterator;        
65 +        typedef std::vector<ConstraintPair*>::iterator ConstraintPairIterator;
66 +        typedef std::vector<ConstraintElem*>::iterator ConstraintElemIterator;
67 +        
68  
69          Molecule(int stampId, int globalIndex, const std::string& molName);
70          virtual ~Molecule();
# Line 116 | Line 119 | class Molecule {
119          void addCutoffGroup(CutoffGroup* cp);    
120  
121          void addConstraintPair(ConstraintPair* consPair);
122 +        
123 +        void addConstraintElem(ConstraintElem* consElem);
124  
125          /** */
126          void complete();
# Line 164 | Line 169 | class Molecule {
169              assert(i < atoms_.size());
170              return atoms_[i];
171          }
167        /**
168         * Returns the first atom in this molecule and initialize the iterator.
169         * @return the first atom, return NULL if there is not cut off group in this molecule
170         * @param i iteraotr
171         */        
172        Atom* beginAtom(std::vector<Atom*>::iterator& i);
172  
173 <        Atom* nextAtom(std::vector<Atom*>::iterator& i);
173 >        Atom* Molecule::beginAtom(std::vector<Atom*>::iterator& i) {
174 >            i = atoms_.begin();
175 >            return (i == atoms_.end()) ? NULL : *i;
176 >        }
177  
178 <        /**
179 <         * Returns the first bond in this molecule and initialize the iterator.
180 <         * @return the first bond, return NULL if there is not cut off group in this molecule
181 <         * @param i iteraotr
180 <         */
181 <        Bond* beginBond(std::vector<Bond*>::iterator& i);
178 >        Atom* Molecule::nextAtom(std::vector<Atom*>::iterator& i) {
179 >            ++i;
180 >            return (i == atoms_.end()) ? NULL : *i;    
181 >        }
182  
183 <        Bond* nextBond(std::vector<Bond*>::iterator& i);
183 >        Bond* Molecule::beginBond(std::vector<Bond*>::iterator& i) {
184 >            i = bonds_.begin();
185 >            return (i == bonds_.end()) ? NULL : *i;
186 >        }
187  
188 <        /**
189 <         * Returns the first bend in this molecule and initialize the iterator.
190 <         * @return the first bend, return NULL if there is not cut off group in this molecule
188 <         * @param i iteraotr
189 <         */
190 <        Bend* beginBend(std::vector<Bend*>::iterator& i);
188 >        Bond* Molecule::nextBond(std::vector<Bond*>::iterator& i) {
189 >            ++i;
190 >            return (i == bonds_.end()) ? NULL : *i;    
191  
192 <        Bend* nextBend(std::vector<Bend*>::iterator& i);
192 >        }
193  
194 <        /**
195 <         * Returns the first torsion in this molecule and initialize the iterator.
196 <         * @return the first torsion, return NULL if there is not cut off group in this molecule
197 <         * @param i iteraotr
198 <         */
199 <        Torsion* beginTorsion(std::vector<Torsion*>::iterator& i);
200 <        Torsion* nextTorsion(std::vector<Torsion*>::iterator& i);
194 >        Bend* Molecule::beginBend(std::vector<Bend*>::iterator& i) {
195 >            i = bends_.begin();
196 >            return (i == bends_.end()) ? NULL : *i;
197 >        }
198  
199 <        /**
200 <         * Returns the first rigid body in this molecule and initialize the iterator.
201 <         * @return the first rigid body, return NULL if there is not cut off group in this molecule
202 <         * @param i iteraotr
206 <         */
207 <        RigidBody* beginRigidBody(std::vector<RigidBody*>::iterator& i);
199 >        Bend* Molecule::nextBend(std::vector<Bend*>::iterator& i) {
200 >            ++i;
201 >            return (i == bends_.end()) ? NULL : *i;    
202 >        }
203  
204 <        RigidBody* nextRigidBody(std::vector<RigidBody*>::iterator& i);
205 <
206 <        /**
207 <         * Returns the first integrable object in this molecule and initialize the iterator.
213 <         * @return the first integrable object, return NULL if there is not cut off group in this molecule
214 <         * @param i iteraotr
215 <         */
216 <        StuntDouble* beginIntegrableObject(std::vector<StuntDouble*>::iterator& i);
217 <        
218 <        StuntDouble* nextIntegrableObject(std::vector<StuntDouble*>::iterator& i);
204 >        Torsion* Molecule::beginTorsion(std::vector<Torsion*>::iterator& i) {
205 >            i = torsions_.begin();
206 >            return (i == torsions_.end()) ? NULL : *i;
207 >        }
208  
209 <        /**
210 <         * Returns the first cutoff group in this molecule and initialize the iterator.
211 <         * @return the first cutoff group, return NULL if there is not cut off group in this molecule
212 <         * @param i iteraotr
224 <         */
225 <        CutoffGroup* beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
209 >        Torsion* Molecule::nextTorsion(std::vector<Torsion*>::iterator& i) {
210 >            ++i;
211 >            return (i == torsions_.end()) ? NULL : *i;    
212 >        }    
213  
214 <        /**
215 <         * Returns next cutoff group based on the iterator
216 <         * @return next cutoff group
217 <         * @param i
231 <         */        
232 <        CutoffGroup* nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i);
214 >        RigidBody* Molecule::beginRigidBody(std::vector<RigidBody*>::iterator& i) {
215 >            i = rigidBodies_.begin();
216 >            return (i == rigidBodies_.end()) ? NULL : *i;
217 >        }
218  
219 <        ConstraintPair* beginConstraintPair(std::vector<ConstraintPair*>::iterator& i);
219 >        RigidBody* Molecule::nextRigidBody(std::vector<RigidBody*>::iterator& i) {
220 >            ++i;
221 >            return (i == rigidBodies_.end()) ? NULL : *i;    
222 >        }
223  
224 <        ConstraintPair* nextConstraintPair(std::vector<ConstraintPair*>::iterator& i);
225 <        
224 >        StuntDouble* Molecule::beginIntegrableObject(std::vector<StuntDouble*>::iterator& i) {
225 >            i = integrableObjects_.begin();
226 >            return (i == integrableObjects_.end()) ? NULL : *i;
227 >        }
228  
229 +        StuntDouble* Molecule::nextIntegrableObject(std::vector<StuntDouble*>::iterator& i) {
230 +            ++i;
231 +            return (i == integrableObjects_.end()) ? NULL : *i;    
232 +        }    
233 +
234 +        CutoffGroup* Molecule::beginCutoffGroup(std::vector<CutoffGroup*>::iterator& i) {
235 +            i = cutoffGroups_.begin();
236 +            return (i == cutoffGroups_.end()) ? NULL : *i;
237 +        }
238 +
239 +        CutoffGroup* Molecule::nextCutoffGroup(std::vector<CutoffGroup*>::iterator& i) {            
240 +            ++i;
241 +            return (i == cutoffGroups_.end()) ? NULL : *i;    
242 +        }
243 +
244 +        ConstraintPair* Molecule::beginConstraintPair(std::vector<ConstraintPair*>::iterator& i) {
245 +            i = constraintPairs_.begin();
246 +            return (i == constraintPairs_.end()) ? NULL : *i;
247 +        }
248 +
249 +        ConstraintPair* Molecule::nextConstraintPair(std::vector<ConstraintPair*>::iterator& i) {            
250 +            ++i;
251 +            return (i == constraintPairs_.end()) ? NULL : *i;    
252 +        }        
253 +
254 +        ConstraintElem* Molecule::beginConstraintElem(std::vector<ConstraintElem*>::iterator& i) {
255 +            i = constraintElems_.begin();
256 +            return (i == constraintElems_.end()) ? NULL : *i;
257 +        }
258 +
259 +        ConstraintElem* Molecule::nextConstraintElem(std::vector<ConstraintElem*>::iterator& i) {            
260 +            ++i;
261 +            return (i == constraintElems_.end()) ? NULL : *i;    
262 +        }
263 +        
264          /** return the total potential energy of short range interaction of this molecule */
265          double getPotential();
266  
# Line 268 | Line 293 | class Molecule {
293          std::vector<StuntDouble*> integrableObjects_;
294          std::vector<CutoffGroup*> cutoffGroups_;
295          std::vector<ConstraintPair*> constraintPairs_;
296 <
296 >        std::vector<ConstraintElem*> constraintElems_;
297          int stampId_;
298          std::string moleculeName_;
299   };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines