FreeFOAM The Cross-Platform CFD Toolkit
scalarMatrices.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  scalarMatrices
26 
27 Description
28  Scalar matrices
29 
30 SourceFiles
31  scalarMatrices.C
32  scalarMatricesTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef scalarMatrices_H
37 #define scalarMatrices_H
38 
40 #include <OpenFOAM/SquareMatrix.H>
42 #include <OpenFOAM/scalarField.H>
43 #include <OpenFOAM/labelList.H>
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
53 
54 //- Solve the matrix using Gaussian elimination with pivoting,
55 // returning the solution in the source
56 template<class Type>
57 void solve(scalarSquareMatrix& matrix, Field<Type>& source);
58 
59 //- Solve the matrix using Gaussian elimination with pivoting
60 // and return the solution
61 template<class Type>
62 void solve
63 (
65  const scalarSquareMatrix& matrix,
66  const Field<Type>& source
67 );
68 
69 //- LU decompose the matrix with pivoting
70 void LUDecompose
71 (
72  scalarSquareMatrix& matrix,
73  labelList& pivotIndices
74 );
75 
76 //- LU back-substitution with given source, returning the solution
77 // in the source
78 template<class Type>
80 (
81  const scalarSquareMatrix& luMmatrix,
82  const labelList& pivotIndices,
83  Field<Type>& source
84 );
85 
86 //- Solve the matrix using LU decomposition with pivoting
87 // returning the LU form of the matrix and the solution in the source
88 template<class Type>
89 void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source);
90 
91 void multiply
92 (
93  scalarRectangularMatrix& answer, // value changed in return
96 );
97 
98 void multiply
99 (
100  scalarRectangularMatrix& answer, // value changed in return
101  const scalarRectangularMatrix& A,
102  const scalarRectangularMatrix& B,
104 );
105 
106 void multiply
107 (
108  scalarRectangularMatrix& answer, // value changed in return
109  const scalarRectangularMatrix& A,
110  const DiagonalMatrix<scalar>& B,
112 );
113 
114 //- Return the inverse of matrix A using SVD
116 (
117  const scalarRectangularMatrix& A,
118  scalar minCondition = 0
119 );
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #ifdef NoRepository
129 # include "scalarMatricesTemplates.C"
130 #endif
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************ vim: set sw=4 sts=4 et: ************************ //