| 1 |
tim |
146 |
/* |
| 2 |
|
|
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
| 3 |
|
|
* |
| 4 |
|
|
* Contact: oopse@oopse.org |
| 5 |
|
|
* |
| 6 |
|
|
* This program is free software; you can redistribute it and/or |
| 7 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
| 8 |
|
|
* as published by the Free Software Foundation; either version 2.1 |
| 9 |
|
|
* of the License, or (at your option) any later version. |
| 10 |
|
|
* All we ask is that proper credit is given for our work, which includes |
| 11 |
|
|
* - but is not limited to - adding the above copyright notice to the beginning |
| 12 |
|
|
* of your source code files, and to any copyright notice that you may distribute |
| 13 |
|
|
* with programs based on this work. |
| 14 |
|
|
* |
| 15 |
|
|
* This program is distributed in the hope that it will be useful, |
| 16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
|
|
* GNU Lesser General Public License for more details. |
| 19 |
|
|
* |
| 20 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
| 21 |
|
|
* along with this program; if not, write to the Free Software |
| 22 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 |
|
|
* |
| 24 |
|
|
*/ |
| 25 |
|
|
#ifndef _STUNTDOUBLE_HPP_ |
| 26 |
|
|
#define _STUNTDOUBLE_HPP_ |
| 27 |
|
|
|
| 28 |
|
|
#include <vector> |
| 29 |
|
|
|
| 30 |
|
|
#include <core/BaseVisitor.hpp> |
| 31 |
|
|
#include <math/Quaternion.hpp> |
| 32 |
|
|
#include <math/Mat3x3d.hpp> |
| 33 |
|
|
#include <math/Vector3d.hpp> |
| 34 |
|
|
#include <util/PropertyMap.hpp> |
| 35 |
|
|
|
| 36 |
|
|
namespace oopse{ |
| 37 |
|
|
|
| 38 |
|
|
/** |
| 39 |
|
|
* The base class for atom types. Typically, atom types are used to descibe the behavior of an atom |
| 40 |
|
|
* of a element in differnet enviroment. In OOPSE, atom types are also used to represent the coarse- |
| 41 |
|
|
* grainded atom |
| 42 |
|
|
* @author tlin |
| 43 |
|
|
* @date 09/08/2004 |
| 44 |
|
|
* @version 1.0 |
| 45 |
|
|
*/ |
| 46 |
|
|
|
| 47 |
|
|
/* |
| 48 |
|
|
* Design Decision: |
| 49 |
|
|
* the member data of stuntdouble will be stored outside of the class |
| 50 |
|
|
*/ |
| 51 |
|
|
class StuntDouble{ |
| 52 |
|
|
public: |
| 53 |
|
|
|
| 54 |
|
|
/** |
| 55 |
|
|
* Returns the global index of this stuntdouble. |
| 56 |
|
|
* @return the global index of this stuntdouble |
| 57 |
|
|
*/ |
| 58 |
|
|
int getGlobalIndex() { |
| 59 |
|
|
return globalIndex_; |
| 60 |
|
|
} |
| 61 |
|
|
|
| 62 |
|
|
/** |
| 63 |
|
|
* Sets the global index of this stuntdouble. |
| 64 |
|
|
* @param new global index to be set |
| 65 |
|
|
*/ |
| 66 |
|
|
void setGlobalIndex(int index) { |
| 67 |
|
|
return globalIndex_; |
| 68 |
|
|
} |
| 69 |
|
|
|
| 70 |
|
|
/** |
| 71 |
|
|
* Returns the local index of this stuntdouble |
| 72 |
|
|
* @return the local index of this stuntdouble |
| 73 |
|
|
*/ |
| 74 |
|
|
int getLocalIndex() { |
| 75 |
|
|
return localIndex_; |
| 76 |
|
|
} |
| 77 |
|
|
|
| 78 |
|
|
/** |
| 79 |
|
|
* Sets the local index of this stuntdouble |
| 80 |
|
|
* @param index new index to be set |
| 81 |
|
|
*/ |
| 82 |
|
|
void setLocalIndex(int index) { |
| 83 |
|
|
localIndex_ = index; |
| 84 |
|
|
} |
| 85 |
|
|
|
| 86 |
|
|
/** |
| 87 |
|
|
* Returns the previous position of this stuntdouble |
| 88 |
|
|
* @return the position of this stuntdouble |
| 89 |
|
|
*/ |
| 90 |
|
|
void Vector3d getPrevPos() { |
| 91 |
|
|
return (snapshotMan_->getPrevSnapshot())->storage->position[localId_]; |
| 92 |
|
|
} |
| 93 |
|
|
|
| 94 |
|
|
/** |
| 95 |
|
|
* Returns the current position of this stuntdouble |
| 96 |
|
|
* @return the position of this stuntdouble |
| 97 |
|
|
*/ |
| 98 |
|
|
void Vector3d getPos() { |
| 99 |
|
|
return (snapshotMan_->getCurrentSnapshot())->storage->position[localId_]; |
| 100 |
|
|
} |
| 101 |
|
|
|
| 102 |
|
|
/** |
| 103 |
|
|
* Returns the position of this stuntdouble in specified snapshot |
| 104 |
|
|
* |
| 105 |
|
|
* @return the position of this stuntdouble |
| 106 |
|
|
* @param snapshotNo |
| 107 |
|
|
*/ |
| 108 |
|
|
Vector3d getPos(int snapshotNo) { |
| 109 |
|
|
return (snapshotMan_->getSnapshot(snapShotNo))->storage->position[localId_]; |
| 110 |
|
|
} |
| 111 |
|
|
|
| 112 |
|
|
/** |
| 113 |
|
|
* Sets the previous position of this stuntdouble |
| 114 |
|
|
* |
| 115 |
|
|
* @param pos new position |
| 116 |
|
|
* @see #getPos |
| 117 |
|
|
*/ |
| 118 |
|
|
void setPrevPos(const Vector3d& pos) { |
| 119 |
|
|
(snapshotMan_->getPrevSnapshot())->storage->position[localId_] = pos; |
| 120 |
|
|
} |
| 121 |
|
|
|
| 122 |
|
|
/** |
| 123 |
|
|
* Sets the current position of this stuntdouble |
| 124 |
|
|
* @param pos new position |
| 125 |
|
|
*/ |
| 126 |
|
|
void setPos(const Vector3d& pos) { |
| 127 |
|
|
(snapshotMan_->getCurrentSnapshot())->storage->position[localId_] = pos; |
| 128 |
|
|
} |
| 129 |
|
|
|
| 130 |
|
|
/** |
| 131 |
|
|
* Sets the position of this stuntdouble in specified snapshot |
| 132 |
|
|
* |
| 133 |
|
|
* @param pos position to be set |
| 134 |
|
|
* @param snapshotNo |
| 135 |
|
|
* @see #getPos |
| 136 |
|
|
*/ |
| 137 |
|
|
void setPos(const Vector3d& pos, int snapshotNo) { |
| 138 |
|
|
(snapshotMan_->getSnapshot(snapshotNo))->storage->position[localId_] = pos; |
| 139 |
|
|
} |
| 140 |
|
|
|
| 141 |
|
|
/** |
| 142 |
|
|
* Returns the previous velocity of this stuntdouble |
| 143 |
|
|
* @return the velocity of this stuntdouble |
| 144 |
|
|
*/ |
| 145 |
|
|
Vector3d getPrevVel() { |
| 146 |
|
|
return (snapshotMan_->getPrevSnapshot())->storage->velocity[localId_]; |
| 147 |
|
|
} |
| 148 |
|
|
|
| 149 |
|
|
/** |
| 150 |
|
|
* Returns the current velocity of this stuntdouble |
| 151 |
|
|
* @return the velocity of this stuntdouble |
| 152 |
|
|
*/ |
| 153 |
|
|
Vector3d getVel() { |
| 154 |
|
|
return (snapshotMan_->getCurrentSnapshot())->storage->velocity[localId_]; |
| 155 |
|
|
} |
| 156 |
|
|
|
| 157 |
|
|
/** |
| 158 |
|
|
* Returns the velocity of this stuntdouble in specified snapshot |
| 159 |
|
|
* |
| 160 |
|
|
* @return the velocity of this stuntdouble |
| 161 |
|
|
* @param snapshotNo |
| 162 |
|
|
*/ |
| 163 |
|
|
Vector3d getVel(int snapshotNo) { |
| 164 |
|
|
return (snapshotMan_->getSnapshot(snapShotNo))->storage->velocity[localId_]; |
| 165 |
|
|
} |
| 166 |
|
|
|
| 167 |
|
|
/** |
| 168 |
|
|
* Sets the previous velocity of this stuntdouble |
| 169 |
|
|
* |
| 170 |
|
|
* @param vel new velocity |
| 171 |
|
|
* @see #getVel |
| 172 |
|
|
*/ |
| 173 |
|
|
void setPrevVel(const Vector3d& vel) { |
| 174 |
|
|
(snapshotMan_->getPrevSnapshot())->storage->velocity[localId_] = vel; |
| 175 |
|
|
} |
| 176 |
|
|
|
| 177 |
|
|
/** |
| 178 |
|
|
* Sets the current velocity of this stuntdouble |
| 179 |
|
|
* @param vel new velocity |
| 180 |
|
|
*/ |
| 181 |
|
|
void setVel(const Vector3d& vel) { |
| 182 |
|
|
(snapshotMan_->getCurrentSnapshot())->storage->velocity[localId_] = vel; |
| 183 |
|
|
} |
| 184 |
|
|
|
| 185 |
|
|
/** |
| 186 |
|
|
* Sets the velocity of this stuntdouble in specified snapshot |
| 187 |
|
|
* |
| 188 |
|
|
* @param vel velocity to be set |
| 189 |
|
|
* @param snapshotNo |
| 190 |
|
|
* @see #getVel |
| 191 |
|
|
*/ |
| 192 |
|
|
void setVel(const Vector3d& vel, int snapshotNo) { |
| 193 |
|
|
(snapshotMan_->getSnapshot(snapshotNo))->storage->velocity[localId_] = vel; |
| 194 |
|
|
} |
| 195 |
|
|
|
| 196 |
|
|
/** |
| 197 |
|
|
* Returns the previous rotation matrix of this stuntdouble |
| 198 |
|
|
* @return the rotation matrix of this stuntdouble |
| 199 |
|
|
*/ |
| 200 |
|
|
RotMat3x3d getPrevA() { |
| 201 |
|
|
return (snapshotMan_->getPrevSnapshot())->storage->aMat[localId_]; |
| 202 |
|
|
} |
| 203 |
|
|
|
| 204 |
|
|
/** |
| 205 |
|
|
* Returns the current rotation matrix of this stuntdouble |
| 206 |
|
|
* @return the rotation matrix of this stuntdouble |
| 207 |
|
|
*/ |
| 208 |
|
|
RotMat3x3d getA() { |
| 209 |
|
|
return (snapshotMan_->getCurrentSnapshot())->storage->aMat[localId_]; |
| 210 |
|
|
} |
| 211 |
|
|
|
| 212 |
|
|
/** |
| 213 |
|
|
* Returns the rotation matrix of this stuntdouble in specified snapshot |
| 214 |
|
|
* |
| 215 |
|
|
* @return the rotation matrix of this stuntdouble |
| 216 |
|
|
* @param snapshotNo |
| 217 |
|
|
*/ |
| 218 |
|
|
RotMat3x3d getA(int snapshotNo) { |
| 219 |
|
|
return (snapshotMan_->getSnapshot(snapShotNo))->storage->aMat[localId_]; |
| 220 |
|
|
} |
| 221 |
|
|
|
| 222 |
|
|
/** |
| 223 |
|
|
* Sets the previous rotation matrix of this stuntdouble |
| 224 |
|
|
* |
| 225 |
|
|
* @param a new rotation matrix |
| 226 |
|
|
* @see #getA |
| 227 |
|
|
*/ |
| 228 |
|
|
void setPrevA(const RotMat3x3d& a) { |
| 229 |
|
|
(snapshotMan_->getPrevSnapshot())->storage->aMat[localId_] = a; |
| 230 |
|
|
} |
| 231 |
|
|
|
| 232 |
|
|
/** |
| 233 |
|
|
* Sets the current rotation matrix of this stuntdouble |
| 234 |
|
|
* @param a new rotation matrix |
| 235 |
|
|
*/ |
| 236 |
|
|
void setA(const RotMat3x3d& a) { |
| 237 |
|
|
(snapshotMan_->getCurrentSnapshot())->storage->aMat[localId_] = a; |
| 238 |
|
|
} |
| 239 |
|
|
|
| 240 |
|
|
/** |
| 241 |
|
|
* Sets the rotation matrix of this stuntdouble in specified snapshot |
| 242 |
|
|
* |
| 243 |
|
|
* @param a rotation matrix to be set |
| 244 |
|
|
* @param snapshotNo |
| 245 |
|
|
* @see #getA |
| 246 |
|
|
*/ |
| 247 |
|
|
void setA(const RotMat3x3d& a, int snapshotNo) { |
| 248 |
|
|
(snapshotMan_->getSnapshot(snapshotNo))->storage->a[localId_] = a; |
| 249 |
|
|
} |
| 250 |
|
|
|
| 251 |
|
|
/** |
| 252 |
|
|
* Returns the previous angular momentum of this stuntdouble |
| 253 |
|
|
* @return the angular momentum of this stuntdouble |
| 254 |
|
|
*/ |
| 255 |
|
|
Vector3d getPrevJ() { |
| 256 |
|
|
return (snapshotMan_->getPrevSnapshot())->storage->angularMomentum[localId_]; |
| 257 |
|
|
} |
| 258 |
|
|
|
| 259 |
|
|
/** |
| 260 |
|
|
* Returns the current angular momentum of this stuntdouble |
| 261 |
|
|
* @return the angular momentum of this stuntdouble |
| 262 |
|
|
*/ |
| 263 |
|
|
Vector3d getJ() { |
| 264 |
|
|
return (snapshotMan_->getCurrentSnapshot())->storage->angularMomentum[localId_]; |
| 265 |
|
|
} |
| 266 |
|
|
|
| 267 |
|
|
/** |
| 268 |
|
|
* Returns the angular momentum of this stuntdouble in specified snapshot |
| 269 |
|
|
* |
| 270 |
|
|
* @return the angular momentum of this stuntdouble |
| 271 |
|
|
* @param snapshotNo |
| 272 |
|
|
*/ |
| 273 |
|
|
Vector3d getJ(int snapshotNo) { |
| 274 |
|
|
return (snapshotMan_->getSnapshot(snapShotNo))->storage->angularMomentum[localId_]; |
| 275 |
|
|
} |
| 276 |
|
|
|
| 277 |
|
|
/** |
| 278 |
|
|
* Sets the previous angular momentum of this stuntdouble |
| 279 |
|
|
* |
| 280 |
|
|
* @param angMom new angular momentum |
| 281 |
|
|
* @see #getJ |
| 282 |
|
|
*/ |
| 283 |
|
|
void setPrevJ(const Vector3d& angMom) { |
| 284 |
|
|
(snapshotMan_->getPrevSnapshot())->storage->angularMomentum[localId_] = angMom; |
| 285 |
|
|
} |
| 286 |
|
|
|
| 287 |
|
|
/** |
| 288 |
|
|
* Sets the current angular momentum of this stuntdouble |
| 289 |
|
|
* @param angMom new angular momentum |
| 290 |
|
|
*/ |
| 291 |
|
|
void setJ(const Vector3d& angMom) { |
| 292 |
|
|
(snapshotMan_->getCurrentSnapshot())->storage->angularMomentum[localId_] = angMom; |
| 293 |
|
|
} |
| 294 |
|
|
|
| 295 |
|
|
/** |
| 296 |
|
|
* Sets the angular momentum of this stuntdouble in specified snapshot |
| 297 |
|
|
* |
| 298 |
|
|
* @param angMom angular momentum to be set |
| 299 |
|
|
* @param snapshotNo |
| 300 |
|
|
* @see #getJ |
| 301 |
|
|
*/ |
| 302 |
|
|
void setJ(const Vector3d& angMom, int snapshotNo) { |
| 303 |
|
|
(snapshotMan_->getSnapshot(snapshotNo))->storage->angularMomentum[localId_] = angMom; |
| 304 |
|
|
} |
| 305 |
|
|
|
| 306 |
|
|
/** |
| 307 |
|
|
* Returns the previous quaternion of this stuntdouble |
| 308 |
|
|
* @return the quaternion of this stuntdouble |
| 309 |
|
|
*/ |
| 310 |
|
|
Quat4d getPrevQ() { |
| 311 |
|
|
return (snapshotMan_->getPrevSnapshot())->storage->aMat[localId_].toQuaternion(); |
| 312 |
|
|
} |
| 313 |
|
|
|
| 314 |
|
|
/** |
| 315 |
|
|
* Returns the current quaternion of this stuntdouble |
| 316 |
|
|
* @return the quaternion of this stuntdouble |
| 317 |
|
|
*/ |
| 318 |
|
|
Quat4d getQ() { |
| 319 |
|
|
return (snapshotMan_->getCurrentSnapshot())->storage->aMat[localId_].toQuaternion(); |
| 320 |
|
|
} |
| 321 |
|
|
|
| 322 |
|
|
/** |
| 323 |
|
|
* Returns the quaternion of this stuntdouble in specified snapshot |
| 324 |
|
|
* |
| 325 |
|
|
* @return the quaternion of this stuntdouble |
| 326 |
|
|
* @param snapshotNo |
| 327 |
|
|
*/ |
| 328 |
|
|
Quat4d getQ(int snapshotNo) { |
| 329 |
|
|
return (snapshotMan_->getSnapshot(snapShotNo))->storage->aMat[localId_].toQuaternion(); |
| 330 |
|
|
} |
| 331 |
|
|
|
| 332 |
|
|
/** |
| 333 |
|
|
* Sets the previous quaternion of this stuntdouble |
| 334 |
|
|
* |
| 335 |
|
|
* @param q new quaternion |
| 336 |
|
|
* @see #getQ |
| 337 |
|
|
*/ |
| 338 |
|
|
void setPrevQ(const Quat4d& q) { |
| 339 |
|
|
(snapshotMan_->getPrevSnapshot())->storage->aMat[localId_] = q; |
| 340 |
|
|
} |
| 341 |
|
|
|
| 342 |
|
|
/** |
| 343 |
|
|
* Sets the current quaternion of this stuntdouble |
| 344 |
|
|
* @param q new quaternion |
| 345 |
|
|
*/ |
| 346 |
|
|
void setQ(const Quat4d& q) { |
| 347 |
|
|
(snapshotMan_->getCurrentSnapshot())->storage->aMat[localId_] = q; |
| 348 |
|
|
} |
| 349 |
|
|
|
| 350 |
|
|
/** |
| 351 |
|
|
* Sets the quaternion of this stuntdouble in specified snapshot |
| 352 |
|
|
* |
| 353 |
|
|
* @param q quaternion to be set |
| 354 |
|
|
* @param snapshotNo |
| 355 |
|
|
* @see #getQ |
| 356 |
|
|
*/ |
| 357 |
|
|
void setQ(const Quat4d& q, int snapshotNo) { |
| 358 |
|
|
(snapshotMan_->getSnapshot(snapshotNo))->storage->aMat[localId_] = q; |
| 359 |
|
|
} |
| 360 |
|
|
|
| 361 |
|
|
/** |
| 362 |
|
|
* Returns the force of this stuntdouble |
| 363 |
|
|
* |
| 364 |
|
|
* @return the quaternion of this stuntdouble |
| 365 |
|
|
* |
| 366 |
|
|
* @see #setFrc |
| 367 |
|
|
* @see #addFrc |
| 368 |
|
|
*/ |
| 369 |
|
|
virtual Vector3d getFrc() = 0; |
| 370 |
|
|
|
| 371 |
|
|
/** |
| 372 |
|
|
* Sets the force of this stuntdouble |
| 373 |
|
|
* |
| 374 |
|
|
* @param frc new force |
| 375 |
|
|
* |
| 376 |
|
|
* @see #getFrc |
| 377 |
|
|
* @see #addFrc |
| 378 |
|
|
*/ |
| 379 |
|
|
virtual void setFrc(Vector3d& frc) = 0; |
| 380 |
|
|
|
| 381 |
|
|
/** |
| 382 |
|
|
* Adds the force into this stuntdouble |
| 383 |
|
|
* |
| 384 |
|
|
* @param frc force to be added |
| 385 |
|
|
* |
| 386 |
|
|
* @see #getFrc |
| 387 |
|
|
* @see #setFrc |
| 388 |
|
|
*/ |
| 389 |
|
|
virtual void addFrc(Vector3d& frc) = 0; |
| 390 |
|
|
|
| 391 |
|
|
/** |
| 392 |
|
|
* Returns the torque of this stuntdouble |
| 393 |
|
|
* |
| 394 |
|
|
* @return the torque of this stuntdouble |
| 395 |
|
|
* |
| 396 |
|
|
* @see #setTrq |
| 397 |
|
|
* @see #addTrq |
| 398 |
|
|
*/ |
| 399 |
|
|
virtual Vector3d getTrq() = 0; |
| 400 |
|
|
|
| 401 |
|
|
/** |
| 402 |
|
|
* Sets the torque of this stuntdouble |
| 403 |
|
|
* |
| 404 |
|
|
* @param trq new torque |
| 405 |
|
|
* |
| 406 |
|
|
* @see #getTrq |
| 407 |
|
|
* @see #addTrq |
| 408 |
|
|
*/ |
| 409 |
|
|
virtual void setTrq(Vector3d& trq) = 0; |
| 410 |
|
|
|
| 411 |
|
|
/** |
| 412 |
|
|
* Adds the torque into this stuntdouble |
| 413 |
|
|
* |
| 414 |
|
|
* @param trq torque to be added |
| 415 |
|
|
* |
| 416 |
|
|
* @see #getTrq |
| 417 |
|
|
* @see #setTrq |
| 418 |
|
|
*/ |
| 419 |
|
|
virtual void addTrq(Vector3d& trq) = 0; |
| 420 |
|
|
|
| 421 |
|
|
/** |
| 422 |
|
|
* Returns the inertia tensor of this stuntdouble |
| 423 |
|
|
* |
| 424 |
|
|
* @return the inertia tensor of this stuntdouble |
| 425 |
|
|
* |
| 426 |
|
|
* @see #setI |
| 427 |
|
|
*/ |
| 428 |
|
|
virtual Mat3x3d getI() = 0; |
| 429 |
|
|
|
| 430 |
|
|
/** |
| 431 |
|
|
* Sets the inertia tensor of this stuntdouble |
| 432 |
|
|
* |
| 433 |
|
|
* @param trq new inertia tensor |
| 434 |
|
|
* |
| 435 |
|
|
* @see #getI |
| 436 |
|
|
*/ |
| 437 |
|
|
virtual void setI(Mat3x3d& I) = 0; |
| 438 |
|
|
|
| 439 |
|
|
/** |
| 440 |
|
|
* Returns the gradient of this stuntdouble |
| 441 |
|
|
* |
| 442 |
|
|
* @return the inertia tensor of this stuntdouble |
| 443 |
|
|
* |
| 444 |
|
|
* @see #setI |
| 445 |
|
|
*/ |
| 446 |
|
|
virtual std::vector<double> getGrad() = 0; |
| 447 |
|
|
|
| 448 |
|
|
/** |
| 449 |
|
|
* Returns the euler angles of this stuntdouble |
| 450 |
|
|
* <p> |
| 451 |
|
|
* <ol> |
| 452 |
|
|
* <il> |
| 453 |
|
|
* <il> |
| 454 |
|
|
* <il> |
| 455 |
|
|
* </ol> |
| 456 |
|
|
* </p> |
| 457 |
|
|
* @return the euler angles of this stuntdouble |
| 458 |
|
|
* |
| 459 |
|
|
* @see #setEuler |
| 460 |
|
|
*/ |
| 461 |
|
|
virtual Vector3d getEuler() = 0; |
| 462 |
|
|
|
| 463 |
|
|
/** |
| 464 |
|
|
* Sets the euler angles of this stuntdouble |
| 465 |
|
|
* |
| 466 |
|
|
* @param e new euler angles |
| 467 |
|
|
* <p> |
| 468 |
|
|
* <ol> |
| 469 |
|
|
* <il>e[0] = phi </il> |
| 470 |
|
|
* <il>e[1] = theta <il> |
| 471 |
|
|
* <il>e[2] = psi </il> |
| 472 |
|
|
* </ol> |
| 473 |
|
|
* </p> |
| 474 |
|
|
* |
| 475 |
|
|
* @see #setEuler |
| 476 |
|
|
*/ |
| 477 |
|
|
virtual void setEuler(Vector3d& e) = 0; |
| 478 |
|
|
|
| 479 |
|
|
virtual bool isLinear() {return false;} |
| 480 |
|
|
|
| 481 |
|
|
/** |
| 482 |
|
|
* Returns the linear axis of the rigidbody, atom and directional atom will always return -1 |
| 483 |
|
|
* |
| 484 |
|
|
* @return the linear axis of the rigidbody |
| 485 |
|
|
* |
| 486 |
|
|
* @see #isLinear |
| 487 |
|
|
*/ |
| 488 |
|
|
virtual int linearAxis() {return -1;} |
| 489 |
|
|
|
| 490 |
|
|
/** |
| 491 |
|
|
* Returns the zangle |
| 492 |
|
|
* |
| 493 |
|
|
* @return the zangle |
| 494 |
|
|
* |
| 495 |
|
|
* @see #setZangle |
| 496 |
|
|
* @see #addZangle |
| 497 |
|
|
*/ |
| 498 |
|
|
virtual double getZangle() = 0; |
| 499 |
|
|
|
| 500 |
|
|
/** |
| 501 |
|
|
* |
| 502 |
|
|
*/ |
| 503 |
|
|
virtual void setZangle(double zAngle) = 0; |
| 504 |
|
|
|
| 505 |
|
|
/** |
| 506 |
|
|
* |
| 507 |
|
|
*/ |
| 508 |
|
|
virtual void addZangle(double zAngle) = 0; |
| 509 |
|
|
|
| 510 |
|
|
/** |
| 511 |
|
|
* |
| 512 |
|
|
* <p> |
| 513 |
|
|
* The purpose of the Visitor Pattern is to encapsulate an operation that you want to perform on |
| 514 |
|
|
* the elements of a data structure. In this way, you can change the operation being performed |
| 515 |
|
|
* on a structure without the need of changing the classes of the elements that you are operating |
| 516 |
|
|
* on. Using a Visitor pattern allows you to decouple the classes for the data structure and the |
| 517 |
|
|
* algorithms used upon them |
| 518 |
|
|
* </p> |
| 519 |
|
|
* @param v visitor |
| 520 |
|
|
*/ |
| 521 |
|
|
virtual void accept(BaseVisitor* v) = 0; |
| 522 |
|
|
|
| 523 |
|
|
StorageMethod getStorageMethd(){return stMethod;} |
| 524 |
|
|
void setStorageMethod(StorageMethod method) {stMethod = method;} |
| 525 |
|
|
|
| 526 |
|
|
//below functions are just forward functions |
| 527 |
|
|
/** |
| 528 |
|
|
* Adds property into property map |
| 529 |
|
|
* |
| 530 |
|
|
* @param genData GenericData to be added into PropertyMap |
| 531 |
|
|
* |
| 532 |
|
|
* @see #removeProperty |
| 533 |
|
|
* @see #clearProperties |
| 534 |
|
|
*/ |
| 535 |
|
|
void addProperty(GenericData* genData) { properties.addProperty(genData); } |
| 536 |
|
|
|
| 537 |
|
|
/** |
| 538 |
|
|
* Removes property from PropertyMap by name |
| 539 |
|
|
* |
| 540 |
|
|
* @param propName the name of property to be removed |
| 541 |
|
|
* |
| 542 |
|
|
* @see #addProperty |
| 543 |
|
|
* @see #clearProperties |
| 544 |
|
|
*/ |
| 545 |
|
|
void removeProperty(std::string& propName) { properties.removeProperty(); } |
| 546 |
|
|
|
| 547 |
|
|
/** |
| 548 |
|
|
* clear all of the properties |
| 549 |
|
|
* |
| 550 |
|
|
* @see #addProperty |
| 551 |
|
|
* @see #removeProperty |
| 552 |
|
|
*/ |
| 553 |
|
|
void clearProperties() { properties.clearProperties(); } |
| 554 |
|
|
|
| 555 |
|
|
/** |
| 556 |
|
|
* Returns all names of properties |
| 557 |
|
|
* |
| 558 |
|
|
* @return all names of properties |
| 559 |
|
|
*/ |
| 560 |
|
|
std::vector<std::string> getPropertyNames() {return properties.getPropertyNames(); } |
| 561 |
|
|
|
| 562 |
|
|
/** |
| 563 |
|
|
* Returns all of the properties in PropertyMap |
| 564 |
|
|
* |
| 565 |
|
|
* @return all of the properties in PropertyMap |
| 566 |
|
|
* |
| 567 |
|
|
* @see #getPropertyByName |
| 568 |
|
|
*/ |
| 569 |
|
|
std::vector<GenericData*> getProperties() { return properties.getProperties(); } |
| 570 |
|
|
|
| 571 |
|
|
/** |
| 572 |
|
|
* Returns property |
| 573 |
|
|
* |
| 574 |
|
|
* @param propName name of property |
| 575 |
|
|
* |
| 576 |
|
|
* @return a pointer point to property with propName. If no property named propName |
| 577 |
|
|
* exists, return NULL |
| 578 |
|
|
* |
| 579 |
|
|
* @see #getProperties |
| 580 |
|
|
*/ |
| 581 |
|
|
GenericData* getPropertyByName(std:string& propName) { return properties.getPropertyByName(propName); } |
| 582 |
|
|
|
| 583 |
|
|
private: |
| 584 |
|
|
|
| 585 |
|
|
int globalIndex_; |
| 586 |
|
|
int localIndex_; |
| 587 |
|
|
PropertyMap properties; |
| 588 |
|
|
DataStoragePointer storage_; |
| 589 |
|
|
SnapshotManager* snapshotMan_; |
| 590 |
|
|
}; |
| 591 |
|
|
|
| 592 |
|
|
}//end namespace oopse |
| 593 |
|
|
#endif //ifndef _STUNTDOUBLE_HPP_ |