| 1 | gezelter | 1097 | #ifndef _DIRECTIONALATOM_H_ | 
| 2 |  |  | #define _DIRECTIONALATOM_H_ | 
| 3 |  |  |  | 
| 4 |  |  | #include <string.h> | 
| 5 |  |  | #include <stdlib.h> | 
| 6 |  |  | #include <iostream> | 
| 7 |  |  |  | 
| 8 |  |  | #include "StuntDouble.hpp" | 
| 9 |  |  | #include "Atom.hpp" | 
| 10 |  |  |  | 
| 11 |  |  | class DirectionalAtom : public Atom { | 
| 12 |  |  |  | 
| 13 |  |  | public: | 
| 14 |  |  | DirectionalAtom(int theIndex, SimState* theConfig) : Atom(theIndex, | 
| 15 |  |  | theConfig) | 
| 16 |  |  | { | 
| 17 |  |  | objType = OT_DATOM; | 
| 18 |  |  |  | 
| 19 |  |  | for (int i=0; i < 3; i++) | 
| 20 |  |  | for (int j=0; j < 3; j++) | 
| 21 |  |  | sU[i][j] = 0.0; | 
| 22 |  |  |  | 
| 23 |  |  | } | 
| 24 |  |  | virtual ~DirectionalAtom() {} | 
| 25 |  |  |  | 
| 26 |  |  | virtual void setCoords(void); | 
| 27 |  |  |  | 
| 28 |  |  | void printAmatIndex( void ); | 
| 29 |  |  |  | 
| 30 |  |  | void setUnitFrameFromEuler(double phi, double theta, double psi); | 
| 31 |  |  | void setEuler( double phi, double theta, double psi ); | 
| 32 |  |  |  | 
| 33 |  |  | void zeroForces(); | 
| 34 |  |  |  | 
| 35 |  |  | void getA( double the_A[3][3] ); // get the full rotation matrix | 
| 36 |  |  | void setA( double the_A[3][3] ); | 
| 37 |  |  | void rotateBy( double by_A[3][3] );  // rotate your frame using this matrix | 
| 38 |  |  |  | 
| 39 |  |  | void getU( double the_u[3] ); // get the unit vetor | 
| 40 |  |  | void updateU( void ); | 
| 41 |  |  |  | 
| 42 |  |  | void getQ( double the_q[4] ); // get the quanternions | 
| 43 |  |  | void setQ( double the_q[4] ); | 
| 44 |  |  |  | 
| 45 |  |  | void getJ( double theJ[3] ); | 
| 46 |  |  | void setJ( double theJ[3] ); | 
| 47 |  |  |  | 
| 48 |  |  | void getTrq( double theT[3] ); | 
| 49 | tim | 1452 | void setTrq( double theT[3] ); | 
| 50 | gezelter | 1097 | void addTrq( double theT[3] ); | 
| 51 |  |  |  | 
| 52 |  |  | void setI( double the_I[3][3] ); | 
| 53 |  |  | void getI( double the_I[3][3] ); | 
| 54 |  |  |  | 
| 55 |  |  | void lab2Body( double r[3] ); | 
| 56 |  |  | void body2Lab( double r[3] ); | 
| 57 |  |  |  | 
| 58 | chrisfen | 1187 | double getZangle( ); | 
| 59 |  |  | void setZangle( double zAng ); | 
| 60 |  |  | void addZangle( double zAng ); | 
| 61 |  |  |  | 
| 62 | gezelter | 1097 | // Four functions added for derivatives with respect to Euler Angles: | 
| 63 |  |  | // (Needed for minimization routines): | 
| 64 |  |  |  | 
| 65 |  |  | void getGrad(double gradient[6] ); | 
| 66 |  |  | void getEulerAngles( double myEuler[3] ); | 
| 67 |  |  |  | 
| 68 |  |  | double max(double x, double y); | 
| 69 |  |  | double min(double x, double y); | 
| 70 | tim | 1126 |  | 
| 71 |  |  | virtual void accept(BaseVisitor* v) {v->visit(this);} | 
| 72 | gezelter | 1097 |  | 
| 73 |  |  | private: | 
| 74 |  |  | int dIndex; | 
| 75 |  |  |  | 
| 76 |  |  | double sU[3][3];       // the standard unit vectors    ( body fixed ) | 
| 77 |  |  |  | 
| 78 |  |  | double jx, jy, jz;    // the angular momentum vector ( body fixed ) | 
| 79 |  |  |  | 
| 80 |  |  | double Ixx, Ixy, Ixz; // the inertial tensor matrix  ( body fixed ) | 
| 81 |  |  | double Iyx, Iyy, Iyz; | 
| 82 |  |  | double Izx, Izy, Izz; | 
| 83 |  |  |  | 
| 84 |  |  | }; | 
| 85 |  |  |  | 
| 86 |  |  | #endif |