1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 scalarMatricesTemplates.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef scalarMatrices_H
38 #define scalarMatrices_H
40 #include "RectangularMatrix.H"
41 #include "SquareMatrix.H"
42 #include "DiagonalMatrix.H"
43 #include "scalarField.H"
44 #include "labelList.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 typedef RectangularMatrix<scalar> scalarRectangularMatrix;
52 typedef SquareMatrix<scalar> scalarSquareMatrix;
53 typedef DiagonalMatrix<scalar> scalarDiagonalMatrix;
55 //- Solve the matrix using Gaussian elimination with pivoting,
56 // returning the solution in the source
58 void solve(scalarSquareMatrix& matrix, Field<Type>& source);
60 //- Solve the matrix using Gaussian elimination with pivoting
61 // and return the solution
66 const scalarSquareMatrix& matrix,
67 const Field<Type>& source
70 //- LU decompose the matrix with pivoting
73 scalarSquareMatrix& matrix,
74 labelList& pivotIndices
77 //- LU back-substitution with given source, returning the solution
82 const scalarSquareMatrix& luMmatrix,
83 const labelList& pivotIndices,
87 //- Solve the matrix using LU decomposition with pivoting
88 // returning the LU form of the matrix and the solution in the source
90 void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source);
94 scalarRectangularMatrix& answer, // value changed in return
95 const scalarRectangularMatrix& A,
96 const scalarRectangularMatrix& B
101 scalarRectangularMatrix& answer, // value changed in return
102 const scalarRectangularMatrix& A,
103 const scalarRectangularMatrix& B,
104 const scalarRectangularMatrix& C
109 scalarRectangularMatrix& answer, // value changed in return
110 const scalarRectangularMatrix& A,
111 const DiagonalMatrix<scalar>& B,
112 const scalarRectangularMatrix& C
115 //- Return the inverse of matrix A using SVD
116 scalarRectangularMatrix SVDinv
118 const scalarRectangularMatrix& A,
119 scalar minCondition = 0
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 } // End namespace Foam
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 # include "scalarMatricesTemplates.C"
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 // ************************************************************************* //