1 /*
2  *_________________________________________________________________________*
3  *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
4  *      DESCRIPTION: SEE READ-ME                                           *
5  *      FILE NAME: mat6x6.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 MAT6X6_H
19 #define MAT6X6_H
20 #include "virtualmatrix.h"
21 
22 
23 class Matrix;
24 class Mat3x3;
25 class Vect6;
26 class Vect3;
27 
28 class Mat6x6 : public VirtualMatrix  {
29   double elements[6][6];
30 public:
31   Mat6x6();
32   ~Mat6x6();
33   Mat6x6(const Mat6x6& A);  // copy constructor
34   Mat6x6(const VirtualMatrix& A);  // copy constructor
35 
36   double& operator_2int(int i, int j); // array access
37   double Get_2int(int i, int j) const;
38   void Set_2int(int i, int j, double value);
39   double BasicGet_2int(int i, int j) const;
40   void BasicSet_2int(int i, int j, double value);
41   void BasicIncrement_2int(int i, int j, double value);
42 
43   void Const(double value);
44   MatrixType GetType() const;
45 
46   std::istream& ReadData(std::istream& c); // input
47   std::ostream& WriteData(std::ostream& c) const; // output
48 
49   void AssignVM(const VirtualMatrix& A);
50   Mat6x6& operator=(const Mat6x6& A); // assignment operator
51   Mat6x6& operator=(const VirtualMatrix& A); // overloaded =
52   Mat6x6& operator*=(double b);
53 
54   Mat6x6& Identity();
55 
56   friend Mat6x6 T(const Mat6x6& A);  // a wasteful transpose
57 
58   // fast matrix operations
59   friend void FastAdd(Mat6x6& A, Mat6x6& B, Mat6x6& C);
60   friend void FastSubt(Mat6x6& A, Mat6x6& B, Mat6x6& C);
61   friend void FastMultT(Matrix& A, Matrix& B, Mat6x6& C);
62   friend void FastMult(Mat6x6& A, Mat6x6& B, Mat6x6& C);  // C = A*B
63   friend void FastMult(Mat6x6& A, Matrix& B, Matrix& C);
64   friend void FastMultT(Mat6x6& A, Mat6x6& B, Mat6x6& C);  // C = A*B^T
65   friend void FastTMult(Mat6x6& A, Mat6x6& B, Mat6x6& C);  // C = A^T*B
66   friend void FastMult(Mat6x6& A, Vect6& B, Vect6& C);
67   friend void FastTMult(Mat6x6& A, Vect6& B, Vect6& C);
68   friend void FastLDLT(Mat6x6& A, Mat6x6& C);
69   friend void FastLDLTSubs(Mat6x6& LD, Mat6x6& B, Mat6x6& C);
70   friend void FastLDLTSubs(Mat6x6& LD, Vect6& B, Vect6& C);
71 
72   friend void OnPopulateSC(Vect3& gamma, Mat3x3& C, Mat6x6& SC);
73   friend void OnPopulateSI(Mat3x3& inertia, double mass, Mat6x6& sI);
74 };
75 
76 #endif
77