1 /*
2  *_________________________________________________________________________*
3  *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
4  *      DESCRIPTION: SEE READ-ME                                           *
5  *      FILE NAME: body.h                                                  *
6  *      AUTHORS: See Author List                                           *
7  *      GRANTS: See Grants List                                            *
8  *      COPYRIGHT: (C) 2005 by Authors as listed in Author's List          *
9  *      LICENSE: Please see License Agreement                              *
10  *      DOWNLOAD: Free at www.rpi.edu/~anderk5                             *
11  *      ADMINISTRATOR: Prof. Kurt Anderson                                 *
12  *                     Computational Dynamics Lab                          *
13  *                     Rensselaer Polytechnic Institute                    *
14  *                     110 8th St. Troy NY 12180                           *
15  *      CONTACT:        anderk5@rpi.edu                                    *
16  *_________________________________________________________________________*/
17 
18 
19 #ifndef BODY_H
20 #define BODY_H
21 
22 #include "poemslist.h"
23 #include <iostream>
24 #include "poemsobject.h"
25 
26 #include "matrices.h"
27 
28 
29 
30 // emumerated type
31 enum BodyType {
32   INERTIALFRAME = 0,
33   PARTICLE = 1,
34   RIGIDBODY = 2
35 };
36 
37 class Point;
38 class Joint;
39 class CompBody;
40 
41 class Body : public POEMSObject {
42 public:
43   double mass;
44   Mat3x3 inertia;
45 
46   Vect3 r;
47   Vect3 v;
48   Vect3 v_k;
49   Vect3 a;
50   Vect3 a_t;
51   Mat3x3 n_C_k;
52   Vect3 btorque;
53   Vect3 ttorque;
54   Vect3 omega;
55   Vect3 omega_k;
56   Vect3 alpha;
57   Vect3 alpha_t;
58   double KE;
59 
60 
61   List<Joint> joints;
62   List<Point> points;
63 
64   Body();
65 
66   bool ReadIn(std::istream& in);
67   void WriteOut(std::ostream& out);
68   bool ReadInPoints(std::istream& in);
69   void WriteOutPoints(std::ostream& out);
70   Point* GetPoint(int p);
71   void AddJoint(Joint* joint);
72   void AddPoint(Point* point);
73 
74   virtual bool ReadInBodyData(std::istream& in) = 0;
75   virtual void WriteOutBodyData(std::ostream& out) = 0;
76   virtual ~Body();
77   virtual BodyType GetType() = 0;
78 };
79 
80 // global body functions
81 Body* NewBody(int type);
82 
83 #endif
84