1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A simple square matrix solver with scalar coefficients.
29 Simple dense matrix class with direct solvers.
32 Hrvoje Jasak, Wikki Ltd. All rights reserved
37 \*---------------------------------------------------------------------------*/
39 #ifndef simpleMatrix_H
40 #define simpleMatrix_H
42 #include "scalarMatrices.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of friend functions and operators
55 simpleMatrix<Type> operator+
57 const simpleMatrix<Type>&,
58 const simpleMatrix<Type>&
62 simpleMatrix<Type> operator-
64 const simpleMatrix<Type>&,
65 const simpleMatrix<Type>&
69 simpleMatrix<Type> operator*
72 const simpleMatrix<Type>&
79 const simpleMatrix<Type>&
83 /*---------------------------------------------------------------------------*\
84 Class simpleMatrix Declaration
85 \*---------------------------------------------------------------------------*/
90 public scalarSquareMatrix
101 //- Construct given size
102 // Note: this does not initialise the coefficients or the source.
103 simpleMatrix(const label);
105 //- Construct given size and initial values for the
106 // coefficients and source
107 simpleMatrix(const label, const scalar, const Type&);
109 //- Construct from components
110 simpleMatrix(const scalarSquareMatrix&, const Field<Type>&);
112 //- Construct from Istream
113 simpleMatrix(Istream&);
115 //- Construct as copy
116 simpleMatrix(const simpleMatrix<Type>&);
123 //- Return access to the source
124 Field<Type>& source()
129 //- Return const-access to the source
130 const Field<Type>& source() const
136 //- Solve the matrix using Gaussian elimination with pivoting
137 // and return the solution
138 Field<Type> solve() const;
140 //- Solve the matrix using LU decomposition with pivoting
141 // and return the solution
142 Field<Type> LUsolve() const;
147 void operator=(const simpleMatrix<Type>&);
152 friend Ostream& operator<< <Type>
155 const simpleMatrix<Type>&
163 simpleMatrix<Type> operator+
165 const simpleMatrix<Type>&,
166 const simpleMatrix<Type>&
170 simpleMatrix<Type> operator-
172 const simpleMatrix<Type>&,
173 const simpleMatrix<Type>&
177 simpleMatrix<Type> operator*
180 const simpleMatrix<Type>&
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 } // End namespace Foam
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 # include "simpleMatrix.C"
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 // ************************************************************************* //