1 |
#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 |
void addTrq( double theT[3] ); |
50 |
|
51 |
void setI( double the_I[3][3] ); |
52 |
void getI( double the_I[3][3] ); |
53 |
|
54 |
void lab2Body( double r[3] ); |
55 |
void body2Lab( double r[3] ); |
56 |
|
57 |
double getZangle( ); |
58 |
void setZangle( double zAng ); |
59 |
void addZangle( double zAng ); |
60 |
|
61 |
// Four functions added for derivatives with respect to Euler Angles: |
62 |
// (Needed for minimization routines): |
63 |
|
64 |
void getGrad(double gradient[6] ); |
65 |
void getEulerAngles( double myEuler[3] ); |
66 |
|
67 |
double max(double x, double y); |
68 |
double min(double x, double y); |
69 |
|
70 |
virtual void accept(BaseVisitor* v) {v->visit(this);} |
71 |
|
72 |
private: |
73 |
int dIndex; |
74 |
|
75 |
double sU[3][3]; // the standard unit vectors ( body fixed ) |
76 |
|
77 |
double jx, jy, jz; // the angular momentum vector ( body fixed ) |
78 |
|
79 |
double Ixx, Ixy, Ixz; // the inertial tensor matrix ( body fixed ) |
80 |
double Iyx, Iyy, Iyz; |
81 |
double Izx, Izy, Izz; |
82 |
|
83 |
}; |
84 |
|
85 |
#endif |