ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/constraints/ConstraintElem.hpp
(Generate patch)

Comparing:
trunk/src/constraints/ConstraintElem.hpp (file contents), Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
branches/development/src/constraints/ConstraintElem.hpp (file contents), Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
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 + *
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 + * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42 <
42 >
43   #ifndef CONSTRAINTS_CONTRAINTELEM_HPP
44   #define CONSTRAINTS_CONTRAINTELEM_HPP
45  
46   #include "primitives/StuntDouble.hpp"
47   #include "utils/GenericData.hpp"
48   #include "utils/simError.h"
49 < namespace oopse {
50 <
51 < /**
52 < * @class ConstraintElem ConstraintElem.hpp "constraints/ConstraintElem.hpp"
53 < * An adapter class of StuntDouble which is used at constraint algorithm
54 < */
55 <
56 < class ConstraintElem{
57 <    public:
58 <        ConstraintElem(StuntDouble* sd) : sd_(sd) {
59 <            GenericData* movedData = sd_->getPropertyByName("Moved");
60 <            if (movedData !=NULL) { //if generic data with keyword "moved" exists, assign it to moved_
61 <                moved_ = dynamic_cast<BoolGenericData*>(movedData);
62 <                if (moved_ == NULL) {
63 <                    sprintf(painCave.errMsg,
64 <                        "Generic Data with keyword Moved exists, however, it can not be casted to a BoolGenericData.\n");
65 <                        painCave.isFatal = 1;;
66 <                    simError();
67 <                }
68 <            }else { //if generic data with keyword "moved" does not exist, create it
69 <                moved_ = new BoolGenericData("Moved");
70 <                sd_->addProperty(moved_);
71 <            }
71 <
72 <            GenericData* movingData = sd_->getPropertyByName("Moving");
73 <            if (movingData !=NULL) {
74 <                moving_ = dynamic_cast<BoolGenericData*>(movingData);
75 <                if (moving_ == NULL) {
76 <                    sprintf(painCave.errMsg,
77 <                        "Generic Data with keyword Moving exists, however, it can not be casted to a BoolGenericData.\n");
78 <                        painCave.isFatal = 1;;
79 <                    simError();
80 <                }
81 <            }else {
82 <                moving_ = new BoolGenericData("Moving");
83 <                sd_->addProperty(moving_);                
84 <            }
85 <            
86 <        }
87 <
88 <        bool getMoved() { return moved_->getData(); }
89 <        void setMoved(bool moved) { moved_->setData(moved);}
90 <
91 <        bool getMoving() { return moving_->getData(); }
92 <        void setMoving(bool moving) { moving_->setData(moving); }
93 <
94 <        StuntDouble* getStuntDouble() { return sd_; }
95 <        
96 <        /**
97 <         * Returns the global index of this stuntdouble.
98 <         * @return  the global index of this stuntdouble
99 <         */
100 <        int getGlobalIndex() {
101 <            return sd_->getGlobalIndex();
102 <        }
103 <
104 <        /**
105 <         * Sets the global index of this stuntdouble.
106 <         * @param new global index to be set
107 <         */
108 <        void setGlobalIndex(int index) {
109 <             sd_->setGlobalIndex(index);
110 <        }
111 <        
112 <        /**
113 <         * Returns the local index of this stuntdouble
114 <         * @return the local index of this stuntdouble
115 <         */
116 <        int getLocalIndex() {
117 <            return sd_->getLocalIndex();
118 <        }
119 <
120 <        /**
121 <         * Sets the local index of this stuntdouble
122 <         * @param index new index to be set
123 <         */        
124 <        void setLocalIndex(int index) {
125 <            sd_->setLocalIndex(index);
126 <        }
127 <
128 <        /**
129 <         * Sets the Snapshot Manager of this stuntdouble
130 <         */
131 <        void setSnapshotManager(SnapshotManager* sman) {
132 <            sd_->setSnapshotManager(sman);
133 <        }
134 <
135 <        /**
136 <         * Tests if this stuntdouble is an atom
137 <         * @return true is this stuntdouble is an atom(or a directional atom), return false otherwise
138 <         */
139 <        bool isAtom(){
140 <            return sd_->isAtom();
141 <        }
142 <
143 <        /**
144 <         * Tests if this stuntdouble is an directional atom
145 <         * @return true if this stuntdouble is an directional atom, return false otherwise
146 <         */
147 <        bool isDirectionalAtom(){
148 <            return sd_->isDirectional();
149 <       }
150 <
151 <        /**
152 <         * Tests if this stuntdouble is a rigid body.
153 <         * @return true if this stuntdouble is a rigid body, otherwise return false
154 <         */
155 <        bool isRigidBody(){
156 <            return sd_->isRigidBody();
157 <        }
158 <
159 <        /**
160 <         * Tests if this stuntdouble is a directional one.
161 <         * @return true is this stuntdouble is a directional atom or a rigid body, return false otherwise
162 <         */
163 <        bool isDirectional(){
164 <            return sd_->isDirectional();
165 <        }
166 <
167 <       /**
168 <         * Returns the previous position of this stuntdouble
169 <         * @return the position of this stuntdouble
170 <         */    
171 <        Vector3d getPrevPos() {
172 <            return sd_->getPrevPos();
173 <        }
174 <      
175 <        /**
176 <         * Returns the current position of this stuntdouble
177 <         * @return the position of this stuntdouble
178 <         */    
179 <        Vector3d getPos() {
180 <            return sd_->getPos();
181 <        }
182 <
183 <       /**
184 <         * Returns the position of this stuntdouble in specified snapshot
185 <         * @return the position of this stuntdouble
186 <         * @param snapshotNo
187 <         */    
188 <        Vector3d getPos(int snapshotNo) {
189 <            return sd_->getPos(snapshotNo);
190 <        }
191 <
192 <       /**
193 <         * Sets  the previous position of this stuntdouble
194 <         * @param pos  new position
195 <         * @see #getPos
196 <         */        
197 <       void setPrevPos(const Vector3d& pos) {
198 <            sd_->setPrevPos(pos);
199 <       }
200 <      
201 <       /**
202 <         * Sets  the current position of this stuntdouble
203 <         * @param pos  new position
204 <         */        
205 <        void setPos(const Vector3d& pos) {
206 <            sd_->setPos(pos);
207 <        }
208 <
209 <       /**
210 <         * Sets  the position of this stuntdouble in specified snapshot
211 <         * @param pos position to be set
212 <         * @param snapshotNo
213 <         * @see #getPos
214 <         */        
215 <        void setPos(const Vector3d& pos, int snapshotNo) {
216 <            sd_->setPos(pos, snapshotNo);
217 <        }
218 <      
219 <       /**
220 <         * Returns the previous velocity of this stuntdouble
221 <         * @return the velocity of this stuntdouble
222 <         */    
223 <        Vector3d getPrevVel() {
224 <            return sd_->getPrevVel();
225 <        }
226 <      
227 <        /**
228 <         * Returns the current velocity of this stuntdouble
229 <         * @return the velocity of this stuntdouble
230 <         */    
231 <        Vector3d getVel() {
232 <            return sd_->getVel();
233 <        }
234 <
235 <       /**
236 <         * Returns the velocity of this stuntdouble in specified snapshot
237 <         * @return the velocity of this stuntdouble
238 <         * @param snapshotNo
239 <         */    
240 <
241 <         Vector3d getVel(int snapshotNo) {
242 <            return sd_->getVel(snapshotNo);
243 <        }
244 <
245 <       /**
246 <         * Sets  the previous velocity of this stuntdouble
247 <         * @param vel  new velocity
248 <         * @see #getVel
249 <         */        
250 <       void setPrevVel(const Vector3d& vel) {
251 <            sd_->setPrevVel(vel);
252 <       }
253 <      
254 <       /**
255 <         * Sets  the current velocity of this stuntdouble
256 <         * @param vel  new velocity
257 <         */        
258 <        void setVel(const Vector3d& vel) {
259 <            sd_->setVel(vel);
260 <        }
261 <
262 <       /**
263 <         * Sets  the velocity of this stuntdouble in specified snapshot
264 <         * @param vel velocity to be set
265 <         * @param snapshotNo
266 <         * @see #getVel
267 <         */        
268 <        void setVel(const Vector3d& vel, int snapshotNo) {
269 <            sd_->setVel(vel, snapshotNo);
270 <        }
271 <
272 <       /**
273 <         * Returns the previous rotation matrix of this stuntdouble
274 <         * @return the rotation matrix of this stuntdouble
275 <         */    
276 <        RotMat3x3d getPrevA() {
277 <            return sd_->getPrevA();
278 <        }
279 <      
280 <        /**
281 <         * Returns the current rotation matrix of this stuntdouble
282 <         * @return the rotation matrix of this stuntdouble
283 <         */    
284 <        RotMat3x3d getA() {
285 <            return sd_->getA();
286 <        }
287 <
288 <       /**
289 <         * Returns the rotation matrix of this stuntdouble in specified snapshot
290 <         *
291 <         * @return the rotation matrix of this stuntdouble
292 <         * @param snapshotNo
293 <         */    
294 <         RotMat3x3d getA(int snapshotNo) {
295 <            return sd_->getA(snapshotNo);
296 <        }
297 <
298 <       /**
299 <         * Sets  the previous rotation matrix of this stuntdouble
300 <         * @param a  new rotation matrix
301 <         * @see #getA
302 <         */        
303 <       void setPrevA(const RotMat3x3d& a) {
304 <            sd_->setPrevA(a);
305 <       }
306 <      
307 <       /**
308 <         * Sets  the current rotation matrix of this stuntdouble
309 <         * @param a  new rotation matrix
310 <         */        
311 <        void setA(const RotMat3x3d& a) {
312 <            sd_->setA(a);
313 <        }
314 <
315 <       /**
316 <         * Sets  the rotation matrix of this stuntdouble in specified snapshot
317 <         * @param a rotation matrix to be set
318 <         * @param snapshotNo
319 <         * @see #getA
320 <         */        
321 <        void setA(const RotMat3x3d& a, int snapshotNo) {
322 <            sd_->setA(a, snapshotNo);
323 <        }      
324 <
325 <       /**
326 <         * Returns the previous angular momentum of this stuntdouble (body-fixed).
327 <         * @return the angular momentum of this stuntdouble
328 <         */    
329 <        Vector3d getPrevJ() {
330 <            return sd_->getPrevJ();
331 <        }
332 <      
333 <        /**
334 <         * Returns the current angular momentum of this stuntdouble (body -fixed).
335 <         * @return the angular momentum of this stuntdouble
336 <         */    
337 <        Vector3d getJ() {
338 <            return sd_->getJ();
339 <        }
340 <
341 <       /**
342 <         * Returns the angular momentum of this stuntdouble in specified snapshot (body-fixed).
343 <         * @return the angular momentum of this stuntdouble
344 <         * @param snapshotNo
345 <         */    
346 <         Vector3d getJ(int snapshotNo) {
347 <            return sd_->getJ(snapshotNo);
348 <        }
349 <
350 <       /**
351 <         * Sets  the previous angular momentum of this stuntdouble (body-fixed).
352 <         * @param angMom  new angular momentum
353 <         * @see #getJ
354 <         */        
355 <       void setPrevJ(const Vector3d& angMom) {
356 <            sd_->setPrevJ(angMom);
357 <       }
358 <      
359 <       /**
360 <         * Sets  the current angular momentum of this stuntdouble (body-fixed).
361 <         * @param angMom  new angular momentum
362 <         */        
363 <        void setJ(const Vector3d& angMom) {
364 <            sd_->setJ(angMom);
365 <        }
366 <
367 <       /**
368 <         * Sets the angular momentum of this stuntdouble in specified snapshot(body-fixed).
369 <         * @param angMom angular momentum to be set
370 <         * @param snapshotNo
371 <         * @see #getJ
372 <         */        
373 <        void setJ(const Vector3d& angMom, int snapshotNo) {
374 <            sd_->setJ(angMom, snapshotNo);
375 <        }
376 <        
377 <       /**
378 <         * Returns the previous quaternion of this stuntdouble
379 <         * @return the quaternion of this stuntdouble
380 <         */    
381 <        Quat4d getPrevQ() {
382 <            return sd_->getPrevQ();
383 <        }
384 <      
385 <        /**
386 <         * Returns the current quaternion of this stuntdouble
387 <         * @return the quaternion of this stuntdouble
388 <         */    
389 <        Quat4d getQ() {
390 <            return sd_->getQ();
391 <        }
392 <
393 <       /**
394 <         * Returns the quaternion of this stuntdouble in specified snapshot
395 <         * @return the quaternion of this stuntdouble
396 <         * @param snapshotNo
397 <         */    
398 <         Quat4d getQ(int snapshotNo) {
399 <            return sd_->getQ(snapshotNo);
400 <        }
401 <
402 <       /**
403 <         * Sets  the previous quaternion of this stuntdouble
404 <         * @param q  new quaternion
405 <         * @note actual storage data is rotation matrix
406 <         */        
407 <       void setPrevQ(const Quat4d& q) {
408 <            sd_->setPrevQ(q);
409 <       }
410 <      
411 <       /**
412 <         * Sets  the current quaternion of this stuntdouble
413 <         * @param q  new quaternion
414 <         * @note actual storage data is rotation matrix
415 <         */        
416 <        void setQ(const Quat4d& q) {
417 <            sd_->setQ(q);
418 <        }
419 <
420 <       /**
421 <         * Sets  the quaternion of this stuntdouble in specified snapshot
422 <         *
423 <         * @param q quaternion to be set
424 <         * @param snapshotNo
425 <         * @note actual storage data is rotation matrix
426 <         */        
427 <        void setQ(const Quat4d& q, int snapshotNo) {
428 <            sd_->setQ(q, snapshotNo);
429 <        }
430 <
431 <       /**
432 <         * Returns the previous euler angles of this stuntdouble
433 <         * @return the euler angles of this stuntdouble
434 <         */    
435 <        Vector3d getPrevEuler() {
436 <            return sd_->getPrevEuler();
437 <        }
438 <      
439 <        /**
440 <         * Returns the current euler angles of this stuntdouble
441 <         * @return the euler angles of this stuntdouble
442 <         */    
443 <        Vector3d getEuler() {
444 <            return sd_->getEuler();
445 <        }
446 <
447 <       /**
448 <         * Returns the euler angles of this stuntdouble in specified snapshot.
449 <         * @return the euler angles of this stuntdouble
450 <         * @param snapshotNo
451 <         */    
452 <         Vector3d getEuler(int snapshotNo) {
453 <            return sd_->getEuler(snapshotNo);
454 <        }
455 <
456 <       /**
457 <         * Sets  the previous euler angles of this stuntdouble.
458 <         * @param euler  new euler angles
459 <         * @see #getEuler
460 <         * @note actual storage data is rotation matrix        
461 <         */        
462 <        void setPrevEuler(const Vector3d& euler) {
463 <            sd_->setPrevEuler(euler);
464 <        }
465 <      
466 <       /**
467 <         * Sets  the current euler angles of this stuntdouble
468 <         * @param euler  new euler angles
469 <         */        
470 <        void setEuler(const Vector3d& euler) {
471 <            sd_->setEuler(euler);
472 <        }
473 <
474 <       /**
475 <         * Sets  the euler angles  of this stuntdouble in specified snapshot
476 <         *
477 <         * @param euler euler angles to be set
478 <         * @param snapshotNo
479 <         * @note actual storage data is rotation matrix                  
480 <         */        
481 <        void setEuler(const Vector3d& euler, int snapshotNo) {
482 <            sd_->setEuler(euler, snapshotNo);
483 <        }
484 <      
485 <       /**
486 <         * Returns the previous unit vectors of this stuntdouble
487 <         * @return the unit vectors of this stuntdouble
488 <         */    
489 <        RotMat3x3d getPrevElectroFrame() {
490 <            return sd_->getPrevElectroFrame();
491 <        }
492 <      
493 <        /**
494 <         * Returns the current unit vectors of this stuntdouble
495 <         * @return the unit vectors of this stuntdouble
496 <         */    
497 <        RotMat3x3d getElectroFrame() {
498 <            return sd_->getElectroFrame();
499 <        }
500 <
501 <       /**
502 <         * Returns the unit vectors of this stuntdouble in specified snapshot
503 <         *
504 <         * @return the unit vectors of this stuntdouble
505 <         * @param snapshotNo
506 <         */    
507 <         RotMat3x3d getElectroFrame(int snapshotNo) {
508 <            return sd_->getElectroFrame(snapshotNo);
509 <        }
510 <
511 <       /**
512 <         * Returns the previous force of this stuntdouble
513 <         * @return the force of this stuntdouble
514 <         */    
515 <        Vector3d getPrevFrc() {
516 <            return sd_->getPrevFrc();
517 <        }
518 <      
519 <        /**
520 <         * Returns the current force of this stuntdouble
521 <         * @return the force of this stuntdouble
522 <         */    
523 <        Vector3d getFrc() {
524 <            return sd_->getFrc();
525 <        }
526 <
527 <       /**
528 <         * Returns the force of this stuntdouble in specified snapshot
529 <         *
530 <         * @return the force of this stuntdouble
531 <         * @param snapshotNo
532 <         */    
533 <         Vector3d getFrc(int snapshotNo) {
534 <            return sd_->getFrc(snapshotNo);
535 <        }
536 <
537 <       /**
538 <         * Sets  the previous force of this stuntdouble
539 <         *
540 <         * @param frc  new force
541 <         * @see #getFrc
542 <         */        
543 <        void setPrevFrc(const Vector3d& frc) {
544 <            sd_->setPrevFrc(frc);
545 <        }
546 <      
547 <       /**
548 <         * Sets  the current force of this stuntdouble
549 <         * @param frc  new force
550 <         */        
551 <        void setFrc(const Vector3d& frc) {
552 <            sd_->setFrc(frc);
553 <        }
554 <
555 <       /**
556 <         * Sets  the force of this stuntdouble in specified snapshot
557 <         *
558 <         * @param frc force to be set
559 <         * @param snapshotNo
560 <         * @see #getFrc
561 <         */        
562 <        void setFrc(const Vector3d& frc, int snapshotNo) {
563 <            sd_->setFrc(frc, snapshotNo);
564 <        }
565 <
566 <       /**
567 <         * Adds force into the previous force of this stuntdouble
568 <         *
569 <         * @param frc  new force
570 <         * @see #getFrc
571 <         */        
572 <       void addPrevFrc(const Vector3d& frc) {
573 <            sd_->addPrevFrc(frc);
574 <       }
575 <      
576 <       /**
577 <         * Adds force into the current force of this stuntdouble
578 <         * @param frc  new force
579 <         */        
580 <        void addFrc(const Vector3d& frc) {
581 <            sd_->addFrc(frc);
582 <        }
583 <
584 <       /**
585 <         * Adds force into the force of this stuntdouble in specified snapshot
586 <         *
587 <         * @param frc force to be set
588 <         * @param snapshotNo
589 <         * @see #getFrc
590 <         */        
591 <        void addFrc(const Vector3d& frc, int snapshotNo) {
592 <            sd_->addFrc(frc, snapshotNo);
593 <        }
594 <
595 <       /**
596 <         * Returns the previous torque of this stuntdouble
597 <         * @return the torque of this stuntdouble
598 <         */    
599 <        Vector3d getPrevTrq() {
600 <            return sd_->getPrevTrq();
601 <        }
602 <      
603 <        /**
604 <         * Returns the current torque of this stuntdouble
605 <         * @return the torque of this stuntdouble
606 <         */    
607 <        Vector3d getTrq() {
608 <            return sd_->getTrq();
609 <        }
610 <
611 <       /**
612 <         * Returns the torque of this stuntdouble in specified snapshot
613 <         *
614 <         * @return the torque of this stuntdouble
615 <         * @param snapshotNo
616 <         */    
617 <         Vector3d getTrq(int snapshotNo) {
618 <            return sd_->getTrq(snapshotNo);
619 <        }
620 <
621 <       /**
622 <         * Sets  the previous torque of this stuntdouble
623 <         *
624 <         * @param trq  new torque
625 <         * @see #getTrq
626 <         */        
627 <        void setPrevTrq(const Vector3d& trq) {
628 <            sd_->setPrevTrq(trq);
629 <        }
630 <      
631 <       /**
632 <         * Sets  the current torque of this stuntdouble
633 <         * @param trq  new torque
634 <         */        
635 <        void setTrq(const Vector3d& trq) {
636 <            sd_->setTrq(trq);
637 <        }
638 <
639 <       /**
640 <         * Sets  the torque of this stuntdouble in specified snapshot
641 <         *
642 <         * @param trq torque to be set
643 <         * @param snapshotNo
644 <         * @see #getTrq
645 <         */        
646 <        void setTrq(const Vector3d& trq, int snapshotNo) {
647 <            sd_->setTrq(trq, snapshotNo);
648 <        }
649 <
650 <       /**
651 <         * Adds torque into the previous torque of this stuntdouble
652 <         *
653 <         * @param trq  new torque
654 <         * @see #getTrq
655 <         */        
656 <        void addPrevTrq(const Vector3d& trq) {
657 <            sd_->addPrevTrq(trq);
658 <        }
659 <      
660 <       /**
661 <         * Adds torque into the current torque of this stuntdouble
662 <         * @param trq  new torque
663 <         */        
664 <        void addTrq(const Vector3d& trq) {
665 <            sd_->addTrq(trq);
666 <        }
667 <
668 <       /**
669 <         * Adds torque into the torque of this stuntdouble in specified snapshot
670 <         *
671 <         * @param trq torque to be add
672 <         * @param snapshotNo
673 <         * @see #getTrq
674 <         */        
675 <        void addTrq(const Vector3d& trq, int snapshotNo) {
676 <            sd_->addTrq(trq, snapshotNo);
677 <        }      
49 > namespace OpenMD {
50 >  
51 >  /**
52 >   * @class ConstraintElem ConstraintElem.hpp "constraints/ConstraintElem.hpp"
53 >   * An adapter class of StuntDouble which is used at constraint algorithm
54 >   */
55 >  
56 >  class ConstraintElem{
57 >  public:
58 >    ConstraintElem(StuntDouble* sd) : sd_(sd) {
59 >      GenericData* movedData = sd_->getPropertyByName("Moved");
60 >      if (movedData !=NULL) { //if generic data with keyword "moved" exists, assign it to moved_
61 >        moved_ = dynamic_cast<BoolGenericData*>(movedData);
62 >        if (moved_ == NULL) {
63 >          sprintf(painCave.errMsg,
64 >                  "Generic Data with keyword Moved exists, however, it can not be casted to a BoolGenericData.\n");
65 >          painCave.isFatal = 1;;
66 >          simError();
67 >        }
68 >      }else { //if generic data with keyword "moved" does not exist, create it
69 >        moved_ = new BoolGenericData("Moved");
70 >        sd_->addProperty(moved_);
71 >      }
72        
73 <        /** Set the force of this stuntdouble to zero */
74 <        void zeroForcesAndTorques() {
75 <            sd_->zeroForcesAndTorques();
76 <        }
77 <       /**
78 <         * Returns the inertia tensor of this stuntdouble
79 <         * @return the inertia tensor of this stuntdouble
80 <         */
81 <        Mat3x3d getI() {
82 <            return sd_->getI();
83 <       }
84 <
85 <       /**
86 <         * Returns the gradient of this stuntdouble
87 <         * @return the gradient of this stuntdouble
88 <         */
89 <        std::vector<double> getGrad() {
90 <            return sd_->getGrad();
91 <       }
92 <
93 <       /**
94 <         * Tests the  if this stuntdouble is a  linear rigidbody
95 <         *
96 <         * @return true if this stuntdouble is a  linear rigidbody, otherwise return false
97 <         * @note atom and directional atom will always return false
98 <         *
99 <         * @see #linearAxis
100 <         */        
101 <        bool isLinear() {
102 <            return sd_->isLinear();
103 <        }
104 <
105 <       /**
106 <         * Returns the linear axis of the rigidbody, atom and directional atom will always return -1
107 <         *
108 <         * @return the linear axis of the rigidbody
109 <         *
110 <         * @see #isLinear
111 <         */
112 <        int linearAxis() {
113 <            return sd_->linearAxis();
114 <        }
115 <
116 <        /** Returns the mass of this stuntdouble */
117 <        double getMass() {
118 <            return sd_->getMass();
119 <        }
120 <
121 <        /**
122 <         * Sets the mass of this stuntdoulbe
123 <         * @param mass the mass to be set
124 <         */        
125 <        void setMass(double mass) {
126 <            sd_->setMass(mass);
127 <        }
128 <
129 <        /** Returns the name of this stuntdouble */
130 <        std::string getType() {
131 <            return sd_->getType();
132 <        }
133 <        
134 <        /** Sets the name of this stuntdouble*/
135 <        void setType(const std::string& name) {
136 <            sd_->setType(name);
137 <        }
138 <
139 <        /**
140 <         * Converts a lab fixed vector to a body fixed vector.
141 <         * @return body fixed vector
142 <         * @param v lab fixed vector
143 <         */
144 <        Vector3d lab2Body(const Vector3d& v) {
145 <            return sd_->lab2Body(v);
146 <        }
147 <
148 <        /**
149 <         * Converts a body fixed vector to a lab fixed vector.
150 <         * @return corresponding lab fixed vector
151 <         * @param v body fixed vector
152 <         */
153 <        Vector3d body2Lab(const Vector3d& v){
154 <            return sd_->body2Lab(v);
155 <        }
156 <        /**
157 <         * <p>
158 <         * The purpose of the Visitor Pattern is to encapsulate an operation that you want to perform on
159 <         * the elements of a data structure. In this way, you can change the operation being performed
160 <         * on a structure without the need of changing the classes of the elements that you are operating
161 <         * on. Using a Visitor pattern allows you to decouple the classes for the data structure and the
162 <         * algorithms used upon them
163 <         * </p>
164 <         * @param v visitor
165 <         */      
166 <        void accept(BaseVisitor* v) {
167 <            sd_->accept(v);
168 <        }
169 <
170 <        //below functions are just forward functions
171 <        /**
172 <         * Adds property into property map
173 <         * @param genData GenericData to be added into PropertyMap
174 <         */
175 <        void addProperty(GenericData* genData){
176 <            sd_->addProperty(genData);
177 <        }
178 <
179 <        /**
180 <         * Removes property from PropertyMap by name
181 <         * @param propName the name of property to be removed
182 <         */
183 <        void removeProperty(const std::string& propName) {
184 <            sd_->removeProperty(propName);
185 <        }
186 <
187 <        /**
188 <         * clear all of the properties
189 <         */
190 <        void clearProperties() {
191 <            sd_->clearProperties();
192 <        }
193 <
194 <        /**
195 <         * Returns all names of properties
196 <         * @return all names of properties
197 <         */
198 <        std::vector<std::string> getPropertyNames() {
199 <            return sd_->getPropertyNames();
200 <        }
201 <
202 <        /**
203 <         * Returns all of the properties in PropertyMap
204 <         * @return all of the properties in PropertyMap
205 <         */      
206 <        std::vector<GenericData*> getProperties() {
207 <            return sd_->getProperties();
208 <        }
209 <
210 <        /**
211 <         * Returns property
212 <         * @param propName name of property
213 <         * @return a pointer point to property with propName. If no property named propName
214 <         * exists, return NULL
215 <         */      
216 <        GenericData* getPropertyByName(const std::string& propName) {
217 <            return sd_->getPropertyByName(propName);
218 <        }
219 <        
220 <    private:
221 <        StuntDouble* sd_;
222 <        BoolGenericData* moved_;
223 <        BoolGenericData* moving_;
224 < };
225 <
73 >      GenericData* movingData = sd_->getPropertyByName("Moving");
74 >      if (movingData !=NULL) {
75 >        moving_ = dynamic_cast<BoolGenericData*>(movingData);
76 >        if (moving_ == NULL) {
77 >          sprintf(painCave.errMsg,
78 >                  "Generic Data with keyword Moving exists, however, it can not be casted to a BoolGenericData.\n");
79 >          painCave.isFatal = 1;;
80 >          simError();
81 >        }
82 >      }else {
83 >        moving_ = new BoolGenericData("Moving");
84 >        sd_->addProperty(moving_);                
85 >      }
86 >      
87 >    }
88 >    
89 >    bool getMoved() { return moved_->getData(); }
90 >    void setMoved(bool moved) { moved_->setData(moved);}
91 >    
92 >    bool getMoving() { return moving_->getData(); }
93 >    void setMoving(bool moving) { moving_->setData(moving); }
94 >    
95 >    StuntDouble* getStuntDouble() { return sd_; }
96 >    
97 >    /**
98 >     * Returns the global index of this stuntRealType.
99 >     * @return  the global index of this stuntdouble
100 >     */
101 >    int getGlobalIndex() {
102 >      return sd_->getGlobalIndex();
103 >    }
104 >    
105 >    /**
106 >     * Sets the global index of this stuntRealType.
107 >     * @param new global index to be set
108 >     */
109 >    void setGlobalIndex(int index) {
110 >      sd_->setGlobalIndex(index);
111 >    }
112 >    
113 >    /**
114 >     * Returns the local index of this stuntdouble
115 >     * @return the local index of this stuntdouble
116 >     */
117 >    int getLocalIndex() {
118 >      return sd_->getLocalIndex();
119 >    }
120 >    
121 >    /**
122 >     * Sets the local index of this stuntdouble
123 >     * @param index new index to be set
124 >     */        
125 >    void setLocalIndex(int index) {
126 >      sd_->setLocalIndex(index);
127 >    }
128 >    
129 >    /**
130 >     * Sets the Snapshot Manager of this stuntdouble
131 >     */
132 >    void setSnapshotManager(SnapshotManager* sman) {
133 >      sd_->setSnapshotManager(sman);
134 >    }
135 >    
136 >    /**
137 >     * Tests if this stuntdouble is an atom
138 >     * @return true is this stuntdouble is an atom(or a directional atom), return false otherwise
139 >     */
140 >    bool isAtom(){
141 >      return sd_->isAtom();
142 >    }
143 >    
144 >    /**
145 >     * Tests if this stuntdouble is an directional atom
146 >     * @return true if this stuntdouble is an directional atom, return false otherwise
147 >     */
148 >    bool isDirectionalAtom(){
149 >      return sd_->isDirectional();
150 >    }
151 >    
152 >    /**
153 >     * Tests if this stuntdouble is a rigid body.
154 >     * @return true if this stuntdouble is a rigid body, otherwise return false
155 >     */
156 >    bool isRigidBody(){
157 >      return sd_->isRigidBody();
158 >    }
159 >    
160 >    /**
161 >     * Tests if this stuntdouble is a directional one.
162 >     * @return true is this stuntdouble is a directional atom or a rigid body, return false otherwise
163 >     */
164 >    bool isDirectional(){
165 >      return sd_->isDirectional();
166 >    }
167 >    
168 >    /**
169 >     * Returns the previous position of this stuntdouble
170 >     * @return the position of this stuntdouble
171 >     */    
172 >    Vector3d getPrevPos() {
173 >      return sd_->getPrevPos();
174 >    }
175 >    
176 >    /**
177 >     * Returns the current position of this stuntdouble
178 >     * @return the position of this stuntdouble
179 >     */    
180 >    Vector3d getPos() {
181 >      return sd_->getPos();
182 >    }
183 >    
184 >    /**
185 >     * Returns the position of this stuntdouble in specified snapshot
186 >     * @return the position of this stuntdouble
187 >     * @param snapshotNo
188 >     */    
189 >    Vector3d getPos(int snapshotNo) {
190 >      return sd_->getPos(snapshotNo);
191 >    }
192 >    
193 >    /**
194 >     * Sets  the previous position of this stuntdouble
195 >     * @param pos  new position
196 >     * @see #getPos
197 >     */        
198 >    void setPrevPos(const Vector3d& pos) {
199 >      sd_->setPrevPos(pos);
200 >    }
201 >    
202 >    /**
203 >     * Sets  the current position of this stuntdouble
204 >     * @param pos  new position
205 >     */        
206 >    void setPos(const Vector3d& pos) {
207 >      sd_->setPos(pos);
208 >    }
209 >    
210 >    /**
211 >     * Sets  the position of this stuntdouble in specified snapshot
212 >     * @param pos position to be set
213 >     * @param snapshotNo
214 >     * @see #getPos
215 >     */        
216 >    void setPos(const Vector3d& pos, int snapshotNo) {
217 >      sd_->setPos(pos, snapshotNo);
218 >    }
219 >    
220 >    /**
221 >     * Returns the previous velocity of this stuntdouble
222 >     * @return the velocity of this stuntdouble
223 >     */    
224 >    Vector3d getPrevVel() {
225 >      return sd_->getPrevVel();
226 >    }
227 >    
228 >    /**
229 >     * Returns the current velocity of this stuntdouble
230 >     * @return the velocity of this stuntdouble
231 >     */    
232 >    Vector3d getVel() {
233 >      return sd_->getVel();
234 >    }
235 >    
236 >    /**
237 >     * Returns the velocity of this stuntdouble in specified snapshot
238 >     * @return the velocity of this stuntdouble
239 >     * @param snapshotNo
240 >     */    
241 >    
242 >    Vector3d getVel(int snapshotNo) {
243 >      return sd_->getVel(snapshotNo);
244 >    }
245 >    
246 >    /**
247 >     * Sets  the previous velocity of this stuntdouble
248 >     * @param vel  new velocity
249 >     * @see #getVel
250 >     */        
251 >    void setPrevVel(const Vector3d& vel) {
252 >      sd_->setPrevVel(vel);
253 >    }
254 >    
255 >    /**
256 >     * Sets  the current velocity of this stuntdouble
257 >     * @param vel  new velocity
258 >     */        
259 >    void setVel(const Vector3d& vel) {
260 >      sd_->setVel(vel);
261 >    }
262 >    
263 >    /**
264 >     * Sets  the velocity of this stuntdouble in specified snapshot
265 >     * @param vel velocity to be set
266 >     * @param snapshotNo
267 >     * @see #getVel
268 >     */        
269 >    void setVel(const Vector3d& vel, int snapshotNo) {
270 >      sd_->setVel(vel, snapshotNo);
271 >    }
272 >    
273 >    /**
274 >     * Returns the previous rotation matrix of this stuntdouble
275 >     * @return the rotation matrix of this stuntdouble
276 >     */    
277 >    RotMat3x3d getPrevA() {
278 >      return sd_->getPrevA();
279 >    }
280 >    
281 >    /**
282 >     * Returns the current rotation matrix of this stuntdouble
283 >     * @return the rotation matrix of this stuntdouble
284 >     */    
285 >    RotMat3x3d getA() {
286 >      return sd_->getA();
287 >    }
288 >    
289 >    /**
290 >     * Returns the rotation matrix of this stuntdouble in specified snapshot
291 >     *
292 >     * @return the rotation matrix of this stuntdouble
293 >     * @param snapshotNo
294 >     */    
295 >    RotMat3x3d getA(int snapshotNo) {
296 >      return sd_->getA(snapshotNo);
297 >    }
298 >    
299 >    /**
300 >     * Sets  the previous rotation matrix of this stuntdouble
301 >     * @param a  new rotation matrix
302 >     * @see #getA
303 >     */        
304 >    void setPrevA(const RotMat3x3d& a) {
305 >      sd_->setPrevA(a);
306 >    }
307 >    
308 >    /**
309 >     * Sets  the current rotation matrix of this stuntdouble
310 >     * @param a  new rotation matrix
311 >     */        
312 >    void setA(const RotMat3x3d& a) {
313 >      sd_->setA(a);
314 >    }
315 >    
316 >    /**
317 >     * Sets  the rotation matrix of this stuntdouble in specified snapshot
318 >     * @param a rotation matrix to be set
319 >     * @param snapshotNo
320 >     * @see #getA
321 >     */        
322 >    void setA(const RotMat3x3d& a, int snapshotNo) {
323 >      sd_->setA(a, snapshotNo);
324 >    }      
325 >    
326 >    /**
327 >     * Returns the previous angular momentum of this stuntdouble (body-fixed).
328 >     * @return the angular momentum of this stuntdouble
329 >     */    
330 >    Vector3d getPrevJ() {
331 >      return sd_->getPrevJ();
332 >    }
333 >    
334 >    /**
335 >     * Returns the current angular momentum of this stuntdouble (body -fixed).
336 >     * @return the angular momentum of this stuntdouble
337 >     */    
338 >    Vector3d getJ() {
339 >      return sd_->getJ();
340 >    }
341 >    
342 >    /**
343 >     * Returns the angular momentum of this stuntdouble in specified snapshot (body-fixed).
344 >     * @return the angular momentum of this stuntdouble
345 >     * @param snapshotNo
346 >     */    
347 >    Vector3d getJ(int snapshotNo) {
348 >      return sd_->getJ(snapshotNo);
349 >    }
350 >    
351 >    /**
352 >     * Sets  the previous angular momentum of this stuntdouble (body-fixed).
353 >     * @param angMom  new angular momentum
354 >     * @see #getJ
355 >     */        
356 >    void setPrevJ(const Vector3d& angMom) {
357 >      sd_->setPrevJ(angMom);
358 >    }
359 >    
360 >    /**
361 >     * Sets  the current angular momentum of this stuntdouble (body-fixed).
362 >     * @param angMom  new angular momentum
363 >     */        
364 >    void setJ(const Vector3d& angMom) {
365 >      sd_->setJ(angMom);
366 >    }
367 >    
368 >    /**
369 >     * Sets the angular momentum of this stuntdouble in specified snapshot(body-fixed).
370 >     * @param angMom angular momentum to be set
371 >     * @param snapshotNo
372 >     * @see #getJ
373 >     */        
374 >    void setJ(const Vector3d& angMom, int snapshotNo) {
375 >      sd_->setJ(angMom, snapshotNo);
376 >    }
377 >    
378 >    /**
379 >     * Returns the previous quaternion of this stuntdouble
380 >     * @return the quaternion of this stuntdouble
381 >     */    
382 >    Quat4d getPrevQ() {
383 >      return sd_->getPrevQ();
384 >    }
385 >    
386 >    /**
387 >     * Returns the current quaternion of this stuntdouble
388 >     * @return the quaternion of this stuntdouble
389 >     */    
390 >    Quat4d getQ() {
391 >      return sd_->getQ();
392 >    }
393 >    
394 >    /**
395 >     * Returns the quaternion of this stuntdouble in specified snapshot
396 >     * @return the quaternion of this stuntdouble
397 >     * @param snapshotNo
398 >     */    
399 >    Quat4d getQ(int snapshotNo) {
400 >      return sd_->getQ(snapshotNo);
401 >    }
402 >    
403 >    /**
404 >     * Sets  the previous quaternion of this stuntdouble
405 >     * @param q  new quaternion
406 >     * @note actual storage data is rotation matrix
407 >     */        
408 >    void setPrevQ(const Quat4d& q) {
409 >      sd_->setPrevQ(q);
410 >    }
411 >    
412 >    /**
413 >     * Sets  the current quaternion of this stuntdouble
414 >     * @param q  new quaternion
415 >     * @note actual storage data is rotation matrix
416 >     */        
417 >    void setQ(const Quat4d& q) {
418 >      sd_->setQ(q);
419 >    }
420 >    
421 >    /**
422 >     * Sets  the quaternion of this stuntdouble in specified snapshot
423 >     *
424 >     * @param q quaternion to be set
425 >     * @param snapshotNo
426 >     * @note actual storage data is rotation matrix
427 >     */        
428 >    void setQ(const Quat4d& q, int snapshotNo) {
429 >      sd_->setQ(q, snapshotNo);
430 >    }
431 >    
432 >    /**
433 >     * Returns the previous euler angles of this stuntdouble
434 >     * @return the euler angles of this stuntdouble
435 >     */    
436 >    Vector3d getPrevEuler() {
437 >      return sd_->getPrevEuler();
438 >    }
439 >    
440 >    /**
441 >     * Returns the current euler angles of this stuntdouble
442 >     * @return the euler angles of this stuntdouble
443 >     */    
444 >    Vector3d getEuler() {
445 >      return sd_->getEuler();
446 >    }
447 >    
448 >    /**
449 >     * Returns the euler angles of this stuntdouble in specified snapshot.
450 >     * @return the euler angles of this stuntdouble
451 >     * @param snapshotNo
452 >     */    
453 >    Vector3d getEuler(int snapshotNo) {
454 >      return sd_->getEuler(snapshotNo);
455 >    }
456 >    
457 >    /**
458 >     * Sets  the previous euler angles of this stuntRealType.
459 >     * @param euler  new euler angles
460 >     * @see #getEuler
461 >     * @note actual storage data is rotation matrix        
462 >     */        
463 >    void setPrevEuler(const Vector3d& euler) {
464 >      sd_->setPrevEuler(euler);
465 >    }
466 >    
467 >    /**
468 >     * Sets  the current euler angles of this stuntdouble
469 >     * @param euler  new euler angles
470 >     */        
471 >    void setEuler(const Vector3d& euler) {
472 >      sd_->setEuler(euler);
473 >    }
474 >    
475 >    /**
476 >     * Sets  the euler angles  of this stuntdouble in specified snapshot
477 >     *
478 >     * @param euler euler angles to be set
479 >     * @param snapshotNo
480 >     * @note actual storage data is rotation matrix                  
481 >     */        
482 >    void setEuler(const Vector3d& euler, int snapshotNo) {
483 >      sd_->setEuler(euler, snapshotNo);
484 >    }
485 >    
486 >    /**
487 >     * Returns the previous unit vectors of this stuntdouble
488 >     * @return the unit vectors of this stuntdouble
489 >     */    
490 >    RotMat3x3d getPrevElectroFrame() {
491 >      return sd_->getPrevElectroFrame();
492 >    }
493 >    
494 >    /**
495 >     * Returns the current unit vectors of this stuntdouble
496 >     * @return the unit vectors of this stuntdouble
497 >     */    
498 >    RotMat3x3d getElectroFrame() {
499 >      return sd_->getElectroFrame();
500 >    }
501 >    
502 >    /**
503 >     * Returns the unit vectors of this stuntdouble in specified snapshot
504 >     *
505 >     * @return the unit vectors of this stuntdouble
506 >     * @param snapshotNo
507 >     */    
508 >    RotMat3x3d getElectroFrame(int snapshotNo) {
509 >      return sd_->getElectroFrame(snapshotNo);
510 >    }
511 >    
512 >    /**
513 >     * Returns the previous force of this stuntdouble
514 >     * @return the force of this stuntdouble
515 >     */    
516 >    Vector3d getPrevFrc() {
517 >      return sd_->getPrevFrc();
518 >    }
519 >    
520 >    /**
521 >     * Returns the current force of this stuntdouble
522 >     * @return the force of this stuntdouble
523 >     */    
524 >    Vector3d getFrc() {
525 >      return sd_->getFrc();
526 >    }
527 >    
528 >    /**
529 >     * Returns the force of this stuntdouble in specified snapshot
530 >     *
531 >     * @return the force of this stuntdouble
532 >     * @param snapshotNo
533 >     */    
534 >    Vector3d getFrc(int snapshotNo) {
535 >      return sd_->getFrc(snapshotNo);
536 >    }
537 >    
538 >    /**
539 >     * Sets  the previous force of this stuntdouble
540 >     *
541 >     * @param frc  new force
542 >     * @see #getFrc
543 >     */        
544 >    void setPrevFrc(const Vector3d& frc) {
545 >      sd_->setPrevFrc(frc);
546 >    }
547 >    
548 >    /**
549 >     * Sets  the current force of this stuntdouble
550 >     * @param frc  new force
551 >     */        
552 >    void setFrc(const Vector3d& frc) {
553 >      sd_->setFrc(frc);
554 >    }
555 >    
556 >    /**
557 >     * Sets  the force of this stuntdouble in specified snapshot
558 >     *
559 >     * @param frc force to be set
560 >     * @param snapshotNo
561 >     * @see #getFrc
562 >     */        
563 >    void setFrc(const Vector3d& frc, int snapshotNo) {
564 >      sd_->setFrc(frc, snapshotNo);
565 >    }
566 >    
567 >    /**
568 >     * Adds force into the previous force of this stuntdouble
569 >     *
570 >     * @param frc  new force
571 >     * @see #getFrc
572 >     */        
573 >    void addPrevFrc(const Vector3d& frc) {
574 >      sd_->addPrevFrc(frc);
575 >    }
576 >    
577 >    /**
578 >     * Adds force into the current force of this stuntdouble
579 >     * @param frc  new force
580 >     */        
581 >    void addFrc(const Vector3d& frc) {
582 >      sd_->addFrc(frc);
583 >    }
584 >    
585 >    /**
586 >     * Adds force into the force of this stuntdouble in specified snapshot
587 >     *
588 >     * @param frc force to be set
589 >     * @param snapshotNo
590 >     * @see #getFrc
591 >     */        
592 >    void addFrc(const Vector3d& frc, int snapshotNo) {
593 >      sd_->addFrc(frc, snapshotNo);
594 >    }
595 >    
596 >    /**
597 >     * Returns the previous torque of this stuntdouble
598 >     * @return the torque of this stuntdouble
599 >     */    
600 >    Vector3d getPrevTrq() {
601 >      return sd_->getPrevTrq();
602 >    }
603 >    
604 >    /**
605 >     * Returns the current torque of this stuntdouble
606 >     * @return the torque of this stuntdouble
607 >     */    
608 >    Vector3d getTrq() {
609 >      return sd_->getTrq();
610 >    }
611 >    
612 >    /**
613 >     * Returns the torque of this stuntdouble in specified snapshot
614 >     *
615 >     * @return the torque of this stuntdouble
616 >     * @param snapshotNo
617 >     */    
618 >    Vector3d getTrq(int snapshotNo) {
619 >      return sd_->getTrq(snapshotNo);
620 >    }
621 >    
622 >    /**
623 >     * Sets  the previous torque of this stuntdouble
624 >     *
625 >     * @param trq  new torque
626 >     * @see #getTrq
627 >     */        
628 >    void setPrevTrq(const Vector3d& trq) {
629 >      sd_->setPrevTrq(trq);
630 >    }
631 >    
632 >    /**
633 >     * Sets  the current torque of this stuntdouble
634 >     * @param trq  new torque
635 >     */        
636 >    void setTrq(const Vector3d& trq) {
637 >      sd_->setTrq(trq);
638 >    }
639 >    
640 >    /**
641 >     * Sets  the torque of this stuntdouble in specified snapshot
642 >     *
643 >     * @param trq torque to be set
644 >     * @param snapshotNo
645 >     * @see #getTrq
646 >     */        
647 >    void setTrq(const Vector3d& trq, int snapshotNo) {
648 >      sd_->setTrq(trq, snapshotNo);
649 >    }
650 >    
651 >    /**
652 >     * Adds torque into the previous torque of this stuntdouble
653 >     *
654 >     * @param trq  new torque
655 >     * @see #getTrq
656 >     */        
657 >    void addPrevTrq(const Vector3d& trq) {
658 >      sd_->addPrevTrq(trq);
659 >    }
660 >    
661 >    /**
662 >     * Adds torque into the current torque of this stuntdouble
663 >     * @param trq  new torque
664 >     */        
665 >    void addTrq(const Vector3d& trq) {
666 >      sd_->addTrq(trq);
667 >    }
668 >    
669 >    /**
670 >     * Adds torque into the torque of this stuntdouble in specified snapshot
671 >     *
672 >     * @param trq torque to be add
673 >     * @param snapshotNo
674 >     * @see #getTrq
675 >     */        
676 >    void addTrq(const Vector3d& trq, int snapshotNo) {
677 >      sd_->addTrq(trq, snapshotNo);
678 >    }      
679 >    
680 >    /** Set the force of this stuntdouble to zero */
681 >    void zeroForcesAndTorques() {
682 >      sd_->zeroForcesAndTorques();
683 >    }
684 >    /**
685 >     * Returns the inertia tensor of this stuntdouble
686 >     * @return the inertia tensor of this stuntdouble
687 >     */
688 >    Mat3x3d getI() {
689 >      return sd_->getI();
690 >    }
691 >    
692 >    /**
693 >     * Returns the gradient of this stuntdouble
694 >     * @return the gradient of this stuntdouble
695 >     */
696 >    std::vector<RealType> getGrad() {
697 >      return sd_->getGrad();
698 >    }
699 >    
700 >    /**
701 >     * Tests the  if this stuntdouble is a  linear rigidbody
702 >     *
703 >     * @return true if this stuntdouble is a  linear rigidbody, otherwise return false
704 >     * @note atom and directional atom will always return false
705 >     *
706 >     * @see #linearAxis
707 >     */        
708 >    bool isLinear() {
709 >      return sd_->isLinear();
710 >    }
711 >    
712 >    /**
713 >     * Returns the linear axis of the rigidbody, atom and directional atom will always return -1
714 >     *
715 >     * @return the linear axis of the rigidbody
716 >     *
717 >     * @see #isLinear
718 >     */
719 >    int linearAxis() {
720 >      return sd_->linearAxis();
721 >    }
722 >    
723 >    /** Returns the mass of this stuntdouble */
724 >    RealType getMass() {
725 >      return sd_->getMass();
726 >    }
727 >    
728 >    /**
729 >     * Sets the mass of this stuntdoulbe
730 >     * @param mass the mass to be set
731 >     */        
732 >    void setMass(RealType mass) {
733 >      sd_->setMass(mass);
734 >    }
735 >    
736 >    /** Returns the name of this stuntdouble */
737 >    std::string getType() {
738 >      return sd_->getType();
739 >    }
740 >    
741 >    /** Sets the name of this stuntRealType*/
742 >    void setType(const std::string& name) {
743 >      sd_->setType(name);
744 >    }
745 >    
746 >    /**
747 >     * Converts a lab fixed vector to a body fixed vector.
748 >     * @return body fixed vector
749 >     * @param v lab fixed vector
750 >     */
751 >    Vector3d lab2Body(const Vector3d& v) {
752 >      return sd_->lab2Body(v);
753 >    }
754 >    
755 >    /**
756 >     * Converts a body fixed vector to a lab fixed vector.
757 >     * @return corresponding lab fixed vector
758 >     * @param v body fixed vector
759 >     */
760 >    Vector3d body2Lab(const Vector3d& v){
761 >      return sd_->body2Lab(v);
762 >    }
763 >    /**
764 >     * <p>
765 >     * The purpose of the Visitor Pattern is to encapsulate an operation that you want to perform on
766 >     * the elements of a data structure. In this way, you can change the operation being performed
767 >     * on a structure without the need of changing the classes of the elements that you are operating
768 >     * on. Using a Visitor pattern allows you to decouple the classes for the data structure and the
769 >     * algorithms used upon them
770 >     * </p>
771 >     * @param v visitor
772 >     */      
773 >    void accept(BaseVisitor* v) {
774 >      sd_->accept(v);
775 >    }
776 >    
777 >    //below functions are just forward functions
778 >    /**
779 >     * Adds property into property map
780 >     * @param genData GenericData to be added into PropertyMap
781 >     */
782 >    void addProperty(GenericData* genData){
783 >      sd_->addProperty(genData);
784 >    }
785 >    
786 >    /**
787 >     * Removes property from PropertyMap by name
788 >     * @param propName the name of property to be removed
789 >     */
790 >    void removeProperty(const std::string& propName) {
791 >      sd_->removeProperty(propName);
792 >    }
793 >    
794 >    /**
795 >     * clear all of the properties
796 >     */
797 >    void clearProperties() {
798 >      sd_->clearProperties();
799 >    }
800 >    
801 >    /**
802 >     * Returns all names of properties
803 >     * @return all names of properties
804 >     */
805 >    std::vector<std::string> getPropertyNames() {
806 >      return sd_->getPropertyNames();
807 >    }
808 >    
809 >    /**
810 >     * Returns all of the properties in PropertyMap
811 >     * @return all of the properties in PropertyMap
812 >     */      
813 >    std::vector<GenericData*> getProperties() {
814 >      return sd_->getProperties();
815 >    }
816 >    
817 >    /**
818 >     * Returns property
819 >     * @param propName name of property
820 >     * @return a pointer point to property with propName. If no property named propName
821 >     * exists, return NULL
822 >     */      
823 >    GenericData* getPropertyByName(const std::string& propName) {
824 >      return sd_->getPropertyByName(propName);
825 >    }
826 >    
827 >  private:
828 >    StuntDouble* sd_;
829 >    BoolGenericData* moved_;
830 >    BoolGenericData* moving_;
831 >  };
832 >  
833   }
834  
835   #endif

Comparing:
trunk/src/constraints/ConstraintElem.hpp (property svn:keywords), Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
branches/development/src/constraints/ConstraintElem.hpp (property svn:keywords), Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines