source: src/base/matrix.hpp@ 66f24d

Last change on this file since 66f24d was 48b662, checked in by Olaf Lenz <olenz@…>, 14 years ago

Moved files in scafacos_fcs one level up.

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

  • Property mode set to 100644
File size: 965 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
12#ifndef MATRIX_HPP_
13#define MATRIX_HPP_
14
15#include "base/vector.hpp"
16
17namespace VMG
18{
19
20class Matrix
21{
22public:
23 Matrix()
24 {
25 for (int i=0; i<9; i++)
26 mat[i] = 0.0;
27 }
28
29 vmg_float& operator() (int i, int j) {return mat[j+3*i];}
30 const vmg_float& GetVal(int i, int j) const {return mat[j+3*i];}
31
32 const Vector operator*(const Vector& rhs) const
33 {
34 Vector result;
35
36 for (int i=0; i<3; i++) {
37 result.X() += this->GetVal(0, i) * rhs.X();
38 result.Y() += this->GetVal(1, i) * rhs.Y();
39 result.Z() += this->GetVal(2, i) * rhs.Z();
40 }
41
42 return result;
43 }
44
45private:
46 vmg_float mat[9];
47};
48
49const Matrix abT(const Vector lhs, const Vector rhs);
50
51}
52
53#endif /* MATRIX_HPP_ */
Note: See TracBrowser for help on using the repository browser.