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 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
branches/development/src/constraints/ConstraintElem.hpp (file contents), Revision 1850 by gezelter, Wed Feb 20 15:39:39 2013 UTC

# 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, 234107 (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 <
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 <      }
72 <      
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 stuntdouble.
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 stuntdouble.
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 stuntdouble.
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<double> 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 <    double 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(double 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 stuntdouble*/
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
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 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 >      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 index 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 dipole vector of this stuntDouble
488 >     * @return the dipole vector of this stuntDouble
489 >     */    
490 >    Vector3d getPrevDipole() {
491 >      return sd_->getPrevDipole();
492 >    }
493 >    
494 >    /**
495 >     * Returns the current dipole vector of this stuntDouble
496 >     * @return the dipole vector of this stuntDouble
497 >     */    
498 >    Vector3d getDipole() {
499 >      return sd_->getDipole();
500 >    }
501 >    
502 >    /**
503 >     * Returns the dipole vector of this stuntDouble in specified snapshot
504 >     *
505 >     * @return the dipole vector of this stuntDouble
506 >     * @param snapshotNo
507 >     */    
508 >    Vector3d getDipole(int snapshotNo) {
509 >      return sd_->getDipole(snapshotNo);
510 >    }
511 >
512 >
513 >    /**
514 >     * Returns the previous quadrupole tensor of this stuntDouble
515 >     * @return the quadrupole tensor of this stuntDouble
516 >     */    
517 >    Mat3x3d getPrevQuadrupole() {
518 >      return sd_->getPrevQuadrupole();
519 >    }
520 >    
521 >    /**
522 >     * Returns the current quadrupole tensor of this stuntDouble
523 >     * @return the quadrupole tensor of this stuntDouble
524 >     */    
525 >    Mat3x3d getQuadrupole() {
526 >      return sd_->getQuadrupole();
527 >    }
528 >    
529 >    /**
530 >     * Returns the quadrupole tensor of this stuntDouble in specified snapshot
531 >     *
532 >     * @return the quadrupole tensor of this stuntDouble
533 >     * @param snapshotNo
534 >     */    
535 >    Mat3x3d getQuadrupole(int snapshotNo) {
536 >      return sd_->getQuadrupole(snapshotNo);
537 >    }
538 >
539 >    /**
540 >     * Returns the previous force of this stuntdouble
541 >     * @return the force of this stuntdouble
542 >     */    
543 >    Vector3d getPrevFrc() {
544 >      return sd_->getPrevFrc();
545 >    }
546 >    
547 >    /**
548 >     * Returns the current force of this stuntdouble
549 >     * @return the force of this stuntdouble
550 >     */    
551 >    Vector3d getFrc() {
552 >      return sd_->getFrc();
553 >    }
554 >    
555 >    /**
556 >     * Returns the force of this stuntdouble in specified snapshot
557 >     *
558 >     * @return the force of this stuntdouble
559 >     * @param snapshotNo
560 >     */    
561 >    Vector3d getFrc(int snapshotNo) {
562 >      return sd_->getFrc(snapshotNo);
563 >    }
564 >    
565 >    /**
566 >     * Sets  the previous force of this stuntdouble
567 >     *
568 >     * @param frc  new force
569 >     * @see #getFrc
570 >     */        
571 >    void setPrevFrc(const Vector3d& frc) {
572 >      sd_->setPrevFrc(frc);
573 >    }
574 >    
575 >    /**
576 >     * Sets  the current force of this stuntdouble
577 >     * @param frc  new force
578 >     */        
579 >    void setFrc(const Vector3d& frc) {
580 >      sd_->setFrc(frc);
581 >    }
582 >    
583 >    /**
584 >     * Sets  the force of this stuntdouble in specified snapshot
585 >     *
586 >     * @param frc force to be set
587 >     * @param snapshotNo
588 >     * @see #getFrc
589 >     */        
590 >    void setFrc(const Vector3d& frc, int snapshotNo) {
591 >      sd_->setFrc(frc, snapshotNo);
592 >    }
593 >    
594 >    /**
595 >     * Adds force into the previous force of this stuntdouble
596 >     *
597 >     * @param frc  new force
598 >     * @see #getFrc
599 >     */        
600 >    void addPrevFrc(const Vector3d& frc) {
601 >      sd_->addPrevFrc(frc);
602 >    }
603 >    
604 >    /**
605 >     * Adds force into the current force of this stuntdouble
606 >     * @param frc  new force
607 >     */        
608 >    void addFrc(const Vector3d& frc) {
609 >      sd_->addFrc(frc);
610 >    }
611 >    
612 >    /**
613 >     * Adds force into the force of this stuntdouble in specified snapshot
614 >     *
615 >     * @param frc force to be set
616 >     * @param snapshotNo
617 >     * @see #getFrc
618 >     */        
619 >    void addFrc(const Vector3d& frc, int snapshotNo) {
620 >      sd_->addFrc(frc, snapshotNo);
621 >    }
622 >    
623 >    /**
624 >     * Returns the previous torque of this stuntdouble
625 >     * @return the torque of this stuntdouble
626 >     */    
627 >    Vector3d getPrevTrq() {
628 >      return sd_->getPrevTrq();
629 >    }
630 >    
631 >    /**
632 >     * Returns the current torque of this stuntdouble
633 >     * @return the torque of this stuntdouble
634 >     */    
635 >    Vector3d getTrq() {
636 >      return sd_->getTrq();
637 >    }
638 >    
639 >    /**
640 >     * Returns the torque of this stuntdouble in specified snapshot
641 >     *
642 >     * @return the torque of this stuntdouble
643 >     * @param snapshotNo
644 >     */    
645 >    Vector3d getTrq(int snapshotNo) {
646 >      return sd_->getTrq(snapshotNo);
647 >    }
648 >    
649 >    /**
650 >     * Sets  the previous torque of this stuntdouble
651 >     *
652 >     * @param trq  new torque
653 >     * @see #getTrq
654 >     */        
655 >    void setPrevTrq(const Vector3d& trq) {
656 >      sd_->setPrevTrq(trq);
657 >    }
658 >    
659 >    /**
660 >     * Sets  the current torque of this stuntdouble
661 >     * @param trq  new torque
662 >     */        
663 >    void setTrq(const Vector3d& trq) {
664 >      sd_->setTrq(trq);
665 >    }
666 >    
667 >    /**
668 >     * Sets  the torque of this stuntdouble in specified snapshot
669 >     *
670 >     * @param trq torque to be set
671 >     * @param snapshotNo
672 >     * @see #getTrq
673 >     */        
674 >    void setTrq(const Vector3d& trq, int snapshotNo) {
675 >      sd_->setTrq(trq, snapshotNo);
676 >    }
677 >    
678 >    /**
679 >     * Adds torque into the previous torque of this stuntdouble
680 >     *
681 >     * @param trq  new torque
682 >     * @see #getTrq
683 >     */        
684 >    void addPrevTrq(const Vector3d& trq) {
685 >      sd_->addPrevTrq(trq);
686 >    }
687 >    
688 >    /**
689 >     * Adds torque into the current torque of this stuntdouble
690 >     * @param trq  new torque
691 >     */        
692 >    void addTrq(const Vector3d& trq) {
693 >      sd_->addTrq(trq);
694 >    }
695 >    
696 >    /**
697 >     * Adds torque into the torque of this stuntdouble in specified snapshot
698 >     *
699 >     * @param trq torque to be add
700 >     * @param snapshotNo
701 >     * @see #getTrq
702 >     */        
703 >    void addTrq(const Vector3d& trq, int snapshotNo) {
704 >      sd_->addTrq(trq, snapshotNo);
705 >    }      
706 >    
707 >    /** Set the force of this stuntdouble to zero */
708 >    void zeroForcesAndTorques() {
709 >      sd_->zeroForcesAndTorques();
710 >    }
711 >    /**
712 >     * Returns the inertia tensor of this stuntdouble
713 >     * @return the inertia tensor of this stuntdouble
714 >     */
715 >    Mat3x3d getI() {
716 >      return sd_->getI();
717 >    }
718 >    
719 >    /**
720 >     * Returns the gradient of this stuntdouble
721 >     * @return the gradient of this stuntdouble
722 >     */
723 >    std::vector<RealType> getGrad() {
724 >      return sd_->getGrad();
725 >    }
726 >    
727 >    /**
728 >     * Tests the  if this stuntdouble is a  linear rigidbody
729 >     *
730 >     * @return true if this stuntdouble is a  linear rigidbody, otherwise return false
731 >     * @note atom and directional atom will always return false
732 >     *
733 >     * @see #linearAxis
734 >     */        
735 >    bool isLinear() {
736 >      return sd_->isLinear();
737 >    }
738 >    
739 >    /**
740 >     * Returns the linear axis of the rigidbody, atom and directional atom will always return -1
741 >     *
742 >     * @return the linear axis of the rigidbody
743 >     *
744 >     * @see #isLinear
745 >     */
746 >    int linearAxis() {
747 >      return sd_->linearAxis();
748 >    }
749 >    
750 >    /** Returns the mass of this stuntdouble */
751 >    RealType getMass() {
752 >      return sd_->getMass();
753 >    }
754 >    
755 >    /**
756 >     * Sets the mass of this stuntdoulbe
757 >     * @param mass the mass to be set
758 >     */        
759 >    void setMass(RealType mass) {
760 >      sd_->setMass(mass);
761 >    }
762 >    
763 >    /** Returns the name of this stuntdouble */
764 >    std::string getType() {
765 >      return sd_->getType();
766 >    }
767 >    
768 >    /** Sets the name of this stuntRealType*/
769 >    void setType(const std::string& name) {
770 >      sd_->setType(name);
771 >    }
772 >    
773 >    /**
774 >     * Converts a lab fixed vector to a body fixed vector.
775 >     * @return body fixed vector
776 >     * @param v lab fixed vector
777 >     */
778 >    Vector3d lab2Body(const Vector3d& v) {
779 >      return sd_->lab2Body(v);
780 >    }
781 >    
782 >    /**
783 >     * Converts a body fixed vector to a lab fixed vector.
784 >     * @return corresponding lab fixed vector
785 >     * @param v body fixed vector
786 >     */
787 >    Vector3d body2Lab(const Vector3d& v){
788 >      return sd_->body2Lab(v);
789 >    }
790 >    /**
791 >     * <p>
792 >     * The purpose of the Visitor Pattern is to encapsulate an operation that you want to perform on
793 >     * the elements of a data structure. In this way, you can change the operation being performed
794 >     * on a structure without the need of changing the classes of the elements that you are operating
795 >     * on. Using a Visitor pattern allows you to decouple the classes for the data structure and the
796 >     * algorithms used upon them
797 >     * </p>
798 >     * @param v visitor
799 >     */      
800 >    void accept(BaseVisitor* v) {
801 >      sd_->accept(v);
802 >    }
803 >    
804 >    //below functions are just forward functions
805 >    /**
806 >     * Adds property into property map
807 >     * @param genData GenericData to be added into PropertyMap
808 >     */
809 >    void addProperty(GenericData* genData){
810 >      sd_->addProperty(genData);
811 >    }
812 >    
813 >    /**
814 >     * Removes property from PropertyMap by name
815 >     * @param propName the name of property to be removed
816 >     */
817 >    void removeProperty(const std::string& propName) {
818 >      sd_->removeProperty(propName);
819 >    }
820 >    
821 >    /**
822 >     * clear all of the properties
823 >     */
824 >    void clearProperties() {
825 >      sd_->clearProperties();
826 >    }
827 >    
828 >    /**
829 >     * Returns all names of properties
830 >     * @return all names of properties
831 >     */
832 >    std::vector<std::string> getPropertyNames() {
833 >      return sd_->getPropertyNames();
834 >    }
835 >    
836 >    /**
837 >     * Returns all of the properties in PropertyMap
838 >     * @return all of the properties in PropertyMap
839 >     */      
840 >    std::vector<GenericData*> getProperties() {
841 >      return sd_->getProperties();
842 >    }
843 >    
844 >    /**
845 >     * Returns property
846 >     * @param propName name of property
847 >     * @return a pointer point to property with propName. If no property named propName
848 >     * exists, return NULL
849 >     */      
850 >    GenericData* getPropertyByName(const std::string& propName) {
851 >      return sd_->getPropertyByName(propName);
852 >    }
853 >    
854 >  private:
855 >    StuntDouble* sd_;
856 >    BoolGenericData* moved_;
857 >    BoolGenericData* moving_;
858 >  };
859 >  
860 > }
861 >
862 > #endif

Comparing:
trunk/src/constraints/ConstraintElem.hpp (property svn:keywords), Revision 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
branches/development/src/constraints/ConstraintElem.hpp (property svn:keywords), Revision 1850 by gezelter, Wed Feb 20 15:39:39 2013 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines