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