1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 A simple square matrix solver with scalar coefficients.
33 \*---------------------------------------------------------------------------*/
35 #ifndef simpleMatrix_H
36 #define simpleMatrix_H
38 #include "scalarMatrices.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // Forward declaration of friend functions and operators
54 const simpleMatrix<Type>&
58 /*---------------------------------------------------------------------------*\
59 Class simpleMatrix Declaration
60 \*---------------------------------------------------------------------------*/
65 public scalarSquareMatrix
76 //- Construct given size
77 // Note: this does not initialise the coefficients or the source.
78 simpleMatrix(const label);
80 //- Construct given size and initial values for coefficients and source
81 simpleMatrix(const label, const scalar, const Type&);
83 //- Construct from components
84 simpleMatrix(const scalarSquareMatrix&, const Field<Type>&);
86 //- Construct from Istream
87 simpleMatrix(Istream&);
90 simpleMatrix(const simpleMatrix<Type>&);
97 //- Return access to the source
103 //- Return const-access to the source
104 const Field<Type>& source() const
110 //- Solve the matrix using Gaussian elimination with pivoting
111 // and return the solution
112 Field<Type> solve() const;
114 //- Solve the matrix using LU decomposition with pivoting
115 // and return the solution
116 Field<Type> LUsolve() const;
121 void operator=(const simpleMatrix<Type>&);
126 friend Ostream& operator<< <Type>
129 const simpleMatrix<Type>&
137 simpleMatrix<Type> operator+
139 const simpleMatrix<Type>&,
140 const simpleMatrix<Type>&
144 simpleMatrix<Type> operator-
146 const simpleMatrix<Type>&,
147 const simpleMatrix<Type>&
151 simpleMatrix<Type> operator*
154 const simpleMatrix<Type>&
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 } // End namespace Foam
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 # include "simpleMatrix.C"
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 // ************************************************************************* //