matrix3D.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  matrix3D
26 
27 Description
28  Implementation of 3 x 3 matrix
29 
30 SourceFiles
31  matrix3D.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef matrix3D_H
36 #define matrix3D_H
37 
38 #include "scalar.H"
39 #include "FixedList.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class matrix3D Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class matrix3D
51 : public FixedList<FixedList<scalar, 3>, 3>
52 {
53  // Private members
54  scalar det_;
55  bool calculatedDet_;
56 
57  // Private member functions
58  //- calculate matrix determinant
59  inline void calculateDeterminant();
60 
61 public:
62 
63  // Constructors
64  //- Null constructor
65  explicit inline matrix3D();
66 
67  //- Copy constructor
68  inline matrix3D(const matrix3D&);
69 
70  // Destructor
71  inline ~matrix3D();
72 
73  // Member functions
74  //- return matrix determinant
75  inline scalar determinant();
76 
77  //- return inverse matrix
78  inline matrix3D inverse();
79 
80  //- find the solution of the system with the given rhs
82  (
83  const FixedList<scalar, 3>& source
84  );
85 
86  //- return the first component of the solution vector
87  inline scalar solveFirst(const FixedList<scalar, 3>& source);
88 
89  //- return the second component of the solution vector
90  inline scalar solveSecond(const FixedList<scalar, 3>& source);
91 
92  //- return the third component of the solution vector
93  inline scalar solveThird(const FixedList<scalar, 3>& source);
94 };
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 } // End namespace Foam
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 #include "matrix3DI.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 #endif
107 
108 // ************************************************************************* //
Foam::matrix3D::calculateDeterminant
void calculateDeterminant()
calculate matrix determinant
Definition: matrix3DI.H:39
Foam::matrix3D::matrix3D
matrix3D()
Null constructor.
Definition: matrix3DI.H:56
Foam::matrix3D::~matrix3D
~matrix3D()
Definition: matrix3DI.H:69
Foam::matrix3D::det_
scalar det_
Definition: matrix3D.H:53
matrix3DI.H
Foam::matrix3D::solveSecond
scalar solveSecond(const FixedList< scalar, 3 > &source)
return the second component of the solution vector
Definition: matrix3DI.H:128
Foam::matrix3D::calculatedDet_
bool calculatedDet_
Definition: matrix3D.H:54
Foam::matrix3D::determinant
scalar determinant()
return matrix determinant
Definition: matrix3DI.H:74
Foam::matrix3D::inverse
matrix3D inverse()
return inverse matrix
Definition: matrix3DI.H:81
scalar.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::matrix3D::solve
FixedList< scalar, 3 > solve(const FixedList< scalar, 3 > &source)
find the solution of the system with the given rhs
Definition: matrix3DI.H:102
Foam::FixedList
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:53
Foam::matrix3D::solveFirst
scalar solveFirst(const FixedList< scalar, 3 > &source)
return the first component of the solution vector
Definition: matrix3DI.H:114
Foam::matrix3D
Definition: matrix3D.H:49
FixedList.H
Foam::matrix3D::solveThird
scalar solveThird(const FixedList< scalar, 3 > &source)
return the third component of the solution vector
Definition: matrix3DI.H:142