OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

scalarMatrices.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     scalarMatrices
00027 
00028 Description
00029     Scalar matrices
00030 
00031 SourceFiles
00032     scalarMatrices.C
00033     scalarMatricesTemplates.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef scalarMatrices_H
00038 #define scalarMatrices_H
00039 
00040 #include "RectangularMatrix.H"
00041 #include "SquareMatrix.H"
00042 #include "DiagonalMatrix.H"
00043 #include "scalarField.H"
00044 #include "labelList.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 typedef RectangularMatrix<scalar> scalarRectangularMatrix;
00052 typedef SquareMatrix<scalar> scalarSquareMatrix;
00053 typedef DiagonalMatrix<scalar> scalarDiagonalMatrix;
00054 
00055 //- Solve the matrix using Gaussian elimination with pivoting,
00056 //  returning the solution in the source
00057 template<class Type>
00058 void solve(scalarSquareMatrix& matrix, Field<Type>& source);
00059 
00060 //- Solve the matrix using Gaussian elimination with pivoting
00061 //  and return the solution
00062 template<class Type>
00063 void solve
00064 (
00065     Field<Type>& psi,
00066     const scalarSquareMatrix& matrix,
00067     const Field<Type>& source
00068 );
00069 
00070 //- LU decompose the matrix with pivoting
00071 void LUDecompose
00072 (
00073     scalarSquareMatrix& matrix,
00074     labelList& pivotIndices
00075 );
00076 
00077 //- LU back-substitution with given source, returning the solution
00078 //  in the source
00079 template<class Type>
00080 void LUBacksubstitute
00081 (
00082     const scalarSquareMatrix& luMmatrix,
00083     const labelList& pivotIndices,
00084     Field<Type>& source
00085 );
00086 
00087 //- Solve the matrix using LU decomposition with pivoting
00088 //  returning the LU form of the matrix and the solution in the source
00089 template<class Type>
00090 void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source);
00091 
00092 void multiply
00093 (
00094     scalarRectangularMatrix& answer,         // value changed in return
00095     const scalarRectangularMatrix& A,
00096     const scalarRectangularMatrix& B
00097 );
00098 
00099 void multiply
00100 (
00101     scalarRectangularMatrix& answer,         // value changed in return
00102     const scalarRectangularMatrix& A,
00103     const scalarRectangularMatrix& B,
00104     const scalarRectangularMatrix& C
00105 );
00106 
00107 void multiply
00108 (
00109     scalarRectangularMatrix& answer,         // value changed in return
00110     const scalarRectangularMatrix& A,
00111     const DiagonalMatrix<scalar>& B,
00112     const scalarRectangularMatrix& C
00113 );
00114 
00115 //- Return the inverse of matrix A using SVD
00116 scalarRectangularMatrix SVDinv
00117 (
00118     const scalarRectangularMatrix& A,
00119     scalar minCondition = 0
00120 );
00121 
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 } // End namespace Foam
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 #ifdef NoRepository
00130 #   include "scalarMatricesTemplates.C"
00131 #endif
00132 
00133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00134 
00135 #endif
00136 
00137 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd