1 /*
2  *_________________________________________________________________________*
3  *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
4  *      DESCRIPTION: SEE READ-ME                                           *
5  *      FILE NAME: vect3.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 #ifndef VECT3_H
19 #define VECT3_H
20 
21 #include "virtualcolmatrix.h"
22 
23 class Matrix;
24 class Mat3x3;
25 class Mat6x6;
26 class Vect6;
27 class ColMatrix;
28 
29 class Vect3 : public VirtualColMatrix  {
30   double elements[3];
31 public:
32   Vect3();
33   ~Vect3();
34   Vect3(const Vect3& A);  // copy constructor
35   Vect3(const VirtualMatrix& A);  // copy constructor
36 
37   double& operator_1int(int i); // array access
38   double Get_1int(int i) const;
39   void Set_1int(int i, double value);
40   double BasicGet_1int(int i) const;
41   void BasicSet_1int(int i, double value);
42   void BasicIncrement_1int(int i, double value);
43 
44   void Const(double value);
45   MatrixType GetType() const;
46   std::ostream& WriteData(std::ostream& c) const;
47   std::istream& ReadData(std::istream& c);
48 
49   void AssignVM(const VirtualMatrix& A);
50   Vect3& operator=(const Vect3& A); // assignment operator
51   Vect3& operator=(const VirtualMatrix& A); // overloaded =
52   Vect3& operator*=(double b);
53   Vect3& operator+=(const Vect3& A);
54   Vect3& operator-=(const Vect3& A);
55 
56   friend Matrix T(const Vect3& A);  // a wasteful transpose
57   friend Mat3x3 CrossMat(Vect3& a);  // a wasteful cross matrix implementation
58 
59   friend void Set6DAngularVector(Vect6& v6, Vect3& v3);
60   friend void Set6DLinearVector(Vect6& v6, Vect3& v3);
61 
62   // fast matrix functions
63   friend void FastAssign(Vect3& a, Vect3& c);
64   friend void FastSimpleRotation(Vect3& v, double q, Mat3x3& d);
65   friend void FastCross(Vect3& a, Vect3& b, Vect3& c); // cross product axb = c
66   friend void FastTripleSum(Vect3& a, Vect3& b, Vect3& c, Vect3& d);
67   friend void FastTripleSumPPM(Vect3& a, Vect3& b, Vect3& c, Vect3& d);
68   friend void FastMult(Mat3x3& A, Vect3& B, Vect3& C);
69   friend void FastTMult(Mat3x3& A, Vect3& B, Vect3& C);
70   friend void FastNegMult(Mat3x3& A, Vect3& B, Vect3& C);
71   friend void FastNegTMult(Mat3x3& A, Vect3& B, Vect3& C);
72   friend void FastMult(double a, Vect3& B, Vect3& C);
73   friend void FastAdd(Vect3& A, Vect3& B, Vect3& C);
74   friend void FastSubt(Vect3& A, Vect3& B, Vect3& C);
75   friend void OnPopulateSVect(Vect3& angular, Vect3& linear, Vect6& sV);
76   friend void OnPopulateSC(Vect3& gamma, Mat3x3& C, Mat6x6& SC);
77 
78   friend void FastMult(Mat3x3& A, ColMatrix& B, Vect3& C);
79   friend void FastAssign(ColMatrix&A, Vect3& C);
80   friend void FastMult(Mat3x3& A, Vect3& B, ColMatrix& C);
81 
82 };
83 
84 #endif
85