source: src/base/matrix.hpp@ dfed1c

Last change on this file since dfed1c was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 964 bytes
Line 
1/**
2 * @file matrix.hpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:20:22 2011
5 *
6 * @brief Header file for the class VMG::Matrix, which represents a 3x3 matrix
7 * and defines some useful operations.
8 *
9 */
10
11#ifndef MATRIX_HPP_
12#define MATRIX_HPP_
13
14#include "base/vector.hpp"
15
16namespace VMG
17{
18
19class Matrix
20{
21public:
22 Matrix()
23 {
24 for (int i=0; i<9; i++)
25 mat[i] = 0.0;
26 }
27
28 vmg_float& operator() (int i, int j) {return mat[j+3*i];}
29 const vmg_float& GetVal(int i, int j) const {return mat[j+3*i];}
30
31 const Vector operator*(const Vector& rhs) const
32 {
33 Vector result;
34
35 for (int i=0; i<3; i++) {
36 result.X() += this->GetVal(0, i) * rhs.X();
37 result.Y() += this->GetVal(1, i) * rhs.Y();
38 result.Z() += this->GetVal(2, i) * rhs.Z();
39 }
40
41 return result;
42 }
43
44private:
45 vmg_float mat[9];
46};
47
48const Matrix abT(const Vector lhs, const Vector rhs);
49
50}
51
52#endif /* MATRIX_HPP_ */
Note: See TracBrowser for help on using the repository browser.