1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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/>.
32 scalarMatricesTemplates.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef scalarMatrices_H
37 #define scalarMatrices_H
39 #include "RectangularMatrix.H"
40 #include "SquareMatrix.H"
41 #include "DiagonalMatrix.H"
42 #include "scalarField.H"
43 #include "labelList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 typedef RectangularMatrix<scalar> scalarRectangularMatrix;
51 typedef SquareMatrix<scalar> scalarSquareMatrix;
52 typedef DiagonalMatrix<scalar> scalarDiagonalMatrix;
54 //- Solve the matrix using Gaussian elimination with pivoting,
55 // returning the solution in the source
57 void solve(scalarSquareMatrix& matrix, Field<Type>& source);
59 //- Solve the matrix using Gaussian elimination with pivoting
60 // and return the solution
65 const scalarSquareMatrix& matrix,
66 const Field<Type>& source
69 //- LU decompose the matrix with pivoting
72 scalarSquareMatrix& matrix,
73 labelList& pivotIndices
76 //- LU back-substitution with given source, returning the solution
81 const scalarSquareMatrix& luMmatrix,
82 const labelList& pivotIndices,
86 //- Solve the matrix using LU decomposition with pivoting
87 // returning the LU form of the matrix and the solution in the source
89 void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source);
93 scalarRectangularMatrix& answer, // value changed in return
94 const scalarRectangularMatrix& A,
95 const scalarRectangularMatrix& B
100 scalarRectangularMatrix& answer, // value changed in return
101 const scalarRectangularMatrix& A,
102 const scalarRectangularMatrix& B,
103 const scalarRectangularMatrix& C
108 scalarRectangularMatrix& answer, // value changed in return
109 const scalarRectangularMatrix& A,
110 const DiagonalMatrix<scalar>& B,
111 const scalarRectangularMatrix& C
114 //- Return the inverse of matrix A using SVD
115 scalarRectangularMatrix SVDinv
117 const scalarRectangularMatrix& A,
118 scalar minCondition = 0
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 } // End namespace Foam
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 # include "scalarMatricesTemplates.C"
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 // ************************************************************************* //