1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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
34 \*---------------------------------------------------------------------------*/
36 #ifndef scalarMatrix_H
37 #define scalarMatrix_H
40 #include "scalarField.H"
41 #include "labelList.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class scalarMatrix Declaration
50 \*---------------------------------------------------------------------------*/
64 //- Construct given size
65 scalarMatrix(const label);
67 //- Construct from Matrix<scalar>
68 scalarMatrix(const Matrix<scalar>&);
70 //- Construct from Istream
71 scalarMatrix(Istream&);
76 //- Solve the matrix using Gaussian elimination with pivoting,
77 // returning the solution in the source
79 static void solve(Matrix<scalar>& matrix, Field<T>& source);
81 //- Solve the matrix using Gaussian elimination with pivoting
82 // and return the solution
84 void solve(Field<T>& psi, const Field<T>& source) const;
87 //- LU decompose the matrix with pivoting
88 static void LUDecompose
90 Matrix<scalar>& matrix,
91 labelList& pivotIndices
94 //- LU back-substitution with given source, returning the solution
97 static void LUBacksubstitute
99 const Matrix<scalar>& luMmatrix,
100 const labelList& pivotIndices,
104 //- Solve the matrix using LU decomposition with pivoting
105 // returning the LU form of the matrix and the solution in the source
107 static void LUsolve(Matrix<scalar>& matrix, Field<T>& source);
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 } // End namespace Foam
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 # include "scalarMatrixTemplates.C"
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 // ************************************************************************* //