45#ifndef CONSTRAINTS_CONTRAINTELEM_HPP
46#define CONSTRAINTS_CONTRAINTELEM_HPP
52#include "utils/simError.h"
65 if (movedData !=
nullptr) {
67 moved_ = std::dynamic_pointer_cast<BoolGenericData>(movedData);
68 if (moved_ ==
nullptr) {
70 painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
71 "Generic Data with keyword Moved exists, however, it can not "
72 "be casted to a BoolGenericData.\n");
79 moved_ = std::make_shared<BoolGenericData>(
"Moved");
83 std::shared_ptr<GenericData> movingData =
85 if (movingData !=
nullptr) {
86 moving_ = std::dynamic_pointer_cast<BoolGenericData>(movingData);
87 if (moving_ ==
nullptr) {
88 snprintf(painCave.errMsg, MAX_SIM_ERROR_MSG_LENGTH,
89 "Generic Data with keyword Moving exists, however, it can "
90 "not be casted to a BoolGenericData.\n");
96 moving_ = std::make_shared<BoolGenericData>(
"Moving");
101 bool getMoved() {
return moved_->getData(); }
102 void setMoved(
bool moved) { moved_->setData(moved); }
104 bool getMoving() {
return moving_->getData(); }
105 void setMoving(
bool moving) { moving_->setData(moving); }
206 sd_->
setPos(pos, snapshotNo);
249 sd_->
setVel(vel, snapshotNo);
334 sd_->
setJ(angMom, snapshotNo);
507 sd_->
setFrc(frc, snapshotNo);
532 sd_->
addFrc(frc, snapshotNo);
577 sd_->
setTrq(trq, snapshotNo);
602 sd_->
addTrq(trq, snapshotNo);
721 const std::string& propName) {
727 std::shared_ptr<BoolGenericData> moved_;
728 std::shared_ptr<BoolGenericData> moving_;
An adapter class of StuntDouble which is used at constraint algorithm.
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.
Quaternion is a sort of a higher-level complex number.
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!"
Quat4d getQ()
Returns the current quaternion of this stuntDouble.
Mat3x3d getPrevQuadrupole()
Returns the previous quadrupole tensor of this stuntDouble.
void setPrevTrq(const Vector3d &trq)
Sets the previous torque of this stuntDouble.
void addPrevFrc(const Vector3d &frc)
Adds force into the previous force of this stuntDouble.
void setPrevEuler(const Vector3d &euler)
Sets the previous euler angles of this stuntDouble.
void zeroForcesAndTorques()
Set the properties of this stuntDouble to zero.
Vector3d getTrq()
Returns the current torque of this stuntDouble.
virtual void setPrevA(const RotMat3x3d &a)
Sets the previous rotation matrix of this stuntDouble.
RotMat3x3d getPrevA()
Returns the previous rotation matrix of this stuntDouble.
void setPrevFrc(const Vector3d &frc)
Sets the previous force of this stuntDouble.
Vector3d getPrevVel()
Returns the previous velocity of this stuntDouble.
Vector3d lab2Body(const Vector3d &v)
Converts a lab fixed vector to a body fixed vector.
RotMat3x3d getA()
Returns the current rotation matrix of this stuntDouble.
Vector3d getVel()
Returns the current velocity of this stuntDouble.
virtual void setA(const RotMat3x3d &a)
Sets the current rotation matrix of this stuntDouble.
virtual void accept(BaseVisitor *v)=0
int linearAxis()
Returns the linear axis of the rigidbody, atom and directional atom will always return -1.
Vector3d getEuler()
Returns the current euler angles of this stuntDouble.
Vector3d getPrevJ()
Returns the previous angular momentum of this stuntDouble (body-fixed).
RealType getMass()
Returns the mass of this stuntDouble.
void setPrevVel(const Vector3d &vel)
Sets the previous velocity of this stuntDouble.
Mat3x3d getQuadrupole()
Returns the current quadrupole tensor of this stuntDouble.
Vector3d getPrevDipole()
Returns the previous dipole vector of this stuntDouble.
std::vector< std::shared_ptr< GenericData > > getProperties()
Returns all of the properties in PropertyMap.
std::shared_ptr< GenericData > getPropertyByName(const std::string &propName)
Returns property.
virtual Mat3x3d getI()=0
Returns the inertia tensor of this stuntDouble.
void addProperty(std::shared_ptr< GenericData > genData)
Adds property into property map.
virtual std::string getType()=0
Returns the name of this stuntDouble.
bool isLinear()
Tests the if this stuntDouble is a linear rigidbody.
Vector3d getPos()
Returns the current position of this stuntDouble.
Vector3d body2Lab(const Vector3d &v)
Converts a body fixed vector to a lab fixed vector.
void setPos(const Vector3d &pos)
Sets the current position of this stuntDouble.
Vector3d getDipole()
Returns the current dipole vector of this stuntDouble.
Vector3d getPrevTrq()
Returns the previous torque of this stuntDouble.
void setTrq(const Vector3d &trq)
Sets the current torque of this stuntDouble.
void addPrevTrq(const Vector3d &trq)
Adds torque into the previous torque of this stuntDouble.
void setGlobalIndex(int index)
Sets the global index of this stuntDouble.
Vector3d getPrevFrc()
Returns the previous force of this stuntDouble.
Quat4d getPrevQ()
Returns the previous quaternion of this stuntDouble.
void setSnapshotManager(SnapshotManager *sman)
Sets the Snapshot Manager of this stuntDouble.
std::vector< std::string > getPropertyNames()
Returns all names of properties.
void setEuler(const Vector3d &euler)
Sets the current euler angles of this stuntDouble.
void removeProperty(const std::string &propName)
Removes property from PropertyMap by name.
void setVel(const Vector3d &vel)
Sets the current velocity of this stuntDouble.
void addTrq(const Vector3d &trq)
Adds torque into the current torque of this stuntDouble.
bool isRigidBody()
Tests if this stuntDouble is a rigid body.
Vector3d getJ()
Returns the current angular momentum of this stuntDouble (body -fixed).
int getGlobalIndex()
Returns the global index of this stuntDouble.
bool isAtom()
Tests if this stuntDouble is an atom.
Vector3d getPrevPos()
Returns the previous position of this stuntDouble.
void setQ(const Quat4d &q)
Sets the current quaternion of this stuntDouble.
Vector3d getPrevEuler()
Returns the previous euler angles of this stuntDouble.
bool isDirectional()
Tests if this stuntDouble is a directional one.
Vector3d getFrc()
Returns the current force of this stuntDouble.
int getLocalIndex()
Returns the local index of this stuntDouble.
void setMass(RealType mass)
Sets the mass of this stuntdoulbe.
virtual void setType(const std::string &)
Sets the name of this stuntDouble.
void setFrc(const Vector3d &frc)
Sets the current force of this stuntDouble.
void setJ(const Vector3d &angMom)
Sets the current angular momentum of this stuntDouble (body-fixed).
virtual std::vector< RealType > getGrad()=0
Returns the gradient of this stuntDouble.
void setPrevJ(const Vector3d &angMom)
Sets the previous angular momentum of this stuntDouble (body-fixed).
void setLocalIndex(int index)
Sets the local index of this stuntDouble.
void setPrevPos(const Vector3d &pos)
Sets the previous position of this stuntDouble.
void addFrc(const Vector3d &frc)
Adds force into the current force of this stuntDouble.
void setPrevQ(const Quat4d &q)
Sets the previous quaternion of this stuntDouble.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.