48#ifndef CONSTRAINTS_CONTRAINTELEM_HPP
49#define CONSTRAINTS_CONTRAINTELEM_HPP
55#include "utils/simError.h"
64 class ConstraintElem {
67 std::shared_ptr<GenericData> movedData = sd_->getPropertyByName(
"Moved");
68 if (movedData !=
nullptr) {
70 moved_ = std::dynamic_pointer_cast<BoolGenericData>(movedData);
71 if (moved_ ==
nullptr) {
73 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
74 "Generic Data with keyword Moved exists, however, it can not "
75 "be casted to a BoolGenericData.\n");
82 moved_ = std::make_shared<BoolGenericData>(
"Moved");
83 sd_->addProperty(moved_);
86 std::shared_ptr<GenericData> movingData =
87 sd_->getPropertyByName(
"Moving");
88 if (movingData !=
nullptr) {
89 moving_ = std::dynamic_pointer_cast<BoolGenericData>(movingData);
90 if (moving_ ==
nullptr) {
91 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
92 "Generic Data with keyword Moving exists, however, it can "
93 "not be casted to a BoolGenericData.\n");
99 moving_ = std::make_shared<BoolGenericData>(
"Moving");
100 sd_->addProperty(moving_);
104 bool getMoved() {
return moved_->getData(); }
105 void setMoved(
bool moved) { moved_->setData(moved); }
107 bool getMoving() {
return moving_->getData(); }
108 void setMoving(
bool moving) { moving_->setData(moving); }
140 sd_->setSnapshotManager(sman);
180 Vector3d
getPos() {
return sd_->getPos(); }
187 Vector3d
getPos(
int snapshotNo) {
return sd_->getPos(snapshotNo); }
194 void setPrevPos(
const Vector3d& pos) { sd_->setPrevPos(pos); }
200 void setPos(
const Vector3d& pos) { sd_->setPos(pos); }
208 void setPos(
const Vector3d& pos,
int snapshotNo) {
209 sd_->setPos(pos, snapshotNo);
222 Vector3d
getVel() {
return sd_->getVel(); }
230 Vector3d
getVel(
int snapshotNo) {
return sd_->getVel(snapshotNo); }
237 void setPrevVel(
const Vector3d& vel) { sd_->setPrevVel(vel); }
243 void setVel(
const Vector3d& vel) { sd_->setVel(vel); }
251 void setVel(
const Vector3d& vel,
int snapshotNo) {
252 sd_->setVel(vel, snapshotNo);
265 RotMat3x3d
getA() {
return sd_->getA(); }
273 RotMat3x3d
getA(
int snapshotNo) {
return sd_->getA(snapshotNo); }
280 void setPrevA(
const RotMat3x3d& a) { sd_->setPrevA(a); }
286 void setA(
const RotMat3x3d& a) { sd_->setA(a); }
294 void setA(
const RotMat3x3d& a,
int snapshotNo) { sd_->setA(a, snapshotNo); }
306 Vector3d
getJ() {
return sd_->getJ(); }
314 Vector3d
getJ(
int snapshotNo) {
return sd_->getJ(snapshotNo); }
321 void setPrevJ(
const Vector3d& angMom) { sd_->setPrevJ(angMom); }
327 void setJ(
const Vector3d& angMom) { sd_->setJ(angMom); }
336 void setJ(
const Vector3d& angMom,
int snapshotNo) {
337 sd_->setJ(angMom, snapshotNo);
350 Quat4d
getQ() {
return sd_->getQ(); }
357 Quat4d
getQ(
int snapshotNo) {
return sd_->getQ(snapshotNo); }
364 void setPrevQ(
const Quat4d& q) { sd_->setPrevQ(q); }
371 void setQ(
const Quat4d& q) { sd_->setQ(q); }
380 void setQ(
const Quat4d& q,
int snapshotNo) { sd_->setQ(q, snapshotNo); }
399 Vector3d
getEuler(
int snapshotNo) {
return sd_->getEuler(snapshotNo); }
413 void setEuler(
const Vector3d& euler) { sd_->setEuler(euler); }
422 void setEuler(
const Vector3d& euler,
int snapshotNo) {
423 sd_->setEuler(euler, snapshotNo);
444 Vector3d
getDipole(
int snapshotNo) {
return sd_->getDipole(snapshotNo); }
465 return sd_->getQuadrupole(snapshotNo);
478 Vector3d
getFrc() {
return sd_->getFrc(); }
486 Vector3d
getFrc(
int snapshotNo) {
return sd_->getFrc(snapshotNo); }
494 void setPrevFrc(
const Vector3d& frc) { sd_->setPrevFrc(frc); }
500 void setFrc(
const Vector3d& frc) { sd_->setFrc(frc); }
509 void setFrc(
const Vector3d& frc,
int snapshotNo) {
510 sd_->setFrc(frc, snapshotNo);
519 void addPrevFrc(
const Vector3d& frc) { sd_->addPrevFrc(frc); }
525 void addFrc(
const Vector3d& frc) { sd_->addFrc(frc); }
534 void addFrc(
const Vector3d& frc,
int snapshotNo) {
535 sd_->addFrc(frc, snapshotNo);
548 Vector3d
getTrq() {
return sd_->getTrq(); }
556 Vector3d
getTrq(
int snapshotNo) {
return sd_->getTrq(snapshotNo); }
564 void setPrevTrq(
const Vector3d& trq) { sd_->setPrevTrq(trq); }
570 void setTrq(
const Vector3d& trq) { sd_->setTrq(trq); }
579 void setTrq(
const Vector3d& trq,
int snapshotNo) {
580 sd_->setTrq(trq, snapshotNo);
589 void addPrevTrq(
const Vector3d& trq) { sd_->addPrevTrq(trq); }
595 void addTrq(
const Vector3d& trq) { sd_->addTrq(trq); }
604 void addTrq(
const Vector3d& trq,
int snapshotNo) {
605 sd_->addTrq(trq, snapshotNo);
614 Mat3x3d
getI() {
return sd_->getI(); }
620 std::vector<RealType>
getGrad() {
return sd_->getGrad(); }
650 void setMass(RealType mass) { sd_->setMass(mass); }
653 std::string
getType() {
return sd_->getType(); }
656 void setType(
const std::string& name) { sd_->setType(name); }
663 Vector3d
lab2Body(
const Vector3d& v) {
return sd_->lab2Body(v); }
670 Vector3d
body2Lab(
const Vector3d& v) {
return sd_->body2Lab(v); }
690 sd_->addProperty(genData);
698 sd_->removeProperty(propName);
706 return sd_->getPropertyNames();
714 return sd_->getProperties();
724 const std::string& propName) {
725 return sd_->getPropertyByName(propName);
730 std::shared_ptr<BoolGenericData> moved_;
731 std::shared_ptr<BoolGenericData> moving_;
void removeProperty(const std::string &propName)
Removes property from PropertyMap by name.
void setJ(const Vector3d &angMom, int snapshotNo)
Sets the angular momentum of this stuntdouble in specified snapshot(body-fixed).
void setEuler(const Vector3d &euler)
Sets the current euler angles of this stuntdouble.
void zeroForcesAndTorques()
Set the force of this stuntdouble to zero.
Vector3d getJ(int snapshotNo)
Returns the angular momentum of this stuntdouble in specified snapshot (body-fixed).
void setFrc(const Vector3d &frc)
Sets the current force of this stuntdouble.
Quat4d getQ(int snapshotNo)
Returns the quaternion of this stuntdouble in specified snapshot.
void setPrevVel(const Vector3d &vel)
Sets the previous velocity of this stuntdouble.
void setPos(const Vector3d &pos)
Sets the current position of this stuntdouble.
void setEuler(const Vector3d &euler, int snapshotNo)
Sets the euler angles of this stuntdouble in specified snapshot.
Vector3d getPrevVel()
Returns the previous velocity of this stuntdouble.
void setTrq(const Vector3d &trq, int snapshotNo)
Sets the torque of this stuntdouble in specified snapshot.
void setPrevA(const RotMat3x3d &a)
Sets the previous rotation matrix of this stuntdouble.
std::string getType()
Returns the name of this stuntdouble.
void addTrq(const Vector3d &trq, int snapshotNo)
Adds torque into the torque of this stuntdouble in specified snapshot.
Vector3d getPrevPos()
Returns the previous position of this stuntdouble.
int linearAxis()
Returns the linear axis of the rigidbody, atom and directional atom will always return -1.
void setType(const std::string &name)
Sets the name of this stuntRealType.
void setLocalIndex(int index)
Sets the local index of this stuntdouble.
Vector3d getPrevTrq()
Returns the previous torque of this stuntdouble.
RotMat3x3d getA(int snapshotNo)
Returns the rotation matrix of this stuntdouble in specified snapshot.
RotMat3x3d getA()
Returns the current rotation matrix of this stuntdouble.
Vector3d getPrevEuler()
Returns the previous euler angles of this stuntdouble.
std::vector< RealType > getGrad()
Returns the gradient of this stuntdouble.
Quat4d getQ()
Returns the current quaternion of this stuntdouble.
Vector3d getTrq()
Returns the current torque of this stuntdouble.
void setPrevFrc(const Vector3d &frc)
Sets the previous force of this stuntdouble.
void accept(BaseVisitor *v)
Vector3d getPos(int snapshotNo)
Returns the position of this stuntdouble in specified snapshot.
void setGlobalIndex(int index)
Sets the global index of this stuntRealType.
std::vector< std::string > getPropertyNames()
Returns all names of properties.
Vector3d getPos()
Returns the current position of this stuntdouble.
void setPrevEuler(const Vector3d &euler)
Sets the previous euler angles of this stuntRealType.
Mat3x3d getQuadrupole()
Returns the current quadrupole tensor of this stuntDouble.
Vector3d getPrevJ()
Returns the previous angular momentum of this stuntdouble (body-fixed).
Vector3d getJ()
Returns the current angular momentum of this stuntdouble (body -fixed).
void setPrevPos(const Vector3d &pos)
Sets the previous position of this stuntdouble.
Vector3d lab2Body(const Vector3d &v)
Converts a lab fixed vector to a body fixed vector.
int getLocalIndex()
Returns the local index of this stuntdouble.
void addFrc(const Vector3d &frc, int snapshotNo)
Adds force into the force of this stuntdouble in specified snapshot.
void addPrevTrq(const Vector3d &trq)
Adds torque into the previous torque of this stuntdouble.
Vector3d getVel(int snapshotNo)
Returns the velocity of this stuntdouble in specified snapshot.
int getGlobalIndex()
Returns the global index of this stuntRealType.
RotMat3x3d getPrevA()
Returns the previous rotation matrix of this stuntdouble.
bool isDirectionalAtom()
Tests if this stuntdouble is an directional atom.
Vector3d getVel()
Returns the current velocity of this stuntdouble.
std::vector< std::shared_ptr< GenericData > > getProperties()
Returns all of the properties in PropertyMap.
Vector3d getPrevDipole()
Returns the previous dipole vector of this stuntDouble.
Mat3x3d getI()
Returns the inertia tensor of this stuntdouble.
bool isLinear()
Tests the if this stuntdouble is a linear rigidbody.
void setTrq(const Vector3d &trq)
Sets the current torque of this stuntdouble.
RealType getMass()
Returns the mass of this stuntdouble.
bool isDirectional()
Tests if this stuntdouble is a directional one.
void setSnapshotManager(SnapshotManager *sman)
Sets the Snapshot Manager of this stuntdouble.
void setPos(const Vector3d &pos, int snapshotNo)
Sets the position of this stuntdouble in specified snapshot.
Mat3x3d getPrevQuadrupole()
Returns the previous quadrupole tensor of this stuntDouble.
void setVel(const Vector3d &vel)
Sets the current velocity of this stuntdouble.
void setPrevJ(const Vector3d &angMom)
Sets the previous angular momentum of this stuntdouble (body-fixed).
void addPrevFrc(const Vector3d &frc)
Adds force into the previous force of this stuntdouble.
void setMass(RealType mass)
Sets the mass of this stuntdoulbe.
Vector3d body2Lab(const Vector3d &v)
Converts a body fixed vector to a lab fixed vector.
void setPrevTrq(const Vector3d &trq)
Sets the previous torque of this stuntdouble.
Vector3d getDipole()
Returns the current dipole vector of this stuntDouble.
Vector3d getTrq(int snapshotNo)
Returns the torque of this stuntdouble in specified snapshot.
std::shared_ptr< GenericData > getPropertyByName(const std::string &propName)
Returns property.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
void setPrevQ(const Quat4d &q)
Sets the previous quaternion of this stuntdouble.
bool isRigidBody()
Tests if this stuntdouble is a rigid body.
Vector3d getPrevFrc()
Returns the previous force of this stuntdouble.
void addFrc(const Vector3d &frc)
Adds force into the current force of this stuntdouble.
Vector3d getFrc(int snapshotNo)
Returns the force of this stuntdouble in specified snapshot.
void setFrc(const Vector3d &frc, int snapshotNo)
Sets the force of this stuntdouble in specified snapshot.
Vector3d getFrc()
Returns the current force of this stuntdouble.
Vector3d getEuler()
Returns the current euler angles of this stuntdouble.
void addTrq(const Vector3d &trq)
Adds torque into the current torque of this stuntdouble.
void setQ(const Quat4d &q, int snapshotNo)
Sets the quaternion of this stuntdouble in specified snapshot.
Quat4d getPrevQ()
Returns the previous quaternion of this stuntdouble.
void setQ(const Quat4d &q)
Sets the current quaternion of this stuntdouble.
Vector3d getDipole(int snapshotNo)
Returns the dipole vector of this stuntDouble in specified snapshot.
Vector3d getEuler(int snapshotNo)
Returns the euler angles of this stuntdouble in specified snapshot.
Mat3x3d getQuadrupole(int snapshotNo)
Returns the quadrupole tensor of this stuntDouble in specified snapshot.
void setVel(const Vector3d &vel, int snapshotNo)
Sets the velocity of this stuntdouble in specified snapshot.
void setA(const RotMat3x3d &a, int snapshotNo)
Sets the rotation matrix of this stuntdouble in specified snapshot.
bool isAtom()
Tests if this stuntdouble is an atom.
void setJ(const Vector3d &angMom)
Sets the current angular momentum of this stuntdouble (body-fixed).
void setA(const RotMat3x3d &a)
Sets the current rotation matrix of this stuntdouble.
SnapshotManager class is an abstract class which maintains a series of snapshots.
"Don't move, or you're dead! Stand up! Captain, we've got them!"
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.