ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/primitives/StuntDouble.hpp
Revision: 1710
Committed: Fri May 18 21:44:02 2012 UTC (12 years, 11 months ago) by gezelter
File size: 41819 byte(s)
Log Message:
Added an adapter layer between the AtomType and the rest of the code to 
handle the bolt-on capabilities of new types. 

Fixed a long-standing bug in how storageLayout was being set to the maximum
possible value.

Started to add infrastructure for Polarizable and fluc-Q calculations.

File Contents

# User Rev Content
1 gezelter 507 /*
2 gezelter 246 * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3     *
4     * The University of Notre Dame grants you ("Licensee") a
5     * non-exclusive, royalty free, license to use, modify and
6     * redistribute this software in source and binary code form, provided
7     * that the following conditions are met:
8     *
9 gezelter 1390 * 1. Redistributions of source code must retain the above copyright
10 gezelter 246 * notice, this list of conditions and the following disclaimer.
11     *
12 gezelter 1390 * 2. Redistributions in binary form must reproduce the above copyright
13 gezelter 246 * notice, this list of conditions and the following disclaimer in the
14     * documentation and/or other materials provided with the
15     * distribution.
16     *
17     * This software is provided "AS IS," without a warranty of any
18     * kind. All express or implied conditions, representations and
19     * warranties, including any implied warranty of merchantability,
20     * fitness for a particular purpose or non-infringement, are hereby
21     * excluded. The University of Notre Dame and its licensors shall not
22     * be liable for any damages suffered by licensee as a result of
23     * using, modifying or distributing the software or its
24     * derivatives. In no event will the University of Notre Dame or its
25     * licensors be liable for any lost revenue, profit or data, or for
26     * direct, indirect, special, consequential, incidental or punitive
27     * damages, however caused and regardless of the theory of liability,
28     * arising out of the use of or inability to use software, even if the
29     * University of Notre Dame has been advised of the possibility of
30     * such damages.
31 gezelter 1390 *
32     * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
33     * research, please cite the appropriate papers when you publish your
34     * work. Good starting points are:
35     *
36     * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
37     * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
38     * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).
39 gezelter 1665 * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010).
40     * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41 gezelter 246 */
42    
43     /**
44     * @file StuntDouble.hpp
45     * @author tlin
46     * @date 10/22/2004
47     * @version 1.0
48     */
49    
50 gezelter 507 #ifndef PRIMITIVES_STUNTDOUBLE_HPP
51     #define PRIMITIVES_STUNTDOUBLE_HPP
52 gezelter 2
53 gezelter 246 #include <vector>
54 gezelter 2
55 gezelter 246 #include "visitors/BaseVisitor.hpp"
56     #include "math/Quaternion.hpp"
57     #include "math/SquareMatrix3.hpp"
58     #include "math/Vector3.hpp"
59     #include "utils/PropertyMap.hpp"
60     #include "brains/Snapshot.hpp"
61     #include "brains/SnapshotManager.hpp"
62 gezelter 1390 namespace OpenMD{
63 gezelter 2
64 tim 132
65 gezelter 246
66     /**
67     * @class StuntDouble StuntDouble.hpp "Primitives/StuntDouble.hpp"
68     * @brief
69 gezelter 573 * "Don't move, or you're dead! Stand up! Captain, we've got them!"
70     *
71     * "Spectacular stunt, my friends, but all for naught. Turn around
72     * please. Ha. What a pity. What a pity. So, Princess, you thought
73     * you could outwit the imperious forces of...."
74     *
75     * "You idiots! These are not them. You've captured their stunt
76     * doubles! Search the area. Find them! Find them!"
77     *
78 gezelter 246 * StuntDouble is a very strange idea. A StuntDouble stands in for
79     * some object that can be manipulated by the Integrators or
80     * Minimizers. Some of the manipulable objects are Atoms, some are
81     * DirectionalAtoms, and some are RigidBodies. StuntDouble
82     * provides an interface for the Integrators and Minimizers to use,
83     * and does some preliminary sanity checking so that the program
84 gezelter 573 * doesn't try to do something stupid like torque an Atom (The
85     * quotes above are from Spaceballs...)
86     *
87 chuckv 1245 * @note the dynamic data of stuntDouble will be stored outside of the class
88 gezelter 246 */
89 gezelter 507 class StuntDouble{
90     public:
91 gezelter 2
92 gezelter 507 enum ObjectType{
93     otAtom,
94     otDAtom,
95     otRigidBody
96     };
97 gezelter 2
98 gezelter 507 virtual ~StuntDouble();
99 gezelter 246
100 gezelter 507 /**
101 chuckv 1245 * Returns the global index of this stuntDouble.
102     * @return the global index of this stuntDouble
103 gezelter 507 */
104     int getGlobalIndex() {
105     return globalIndex_;
106     }
107 gezelter 2
108 gezelter 507 /**
109 chuckv 1245 * Sets the global index of this stuntDouble.
110 gezelter 507 * @param new global index to be set
111     */
112     void setGlobalIndex(int index) {
113     globalIndex_ = index;
114     }
115 chuckv 1245
116 gezelter 507 /**
117 chuckv 1245 * Returns the local index of this stuntDouble
118     * @return the local index of this stuntDouble
119 gezelter 507 */
120     int getLocalIndex() {
121     return localIndex_;
122     }
123 gezelter 2
124 gezelter 507 /**
125 chuckv 1245 * Sets the local index of this stuntDouble
126 gezelter 507 * @param index new index to be set
127     */
128     void setLocalIndex(int index) {
129     localIndex_ = index;
130     }
131 chuckv 1245
132     int getGlobalIntegrableObjectIndex(){
133     return globalIntegrableObjectIndex_;
134     }
135     void setGlobalIntegrableObjectIndex(int index) {
136     globalIntegrableObjectIndex_ = index;
137     }
138 gezelter 2
139 gezelter 507 /**
140 chuckv 1245 * Sets the Snapshot Manager of this stuntDouble
141 gezelter 507 */
142     void setSnapshotManager(SnapshotManager* sman) {
143     snapshotMan_ = sman;
144     }
145 gezelter 2
146 gezelter 507 /**
147 chuckv 1245 * Tests if this stuntDouble is an atom
148     * @return true is this stuntDouble is an atom(or a directional atom), return false otherwise
149 gezelter 507 */
150     bool isAtom(){
151     return objType_ == otAtom || objType_ == otDAtom;
152     }
153 gezelter 2
154 gezelter 507 /**
155 chuckv 1245 * Tests if this stuntDouble is an directional atom
156     * @return true if this stuntDouble is an directional atom, return false otherwise
157 gezelter 507 */
158     bool isDirectionalAtom(){
159     return objType_ == otDAtom;
160     }
161 gezelter 2
162 gezelter 507 /**
163 chuckv 1245 * Tests if this stuntDouble is a rigid body.
164     * @return true if this stuntDouble is a rigid body, otherwise return false
165 gezelter 507 */
166     bool isRigidBody(){
167     return objType_ == otRigidBody;
168     }
169 gezelter 2
170 gezelter 507 /**
171 chuckv 1245 * Tests if this stuntDouble is a directional one.
172     * @return true is this stuntDouble is a directional atom or a rigid body, return false otherwise
173 gezelter 507 */
174     bool isDirectional(){
175     return isDirectionalAtom() || isRigidBody();
176     }
177 gezelter 2
178 gezelter 507 /**
179 gezelter 945 * Freezes out all velocity, angular velocity, forces and torques
180     * on this StuntDouble. Also computes the number of frozen degrees
181     * of freedom.
182     * @return the total number of frozen degrees of freedom
183     */
184     int freeze() {
185    
186     int fdf = 3;
187    
188     setVel(V3Zero);
189     setFrc(V3Zero);
190     if (isDirectional()){
191     setJ(V3Zero);
192     setTrq(V3Zero);
193     if (isLinear())
194     fdf +=2;
195     else
196     fdf +=3;
197     }
198     return fdf;
199     }
200    
201     /**
202 chuckv 1245 * Returns the previous position of this stuntDouble
203     * @return the position of this stuntDouble
204 gezelter 507 */
205     Vector3d getPrevPos() {
206     return ((snapshotMan_->getPrevSnapshot())->*storage_).position[localIndex_];
207     }
208 gezelter 246
209 gezelter 507 /**
210 chuckv 1245 * Returns the current position of this stuntDouble
211     * @return the position of this stuntDouble
212 gezelter 507 */
213     Vector3d getPos() {
214     return ((snapshotMan_->getCurrentSnapshot())->*storage_).position[localIndex_];
215     }
216 gezelter 2
217 gezelter 507 /**
218 chuckv 1245 * Returns the position of this stuntDouble in specified snapshot
219     * @return the position of this stuntDouble
220 gezelter 507 * @param snapshotNo
221     */
222     Vector3d getPos(int snapshotNo) {
223     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).position[localIndex_];
224     }
225 gezelter 2
226 gezelter 507 /**
227 chuckv 1245 * Sets the previous position of this stuntDouble
228 gezelter 507 * @param pos new position
229     * @see #getPos
230     */
231     void setPrevPos(const Vector3d& pos) {
232     ((snapshotMan_->getPrevSnapshot())->*storage_).position[localIndex_] = pos;
233     }
234 gezelter 246
235 gezelter 507 /**
236 chuckv 1245 * Sets the current position of this stuntDouble
237 gezelter 507 * @param pos new position
238     */
239     void setPos(const Vector3d& pos) {
240     DataStorage& data = snapshotMan_->getCurrentSnapshot()->*storage_;
241     data.position[localIndex_] = pos;
242     //((snapshotMan_->getCurrentSnapshot())->*storage_).position[localIndex_] = pos;
243     }
244 gezelter 2
245 gezelter 507 /**
246 chuckv 1245 * Sets the position of this stuntDouble in specified snapshot
247 gezelter 507 * @param pos position to be set
248     * @param snapshotNo
249     * @see #getPos
250     */
251     void setPos(const Vector3d& pos, int snapshotNo) {
252 gezelter 2
253 gezelter 507 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).position[localIndex_] = pos;
254 gezelter 2
255 gezelter 507 }
256 gezelter 246
257 gezelter 507 /**
258 chuckv 1245 * Returns the previous velocity of this stuntDouble
259     * @return the velocity of this stuntDouble
260 gezelter 507 */
261     Vector3d getPrevVel() {
262     return ((snapshotMan_->getPrevSnapshot())->*storage_).velocity[localIndex_];
263     }
264 gezelter 246
265 gezelter 507 /**
266 chuckv 1245 * Returns the current velocity of this stuntDouble
267     * @return the velocity of this stuntDouble
268 gezelter 507 */
269     Vector3d getVel() {
270     return ((snapshotMan_->getCurrentSnapshot())->*storage_).velocity[localIndex_];
271     }
272 gezelter 2
273 gezelter 507 /**
274 chuckv 1245 * Returns the velocity of this stuntDouble in specified snapshot
275     * @return the velocity of this stuntDouble
276 gezelter 507 * @param snapshotNo
277     */
278     Vector3d getVel(int snapshotNo) {
279     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).velocity[localIndex_];
280     }
281 gezelter 2
282 gezelter 507 /**
283 chuckv 1245 * Sets the previous velocity of this stuntDouble
284 gezelter 507 * @param vel new velocity
285     * @see #getVel
286     */
287     void setPrevVel(const Vector3d& vel) {
288     ((snapshotMan_->getPrevSnapshot())->*storage_).velocity[localIndex_] = vel;
289     }
290 gezelter 246
291 gezelter 507 /**
292 chuckv 1245 * Sets the current velocity of this stuntDouble
293 gezelter 507 * @param vel new velocity
294     */
295     void setVel(const Vector3d& vel) {
296     ((snapshotMan_->getCurrentSnapshot())->*storage_).velocity[localIndex_] = vel;
297     }
298 gezelter 246
299 gezelter 507 /**
300 chuckv 1245 * Sets the velocity of this stuntDouble in specified snapshot
301 gezelter 507 * @param vel velocity to be set
302     * @param snapshotNo
303     * @see #getVel
304     */
305     void setVel(const Vector3d& vel, int snapshotNo) {
306     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).velocity[localIndex_] = vel;
307     }
308 gezelter 246
309 gezelter 507 /**
310 chuckv 1245 * Returns the previous rotation matrix of this stuntDouble
311     * @return the rotation matrix of this stuntDouble
312 gezelter 507 */
313     RotMat3x3d getPrevA() {
314     return ((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_];
315     }
316 gezelter 246
317 gezelter 507 /**
318 chuckv 1245 * Returns the current rotation matrix of this stuntDouble
319     * @return the rotation matrix of this stuntDouble
320 gezelter 507 */
321     RotMat3x3d getA() {
322     return ((snapshotMan_->getCurrentSnapshot())->*storage_).aMat[localIndex_];
323     }
324 gezelter 246
325 gezelter 507 /**
326 chuckv 1245 * Returns the rotation matrix of this stuntDouble in specified snapshot
327 gezelter 507 *
328 chuckv 1245 * @return the rotation matrix of this stuntDouble
329 gezelter 507 * @param snapshotNo
330     */
331     RotMat3x3d getA(int snapshotNo) {
332     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).aMat[localIndex_];
333     }
334 gezelter 246
335 gezelter 507 /**
336 chuckv 1245 * Sets the previous rotation matrix of this stuntDouble
337 gezelter 507 * @param a new rotation matrix
338     * @see #getA
339     */
340     virtual void setPrevA(const RotMat3x3d& a) {
341     ((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_] = a;
342     }
343 gezelter 246
344 gezelter 507 /**
345 chuckv 1245 * Sets the current rotation matrix of this stuntDouble
346 gezelter 507 * @param a new rotation matrix
347     */
348     virtual void setA(const RotMat3x3d& a) {
349     ((snapshotMan_->getCurrentSnapshot())->*storage_).aMat[localIndex_] = a;
350     }
351 gezelter 246
352 gezelter 507 /**
353 chuckv 1245 * Sets the rotation matrix of this stuntDouble in specified snapshot
354 gezelter 507 * @param a rotation matrix to be set
355     * @param snapshotNo
356     * @see #getA
357     */
358     virtual void setA(const RotMat3x3d& a, int snapshotNo) {
359     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).aMat[localIndex_] = a;
360     }
361 gezelter 246
362 gezelter 507 /**
363 chuckv 1245 * Returns the previous angular momentum of this stuntDouble (body-fixed).
364     * @return the angular momentum of this stuntDouble
365 gezelter 507 */
366     Vector3d getPrevJ() {
367     return ((snapshotMan_->getPrevSnapshot())->*storage_).angularMomentum[localIndex_];
368     }
369 gezelter 246
370 gezelter 507 /**
371 chuckv 1245 * Returns the current angular momentum of this stuntDouble (body -fixed).
372     * @return the angular momentum of this stuntDouble
373 gezelter 507 */
374     Vector3d getJ() {
375     return ((snapshotMan_->getCurrentSnapshot())->*storage_).angularMomentum[localIndex_];
376     }
377 gezelter 246
378 gezelter 507 /**
379 chuckv 1245 * Returns the angular momentum of this stuntDouble in specified snapshot (body-fixed).
380     * @return the angular momentum of this stuntDouble
381 gezelter 507 * @param snapshotNo
382     */
383     Vector3d getJ(int snapshotNo) {
384     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).angularMomentum[localIndex_];
385     }
386 gezelter 246
387 gezelter 507 /**
388 chuckv 1245 * Sets the previous angular momentum of this stuntDouble (body-fixed).
389 gezelter 507 * @param angMom new angular momentum
390     * @see #getJ
391     */
392     void setPrevJ(const Vector3d& angMom) {
393     ((snapshotMan_->getPrevSnapshot())->*storage_).angularMomentum[localIndex_] = angMom;
394     }
395 gezelter 246
396 gezelter 507 /**
397 chuckv 1245 * Sets the current angular momentum of this stuntDouble (body-fixed).
398 gezelter 507 * @param angMom new angular momentum
399     */
400     void setJ(const Vector3d& angMom) {
401     ((snapshotMan_->getCurrentSnapshot())->*storage_).angularMomentum[localIndex_] = angMom;
402     }
403 gezelter 246
404 gezelter 507 /**
405 chuckv 1245 * Sets the angular momentum of this stuntDouble in specified snapshot(body-fixed).
406 gezelter 507 * @param angMom angular momentum to be set
407     * @param snapshotNo
408     * @see #getJ
409     */
410     void setJ(const Vector3d& angMom, int snapshotNo) {
411     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).angularMomentum[localIndex_] = angMom;
412     }
413 chuckv 1112
414 gezelter 507 /**
415 chuckv 1245 * Returns system Center of Mass for stuntDouble frame from snapshot
416 chuckv 1112 *
417     */
418     Vector3d getCOM(){
419     return (snapshotMan_->getCurrentSnapshot())->getCOM();
420     }
421    
422     /**
423 chuckv 1245 * Returns system Center of Mass velocity for stuntDouble frame from snapshot
424 chuckv 1112 *
425     */
426    
427     Vector3d getCOMvel(){
428     return (snapshotMan_->getCurrentSnapshot())->getCOMvel();
429     }
430    
431     /**
432 chuckv 1245 * Returns system Center of Mass angular momentum for stuntDouble frame from snapshot
433 chuckv 1112 *
434     */
435     Vector3d getCOMw(){
436     return (snapshotMan_->getCurrentSnapshot())->getCOMw();
437     }
438    
439     /**
440 chuckv 1245 * Returns system Center of Mass for stuntDouble frame from snapshot
441 chuckv 1112 *
442     */
443     Vector3d getCOM(int snapshotNo){
444     return (snapshotMan_->getSnapshot(snapshotNo))->getCOM();
445     }
446    
447     /**
448 chuckv 1245 * Returns system Center of Mass velocity for stuntDouble frame from snapshot
449 chuckv 1112 *
450     */
451    
452     Vector3d getCOMvel(int snapshotNo){
453     return (snapshotMan_->getSnapshot(snapshotNo))->getCOMvel();
454     }
455    
456     /**
457 chuckv 1245 * Returns system Center of Mass angular momentum for stuntDouble frame from snapshot
458 chuckv 1112 *
459     */
460     Vector3d getCOMw(int snapshotNo){
461     return (snapshotMan_->getSnapshot(snapshotNo))->getCOMw();
462     }
463    
464     /**
465 chuckv 1245 * Returns the previous quaternion of this stuntDouble
466     * @return the quaternion of this stuntDouble
467 gezelter 507 */
468     Quat4d getPrevQ() {
469     return ((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_].toQuaternion();
470     }
471 gezelter 246
472 gezelter 507 /**
473 chuckv 1245 * Returns the current quaternion of this stuntDouble
474     * @return the quaternion of this stuntDouble
475 gezelter 507 */
476     Quat4d getQ() {
477     return ((snapshotMan_->getCurrentSnapshot())->*storage_).aMat[localIndex_].toQuaternion();
478     }
479 gezelter 246
480 gezelter 507 /**
481 chuckv 1245 * Returns the quaternion of this stuntDouble in specified snapshot
482     * @return the quaternion of this stuntDouble
483 gezelter 507 * @param snapshotNo
484     */
485     Quat4d getQ(int snapshotNo) {
486     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).aMat[localIndex_].toQuaternion();
487     }
488 gezelter 246
489 gezelter 507 /**
490 chuckv 1245 * Sets the previous quaternion of this stuntDouble
491 gezelter 507 * @param q new quaternion
492     * @note actual storage data is rotation matrix
493     */
494     void setPrevQ(const Quat4d& q) {
495     setPrevA(q);
496     }
497 gezelter 246
498 gezelter 507 /**
499 chuckv 1245 * Sets the current quaternion of this stuntDouble
500 gezelter 507 * @param q new quaternion
501     * @note actual storage data is rotation matrix
502     */
503     void setQ(const Quat4d& q) {
504     setA(q);
505     }
506 gezelter 246
507 gezelter 507 /**
508 chuckv 1245 * Sets the quaternion of this stuntDouble in specified snapshot
509 gezelter 507 *
510     * @param q quaternion to be set
511     * @param snapshotNo
512     * @note actual storage data is rotation matrix
513     */
514     void setQ(const Quat4d& q, int snapshotNo) {
515     setA(q, snapshotNo);
516     }
517 gezelter 246
518 gezelter 507 /**
519 chuckv 1245 * Returns the previous euler angles of this stuntDouble
520     * @return the euler angles of this stuntDouble
521 gezelter 507 */
522     Vector3d getPrevEuler() {
523     return ((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_].toEulerAngles();
524     }
525 gezelter 246
526 gezelter 507 /**
527 chuckv 1245 * Returns the current euler angles of this stuntDouble
528     * @return the euler angles of this stuntDouble
529 gezelter 507 */
530     Vector3d getEuler() {
531     return ((snapshotMan_->getCurrentSnapshot())->*storage_).aMat[localIndex_].toEulerAngles();
532     }
533 gezelter 246
534 gezelter 507 /**
535 chuckv 1245 * Returns the euler angles of this stuntDouble in specified snapshot.
536     * @return the euler angles of this stuntDouble
537 gezelter 507 * @param snapshotNo
538     */
539     Vector3d getEuler(int snapshotNo) {
540     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).aMat[localIndex_].toEulerAngles();
541     }
542 gezelter 246
543 gezelter 507 /**
544 chuckv 1245 * Sets the previous euler angles of this stuntDouble.
545 gezelter 507 * @param euler new euler angles
546     * @see #getEuler
547     * @note actual storage data is rotation matrix
548     */
549     void setPrevEuler(const Vector3d& euler) {
550     ((snapshotMan_->getPrevSnapshot())->*storage_).aMat[localIndex_] = euler;
551     }
552 gezelter 246
553 gezelter 507 /**
554 chuckv 1245 * Sets the current euler angles of this stuntDouble
555 gezelter 507 * @param euler new euler angles
556     */
557     void setEuler(const Vector3d& euler) {
558     ((snapshotMan_->getCurrentSnapshot())->*storage_).aMat[localIndex_] = euler;
559     }
560 gezelter 246
561 gezelter 507 /**
562 chuckv 1245 * Sets the euler angles of this stuntDouble in specified snapshot
563 gezelter 507 *
564     * @param euler euler angles to be set
565     * @param snapshotNo
566     * @note actual storage data is rotation matrix
567     */
568     void setEuler(const Vector3d& euler, int snapshotNo) {
569     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).aMat[localIndex_] = euler;
570     }
571 gezelter 246
572 gezelter 507 /**
573 chuckv 1245 * Returns the previous unit vectors of this stuntDouble
574     * @return the unit vectors of this stuntDouble
575 gezelter 507 */
576     RotMat3x3d getPrevElectroFrame() {
577     return ((snapshotMan_->getPrevSnapshot())->*storage_).electroFrame[localIndex_];
578     }
579 gezelter 246
580 gezelter 507 /**
581 chuckv 1245 * Returns the current unit vectors of this stuntDouble
582     * @return the unit vectors of this stuntDouble
583 gezelter 507 */
584     RotMat3x3d getElectroFrame() {
585     return ((snapshotMan_->getCurrentSnapshot())->*storage_).electroFrame[localIndex_];
586     }
587 gezelter 246
588 gezelter 507 /**
589 chuckv 1245 * Returns the unit vectors of this stuntDouble in specified snapshot
590 gezelter 507 *
591 chuckv 1245 * @return the unit vectors of this stuntDouble
592 gezelter 507 * @param snapshotNo
593     */
594     RotMat3x3d getElectroFrame(int snapshotNo) {
595     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).electroFrame[localIndex_];
596     }
597 gezelter 246
598 gezelter 507 /**
599 chuckv 1245 * Returns the previous force of this stuntDouble
600     * @return the force of this stuntDouble
601 gezelter 507 */
602     Vector3d getPrevFrc() {
603     return ((snapshotMan_->getPrevSnapshot())->*storage_).force[localIndex_];
604     }
605 gezelter 246
606 gezelter 507 /**
607 chuckv 1245 * Returns the current force of this stuntDouble
608     * @return the force of this stuntDouble
609 gezelter 507 */
610     Vector3d getFrc() {
611     return ((snapshotMan_->getCurrentSnapshot())->*storage_).force[localIndex_];
612     }
613 gezelter 246
614 gezelter 507 /**
615 chuckv 1245 * Returns the force of this stuntDouble in specified snapshot
616 gezelter 507 *
617 chuckv 1245 * @return the force of this stuntDouble
618 gezelter 507 * @param snapshotNo
619     */
620     Vector3d getFrc(int snapshotNo) {
621     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).force[localIndex_];
622     }
623 gezelter 246
624 gezelter 507 /**
625 chuckv 1245 * Sets the previous force of this stuntDouble
626 gezelter 507 *
627     * @param frc new force
628     * @see #getFrc
629     */
630     void setPrevFrc(const Vector3d& frc) {
631     ((snapshotMan_->getPrevSnapshot())->*storage_).force[localIndex_] = frc;
632     }
633 gezelter 246
634 gezelter 507 /**
635 chuckv 1245 * Sets the current force of this stuntDouble
636 gezelter 507 * @param frc new force
637     */
638     void setFrc(const Vector3d& frc) {
639     ((snapshotMan_->getCurrentSnapshot())->*storage_).force[localIndex_] = frc;
640     }
641 gezelter 246
642 gezelter 507 /**
643 chuckv 1245 * Sets the force of this stuntDouble in specified snapshot
644 gezelter 507 *
645     * @param frc force to be set
646     * @param snapshotNo
647     * @see #getFrc
648     */
649     void setFrc(const Vector3d& frc, int snapshotNo) {
650     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).force[localIndex_] = frc;
651     }
652 gezelter 246
653 gezelter 507 /**
654 chuckv 1245 * Adds force into the previous force of this stuntDouble
655 gezelter 507 *
656     * @param frc new force
657     * @see #getFrc
658     */
659     void addPrevFrc(const Vector3d& frc) {
660     ((snapshotMan_->getPrevSnapshot())->*storage_).force[localIndex_] += frc;
661     }
662 gezelter 246
663 gezelter 507 /**
664 chuckv 1245 * Adds force into the current force of this stuntDouble
665 gezelter 507 * @param frc new force
666     */
667     void addFrc(const Vector3d& frc) {
668     ((snapshotMan_->getCurrentSnapshot())->*storage_).force[localIndex_] += frc;
669     }
670 gezelter 246
671 gezelter 507 /**
672 chuckv 1245 * Adds force into the force of this stuntDouble in specified snapshot
673 gezelter 507 *
674     * @param frc force to be set
675     * @param snapshotNo
676     * @see #getFrc
677     */
678     void addFrc(const Vector3d& frc, int snapshotNo) {
679     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).force[localIndex_] += frc;
680     }
681 gezelter 246
682 gezelter 507 /**
683 chuckv 1245 * Returns the previous torque of this stuntDouble
684     * @return the torque of this stuntDouble
685 gezelter 507 */
686     Vector3d getPrevTrq() {
687     return ((snapshotMan_->getPrevSnapshot())->*storage_).torque[localIndex_];
688     }
689 gezelter 246
690 gezelter 507 /**
691 chuckv 1245 * Returns the current torque of this stuntDouble
692     * @return the torque of this stuntDouble
693 gezelter 507 */
694     Vector3d getTrq() {
695     return ((snapshotMan_->getCurrentSnapshot())->*storage_).torque[localIndex_];
696     }
697 gezelter 246
698 gezelter 507 /**
699 chuckv 1245 * Returns the torque of this stuntDouble in specified snapshot
700 gezelter 507 *
701 chuckv 1245 * @return the torque of this stuntDouble
702 gezelter 507 * @param snapshotNo
703     */
704     Vector3d getTrq(int snapshotNo) {
705     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).torque[localIndex_];
706     }
707 gezelter 246
708 gezelter 507 /**
709 chuckv 1245 * Sets the previous torque of this stuntDouble
710 gezelter 507 *
711     * @param trq new torque
712     * @see #getTrq
713     */
714     void setPrevTrq(const Vector3d& trq) {
715     ((snapshotMan_->getPrevSnapshot())->*storage_).torque[localIndex_] = trq;
716     }
717 gezelter 246
718 gezelter 507 /**
719 chuckv 1245 * Sets the current torque of this stuntDouble
720 gezelter 507 * @param trq new torque
721     */
722     void setTrq(const Vector3d& trq) {
723     ((snapshotMan_->getCurrentSnapshot())->*storage_).torque[localIndex_] = trq;
724     }
725 gezelter 246
726 gezelter 507 /**
727 chuckv 1245 * Sets the torque of this stuntDouble in specified snapshot
728 gezelter 507 *
729     * @param trq torque to be set
730     * @param snapshotNo
731     * @see #getTrq
732     */
733     void setTrq(const Vector3d& trq, int snapshotNo) {
734     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).torque[localIndex_] = trq;
735     }
736 gezelter 246
737 gezelter 507 /**
738 chuckv 1245 * Adds torque into the previous torque of this stuntDouble
739 gezelter 507 *
740     * @param trq new torque
741     * @see #getTrq
742     */
743     void addPrevTrq(const Vector3d& trq) {
744     ((snapshotMan_->getPrevSnapshot())->*storage_).torque[localIndex_] += trq;
745     }
746 gezelter 246
747 gezelter 507 /**
748 chuckv 1245 * Adds torque into the current torque of this stuntDouble
749 gezelter 507 * @param trq new torque
750     */
751     void addTrq(const Vector3d& trq) {
752     ((snapshotMan_->getCurrentSnapshot())->*storage_).torque[localIndex_] += trq;
753     }
754 gezelter 246
755 gezelter 507 /**
756 chuckv 1245 * Adds torque into the torque of this stuntDouble in specified snapshot
757 gezelter 507 *
758     * @param trq torque to be add
759     * @param snapshotNo
760     * @see #getTrq
761     */
762     void addTrq(const Vector3d& trq, int snapshotNo) {
763     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).torque[localIndex_] += trq;
764     }
765 gezelter 246
766    
767 gezelter 1309
768 gezelter 507 /**
769 gezelter 1309 * Returns the previous particlePot of this stuntDouble
770     * @return the particlePot of this stuntDouble
771     */
772     RealType getPrevParticlePot() {
773     return ((snapshotMan_->getPrevSnapshot())->*storage_).particlePot[localIndex_];
774     }
775    
776     /**
777     * Returns the current particlePot of this stuntDouble
778     * @return the particlePot of this stuntDouble
779     */
780     RealType getParticlePot() {
781     return ((snapshotMan_->getCurrentSnapshot())->*storage_).particlePot[localIndex_];
782     }
783    
784     /**
785     * Returns the particlePot of this stuntDouble in specified snapshot
786     *
787     * @return the particlePot of this stuntDouble
788     * @param snapshotNo
789     */
790     RealType getParticlePot(int snapshotNo) {
791     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).particlePot[localIndex_];
792     }
793    
794     /**
795     * Sets the previous particlePot of this stuntDouble
796     *
797     * @param particlePot new particlePot
798     * @see #getParticlePot
799     */
800     void setPrevParticlePot(const RealType& particlePot) {
801     ((snapshotMan_->getPrevSnapshot())->*storage_).particlePot[localIndex_] = particlePot;
802     }
803    
804     /**
805     * Sets the current particlePot of this stuntDouble
806     * @param particlePot new particlePot
807     */
808     void setParticlePot(const RealType& particlePot) {
809     ((snapshotMan_->getCurrentSnapshot())->*storage_).particlePot[localIndex_] = particlePot;
810     }
811    
812     /**
813     * Sets the particlePot of this stuntDouble in specified snapshot
814     *
815     * @param particlePot particlePot to be set
816     * @param snapshotNo
817     * @see #getParticlePot
818     */
819     void setParticlePot(const RealType& particlePot, int snapshotNo) {
820     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).particlePot[localIndex_] = particlePot;
821     }
822    
823     /**
824     * Adds particlePot into the previous particlePot of this stuntDouble
825     *
826     * @param particlePot new particlePot
827     * @see #getParticlePot
828     */
829     void addPrevParticlePot(const RealType& particlePot) {
830     ((snapshotMan_->getPrevSnapshot())->*storage_).particlePot[localIndex_] += particlePot;
831     }
832    
833     /**
834     * Adds particlePot into the current particlePot of this stuntDouble
835     * @param particlePot new particlePot
836     */
837     void addParticlePot(const RealType& particlePot) {
838     ((snapshotMan_->getCurrentSnapshot())->*storage_).particlePot[localIndex_] += particlePot;
839     }
840    
841     /**
842     * Adds particlePot into the particlePot of this stuntDouble in specified snapshot
843     *
844     * @param particlePot particlePot to be add
845     * @param snapshotNo
846     * @see #getParticlePot
847     */
848     void addParticlePot(const RealType& particlePot, int snapshotNo) {
849     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).particlePot[localIndex_] += particlePot;
850     }
851    
852    
853     /**
854 chuckv 1245 * Returns the previous z-angle of this stuntDouble
855     * @return the z-angle of this stuntDouble
856 gezelter 507 */
857 tim 963 RealType getPrevZangle() {
858 gezelter 507 return ((snapshotMan_->getPrevSnapshot())->*storage_).zAngle[localIndex_];
859     }
860 gezelter 246
861 gezelter 507 /**
862 chuckv 1245 * Returns the current z-angle of this stuntDouble
863     * @return the z-angle of this stuntDouble
864 gezelter 507 */
865 tim 963 RealType getZangle() {
866 gezelter 507 return ((snapshotMan_->getCurrentSnapshot())->*storage_).zAngle[localIndex_];
867     }
868 gezelter 246
869 gezelter 507 /**
870 chuckv 1245 * Returns the z-angle of this stuntDouble in specified snapshot
871     * @return the z-angle of this stuntDouble
872 gezelter 507 * @param snapshotNo
873     */
874 tim 963 RealType getZangle(int snapshotNo) {
875 gezelter 507 return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).zAngle[localIndex_];
876     }
877 gezelter 246
878 gezelter 507 /**
879 chuckv 1245 * Sets the previous z-angle of this stuntDouble
880 gezelter 507 * @param angle new z-angle
881     * @see #getZangle
882     */
883 tim 963 void setPrevZangle(RealType angle) {
884 gezelter 507 ((snapshotMan_->getPrevSnapshot())->*storage_).zAngle[localIndex_] = angle;
885     }
886 gezelter 246
887 gezelter 507 /**
888 chuckv 1245 * Sets the current z-angle of this stuntDouble
889 gezelter 507 * @param angle new z-angle
890     */
891 tim 963 void setZangle(RealType angle) {
892 gezelter 507 ((snapshotMan_->getCurrentSnapshot())->*storage_).zAngle[localIndex_] = angle;
893     }
894 gezelter 246
895 gezelter 507 /**
896 chuckv 1245 * Sets the z-angle of this stuntDouble in specified snapshot
897 gezelter 507 * @param angle z-angle to be set
898     * @param snapshotNo
899     * @see #getZangle
900     */
901 tim 963 void setZangle(RealType angle, int snapshotNo) {
902 gezelter 507 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).zAngle[localIndex_] = angle;
903     }
904 gezelter 246
905 gezelter 507 /**
906 chuckv 1245 * Adds z-angle into the previous z-angle of this stuntDouble
907 gezelter 507 * @param angle new z-angle
908     * @see #getZangle
909     */
910 tim 963 void addPrevZangle(RealType angle) {
911 gezelter 507 ((snapshotMan_->getPrevSnapshot())->*storage_).zAngle[localIndex_] += angle;
912     }
913 gezelter 246
914 gezelter 507 /**
915 chuckv 1245 * Adds z-angle into the current z-angle of this stuntDouble
916 gezelter 507 * @param angle new z-angle
917     */
918 tim 963 void addZangle(RealType angle) {
919 gezelter 507 ((snapshotMan_->getCurrentSnapshot())->*storage_).zAngle[localIndex_] += angle;
920     }
921 gezelter 246
922 gezelter 507 /**
923 chuckv 1245 * Adds z-angle into the z-angle of this stuntDouble in specified snapshot
924 gezelter 507 * @param angle z-angle to be add
925     * @param snapshotNo
926     * @see #getZangle
927     */
928 tim 963 void addZangle(RealType angle, int snapshotNo) {
929 gezelter 507 ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).zAngle[localIndex_] += angle;
930     }
931 gezelter 246
932 gezelter 1710
933     /**
934     * Returns the previous fluctuating charge of this stuntDouble
935     * @return the fluctuating charge of this stuntDouble
936     */
937     RealType getPrevFlucQPos() {
938     return ((snapshotMan_->getPrevSnapshot())->*storage_).flucQPos[localIndex_];
939     }
940    
941     /**
942     * Returns the current fluctuating charge of this stuntDouble
943     * @return the fluctuating charge of this stuntDouble
944     */
945     RealType getFlucQPos() {
946     return ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQPos[localIndex_];
947     }
948    
949     /**
950     * Returns the fluctuating charge of this stuntDouble in specified snapshot
951     * @return the fluctuating charge of this stuntDouble
952     * @param snapshotNo
953     */
954     RealType getFlucQPos(int snapshotNo) {
955     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQPos[localIndex_];
956     }
957    
958     /**
959     * Sets the previous fluctuating charge of this stuntDouble
960     * @param charge new fluctuating charge
961     * @see #getflucQPos
962     */
963     void setPrevFlucQPos(RealType charge) {
964     ((snapshotMan_->getPrevSnapshot())->*storage_).flucQPos[localIndex_] = charge;
965     }
966    
967     /**
968     * Sets the current fluctuating charge of this stuntDouble
969     * @param charge new fluctuating charge
970     */
971     void setFlucQPos(RealType charge) {
972     ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQPos[localIndex_] = charge;
973     }
974    
975     /**
976     * Sets the fluctuating charge of this stuntDouble in specified snapshot
977     * @param charge fluctuating charge to be set
978     * @param snapshotNo
979     * @see #getflucQPos
980     */
981     void setFlucQPos(RealType charge, int snapshotNo) {
982     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQPos[localIndex_] = charge;
983     }
984    
985     /**
986     * Adds fluctuating charge into the previous fluctuating charge of this stuntDouble
987     * @param charge new fluctuating charge
988     * @see #getflucQPos
989     */
990     void addPrevFlucQPos(RealType charge) {
991     ((snapshotMan_->getPrevSnapshot())->*storage_).flucQPos[localIndex_] += charge;
992     }
993    
994     /**
995     * Adds fluctuating charge into the current fluctuating charge of this stuntDouble
996     * @param charge new fluctuating charge
997     */
998     void addFlucQPos(RealType charge) {
999     ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQPos[localIndex_] += charge;
1000     }
1001    
1002     /**
1003     * Adds fluctuating charge into the fluctuating charge of this stuntDouble in specified snapshot
1004     * @param value fluctuating charge to be add
1005     * @param snapshotNo
1006     * @see #getflucQPos
1007     */
1008     void addflucQPos(RealType charge, int snapshotNo) {
1009     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQPos[localIndex_] += charge;
1010     }
1011    
1012    
1013     /**
1014     * Returns the previous charge velocity of this stuntDouble
1015     * @return the charge velocity of this stuntDouble
1016     */
1017     RealType getPrevFlucQVel() {
1018     return ((snapshotMan_->getPrevSnapshot())->*storage_).flucQVel[localIndex_];
1019     }
1020    
1021     /**
1022     * Returns the current charge velocity of this stuntDouble
1023     * @return the charge velocity of this stuntDouble
1024     */
1025     RealType getFlucQVel() {
1026     return ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQVel[localIndex_];
1027     }
1028    
1029     /**
1030     * Returns the charge velocity of this stuntDouble in specified snapshot
1031     * @return the charge velocity of this stuntDouble
1032     * @param snapshotNo
1033     */
1034     RealType getFlucQVel(int snapshotNo) {
1035     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQVel[localIndex_];
1036     }
1037    
1038     /**
1039     * Sets the previous charge velocity of this stuntDouble
1040     * @param cvel new charge velocity
1041     * @see #getflucQVel
1042     */
1043     void setPrevFlucQVel(RealType cvel) {
1044     ((snapshotMan_->getPrevSnapshot())->*storage_).flucQVel[localIndex_] = cvel;
1045     }
1046    
1047     /**
1048     * Sets the current charge velocity of this stuntDouble
1049     * @param cvel new charge velocity
1050     */
1051     void setFlucQVel(RealType cvel) {
1052     ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQVel[localIndex_] = cvel;
1053     }
1054    
1055     /**
1056     * Sets the charge velocity of this stuntDouble in specified snapshot
1057     * @param cvel charge velocity to be set
1058     * @param snapshotNo
1059     * @see #getflucQVel
1060     */
1061     void setFlucQVel(RealType cvel, int snapshotNo) {
1062     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQVel[localIndex_] = cvel;
1063     }
1064    
1065     /**
1066     * Adds charge velocity into the previous charge velocity of this stuntDouble
1067     * @param cvel new charge velocity
1068     * @see #getflucQVel
1069     */
1070     void addPrevFlucQVel(RealType cvel) {
1071     ((snapshotMan_->getPrevSnapshot())->*storage_).flucQVel[localIndex_] += cvel;
1072     }
1073    
1074     /**
1075     * Adds charge velocity into the current charge velocity of this stuntDouble
1076     * @param cvel new charge velocity
1077     */
1078     void addFlucQVel(RealType cvel) {
1079     ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQVel[localIndex_] += cvel;
1080     }
1081    
1082     /**
1083     * Adds charge velocity into the charge velocity of this stuntDouble in specified snapshot
1084     * @param value charge velocity to be add
1085     * @param snapshotNo
1086     * @see #getflucQVel
1087     */
1088     void addflucQVel(RealType cvel, int snapshotNo) {
1089     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQVel[localIndex_] += cvel;
1090     }
1091    
1092    
1093     /**
1094     * Returns the previous charge force of this stuntDouble
1095     * @return the charge force of this stuntDouble
1096     */
1097     RealType getPrevFlucQFrc() {
1098     return ((snapshotMan_->getPrevSnapshot())->*storage_).flucQFrc[localIndex_];
1099     }
1100    
1101     /**
1102     * Returns the current charge force of this stuntDouble
1103     * @return the charge force of this stuntDouble
1104     */
1105     RealType getFlucQFrc() {
1106     return ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQFrc[localIndex_];
1107     }
1108    
1109     /**
1110     * Returns the charge force of this stuntDouble in specified snapshot
1111     * @return the charge force of this stuntDouble
1112     * @param snapshotNo
1113     */
1114     RealType getFlucQFrc(int snapshotNo) {
1115     return ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQFrc[localIndex_];
1116     }
1117    
1118     /**
1119     * Sets the previous charge force of this stuntDouble
1120     * @param cfrc new charge force
1121     * @see #getflucQFrc
1122     */
1123     void setPrevFlucQFrc(RealType cfrc) {
1124     ((snapshotMan_->getPrevSnapshot())->*storage_).flucQFrc[localIndex_] = cfrc;
1125     }
1126    
1127     /**
1128     * Sets the current charge force of this stuntDouble
1129     * @param cfrc new charge force
1130     */
1131     void setFlucQFrc(RealType cfrc) {
1132     ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQFrc[localIndex_] = cfrc;
1133     }
1134    
1135     /**
1136     * Sets the charge force of this stuntDouble in specified snapshot
1137     * @param cfrc charge force to be set
1138     * @param snapshotNo
1139     * @see #getflucQFrc
1140     */
1141     void setFlucQFrc(RealType cfrc, int snapshotNo) {
1142     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQFrc[localIndex_] = cfrc;
1143     }
1144    
1145     /**
1146     * Adds charge force into the previous charge force of this stuntDouble
1147     * @param cfrc new charge force
1148     * @see #getflucQFrc
1149     */
1150     void addPrevFlucQFrc(RealType cfrc) {
1151     ((snapshotMan_->getPrevSnapshot())->*storage_).flucQFrc[localIndex_] += cfrc;
1152     }
1153    
1154     /**
1155     * Adds charge force into the current charge force of this stuntDouble
1156     * @param cfrc new charge force
1157     */
1158     void addFlucQFrc(RealType cfrc) {
1159     ((snapshotMan_->getCurrentSnapshot())->*storage_).flucQFrc[localIndex_] += cfrc;
1160     }
1161    
1162     /**
1163     * Adds charge force into the charge force of this stuntDouble in specified snapshot
1164     * @param value charge force to be add
1165     * @param snapshotNo
1166     * @see #getflucQFrc
1167     */
1168     void addflucQFrc(RealType cfrc, int snapshotNo) {
1169     ((snapshotMan_->getSnapshot(snapshotNo))->*storage_).flucQFrc[localIndex_] += cfrc;
1170     }
1171    
1172    
1173    
1174    
1175 chuckv 1245 /** Set the force of this stuntDouble to zero */
1176 gezelter 507 void zeroForcesAndTorques();
1177     /**
1178 chuckv 1245 * Returns the inertia tensor of this stuntDouble
1179     * @return the inertia tensor of this stuntDouble
1180 gezelter 507 */
1181     virtual Mat3x3d getI() = 0;
1182 gezelter 246
1183 gezelter 507 /**
1184 chuckv 1245 * Returns the gradient of this stuntDouble
1185     * @return the gradient of this stuntDouble
1186 gezelter 507 */
1187 tim 963 virtual std::vector<RealType> getGrad() = 0;
1188 gezelter 246
1189 gezelter 507 /**
1190 chuckv 1245 * Tests the if this stuntDouble is a linear rigidbody
1191 gezelter 507 *
1192 chuckv 1245 * @return true if this stuntDouble is a linear rigidbody, otherwise return false
1193 gezelter 507 * @note atom and directional atom will always return false
1194     *
1195     * @see #linearAxis
1196     */
1197     bool isLinear() {
1198     return linear_;
1199     }
1200 gezelter 246
1201 gezelter 507 /**
1202     * Returns the linear axis of the rigidbody, atom and directional atom will always return -1
1203     *
1204     * @return the linear axis of the rigidbody
1205     *
1206     * @see #isLinear
1207     */
1208     int linearAxis() {
1209     return linearAxis_;
1210     }
1211 gezelter 246
1212 chuckv 1245 /** Returns the mass of this stuntDouble */
1213 tim 963 RealType getMass() {
1214 gezelter 507 return mass_;
1215     }
1216 gezelter 246
1217 gezelter 507 /**
1218     * Sets the mass of this stuntdoulbe
1219     * @param mass the mass to be set
1220     */
1221 tim 963 void setMass(RealType mass) {
1222 gezelter 507 mass_ = mass;
1223     }
1224 gezelter 246
1225 chuckv 1245 /** Returns the name of this stuntDouble */
1226 gezelter 507 virtual std::string getType() = 0;
1227 gezelter 246
1228 chuckv 1245 /** Sets the name of this stuntDouble*/
1229 gezelter 507 virtual void setType(const std::string& name) {}
1230 gezelter 246
1231 gezelter 507 /**
1232     * Converts a lab fixed vector to a body fixed vector.
1233     * @return body fixed vector
1234     * @param v lab fixed vector
1235     */
1236     Vector3d lab2Body(const Vector3d& v) {
1237     return getA() * v;
1238     }
1239 gezelter 246
1240 gezelter 507 Vector3d lab2Body(const Vector3d& v, int frame) {
1241     return getA(frame) * v;
1242     }
1243 tim 334
1244 gezelter 507 /**
1245     * Converts a body fixed vector to a lab fixed vector.
1246     * @return corresponding lab fixed vector
1247     * @param v body fixed vector
1248     */
1249     Vector3d body2Lab(const Vector3d& v){
1250     return getA().transpose() * v;
1251     }
1252 tim 334
1253 gezelter 507 Vector3d body2Lab(const Vector3d& v, int frame){
1254     return getA(frame).transpose() * v;
1255     }
1256 chuckv 1245
1257 gezelter 507 /**
1258     * <p>
1259 cli2 1360 * The purpose of the Visitor Pattern is to encapsulate an
1260     * operation that you want to perform on the elements of a data
1261     * structure. In this way, you can change the operation being
1262     * performed on a structure without the need of changing the
1263     * classes of the elements that you are operating on. Using a
1264     * Visitor pattern allows you to decouple the classes for the data
1265     * structure and the algorithms used upon them
1266 gezelter 507 * </p>
1267     * @param v visitor
1268     */
1269     virtual void accept(BaseVisitor* v) = 0;
1270 gezelter 246
1271 gezelter 507 //below functions are just forward functions
1272     /**
1273     * Adds property into property map
1274     * @param genData GenericData to be added into PropertyMap
1275     */
1276     void addProperty(GenericData* genData);
1277 gezelter 246
1278 gezelter 507 /**
1279     * Removes property from PropertyMap by name
1280     * @param propName the name of property to be removed
1281     */
1282     void removeProperty(const std::string& propName);
1283 gezelter 246
1284 gezelter 507 /**
1285     * clear all of the properties
1286     */
1287     void clearProperties();
1288 gezelter 246
1289 gezelter 507 /**
1290     * Returns all names of properties
1291     * @return all names of properties
1292     */
1293     std::vector<std::string> getPropertyNames();
1294 gezelter 246
1295 gezelter 507 /**
1296     * Returns all of the properties in PropertyMap
1297     * @return all of the properties in PropertyMap
1298     */
1299     std::vector<GenericData*> getProperties();
1300 gezelter 246
1301 gezelter 507 /**
1302     * Returns property
1303     * @param propName name of property
1304     * @return a pointer point to property with propName. If no property named propName
1305     * exists, return NULL
1306     */
1307     GenericData* getPropertyByName(const std::string& propName);
1308 gezelter 246
1309 gezelter 507 protected:
1310 gezelter 246
1311 gezelter 507 StuntDouble(ObjectType objType, DataStoragePointer storage);
1312 gezelter 246
1313 gezelter 507 StuntDouble(const StuntDouble& sd);
1314     StuntDouble& operator=(const StuntDouble& sd);
1315 gezelter 246
1316 gezelter 507 ObjectType objType_;
1317     DataStoragePointer storage_;
1318     SnapshotManager* snapshotMan_;
1319 gezelter 246
1320 gezelter 507 bool linear_;
1321     int linearAxis_;
1322 gezelter 246
1323    
1324 gezelter 507 int globalIndex_;
1325 tim 1024 int globalIntegrableObjectIndex_;
1326 gezelter 507 int localIndex_;
1327 gezelter 246
1328    
1329 tim 963 RealType mass_;
1330 gezelter 246
1331 gezelter 507 private:
1332 gezelter 246
1333 gezelter 507 PropertyMap properties_;
1334     };
1335 gezelter 2
1336 gezelter 1390 }//end namespace OpenMD
1337 gezelter 246 #endif //PRIMITIVES_STUNTDOUBLE_HPP

Properties

Name Value
svn:executable *
svn:keywords Author Id Revision Date