ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/primitives/DirectionalAtom.hpp
Revision: 1709
Committed: Thu Nov 4 16:22:03 2004 UTC (19 years, 8 months ago) by gezelter
File size: 2240 byte(s)
Log Message:
isLinear and linearAxis are virtual in StuntDouble,
but are implemented by DirectionalAtom and RigidBody
In StuntDouble, they should return false and "-1" but
there should be logic to figure them out in the other
two classes

File Contents

# User Rev Content
1 gezelter 1490 #ifndef _DIRECTIONALATOM_H_
2     #define _DIRECTIONALATOM_H_
3    
4     #include <string.h>
5     #include <stdlib.h>
6     #include <iostream>
7    
8 tim 1492 #include "primitives/StuntDouble.hpp"
9     #include "primitives/Atom.hpp"
10 gezelter 1490
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 gezelter 1709 is_linear = false;
24     linear_axis = -1;
25     momIntTol = 1e-6;
26 gezelter 1490 }
27     virtual ~DirectionalAtom() {}
28    
29     virtual void setCoords(void);
30    
31     void printAmatIndex( void );
32    
33     void setUnitFrameFromEuler(double phi, double theta, double psi);
34     void setEuler( double phi, double theta, double psi );
35    
36     void zeroForces();
37    
38     void getA( double the_A[3][3] ); // get the full rotation matrix
39     void setA( double the_A[3][3] );
40     void rotateBy( double by_A[3][3] ); // rotate your frame using this matrix
41    
42     void getU( double the_u[3] ); // get the unit vetor
43     void updateU( void );
44    
45     void getQ( double the_q[4] ); // get the quanternions
46     void setQ( double the_q[4] );
47    
48     void getJ( double theJ[3] );
49     void setJ( double theJ[3] );
50    
51     void getTrq( double theT[3] );
52     void addTrq( double theT[3] );
53    
54     void setI( double the_I[3][3] );
55     void getI( double the_I[3][3] );
56 gezelter 1709
57     bool isLinear() {return is_linear;}
58     int linearAxis() {return linear_axis;}
59 gezelter 1490
60     void lab2Body( double r[3] );
61     void body2Lab( double r[3] );
62    
63     double getZangle( );
64     void setZangle( double zAng );
65     void addZangle( double zAng );
66    
67     // Four functions added for derivatives with respect to Euler Angles:
68     // (Needed for minimization routines):
69    
70     void getGrad(double gradient[6] );
71     void getEulerAngles( double myEuler[3] );
72    
73     double max(double x, double y);
74     double min(double x, double y);
75    
76     virtual void accept(BaseVisitor* v) {v->visit(this);}
77    
78     private:
79     int dIndex;
80    
81     double sU[3][3]; // the standard unit vectors ( body fixed )
82    
83     double jx, jy, jz; // the angular momentum vector ( body fixed )
84    
85     double Ixx, Ixy, Ixz; // the inertial tensor matrix ( body fixed )
86     double Iyx, Iyy, Iyz;
87     double Izx, Izy, Izz;
88    
89 gezelter 1709 bool is_linear;
90     int linear_axis;
91     double momIntTol;
92    
93 gezelter 1490 };
94    
95     #endif