FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     scalarMatrices
00026 
00027 Description
00028     Scalar matrices
00029 
00030 SourceFiles
00031     scalarMatrices.C
00032     scalarMatricesTemplates.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef scalarMatrices_H
00037 #define scalarMatrices_H
00038 
00039 #include <OpenFOAM/RectangularMatrix.H>
00040 #include <OpenFOAM/SquareMatrix.H>
00041 #include <OpenFOAM/DiagonalMatrix.H>
00042 #include <OpenFOAM/scalarField.H>
00043 #include <OpenFOAM/labelList.H>
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 typedef RectangularMatrix<scalar> scalarRectangularMatrix;
00051 typedef SquareMatrix<scalar> scalarSquareMatrix;
00052 typedef DiagonalMatrix<scalar> scalarDiagonalMatrix;
00053 
00054 //- Solve the matrix using Gaussian elimination with pivoting,
00055 //  returning the solution in the source
00056 template<class Type>
00057 void solve(scalarSquareMatrix& matrix, Field<Type>& source);
00058 
00059 //- Solve the matrix using Gaussian elimination with pivoting
00060 //  and return the solution
00061 template<class Type>
00062 void solve
00063 (
00064     Field<Type>& psi,
00065     const scalarSquareMatrix& matrix,
00066     const Field<Type>& source
00067 );
00068 
00069 //- LU decompose the matrix with pivoting
00070 void LUDecompose
00071 (
00072     scalarSquareMatrix& matrix,
00073     labelList& pivotIndices
00074 );
00075 
00076 //- LU back-substitution with given source, returning the solution
00077 //  in the source
00078 template<class Type>
00079 void LUBacksubstitute
00080 (
00081     const scalarSquareMatrix& luMmatrix,
00082     const labelList& pivotIndices,
00083     Field<Type>& source
00084 );
00085 
00086 //- Solve the matrix using LU decomposition with pivoting
00087 //  returning the LU form of the matrix and the solution in the source
00088 template<class Type>
00089 void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source);
00090 
00091 void multiply
00092 (
00093     scalarRectangularMatrix& answer,         // value changed in return
00094     const scalarRectangularMatrix& A,
00095     const scalarRectangularMatrix& B
00096 );
00097 
00098 void multiply
00099 (
00100     scalarRectangularMatrix& answer,         // value changed in return
00101     const scalarRectangularMatrix& A,
00102     const scalarRectangularMatrix& B,
00103     const scalarRectangularMatrix& C
00104 );
00105 
00106 void multiply
00107 (
00108     scalarRectangularMatrix& answer,         // value changed in return
00109     const scalarRectangularMatrix& A,
00110     const DiagonalMatrix<scalar>& B,
00111     const scalarRectangularMatrix& C
00112 );
00113 
00114 //- Return the inverse of matrix A using SVD
00115 scalarRectangularMatrix SVDinv
00116 (
00117     const scalarRectangularMatrix& A,
00118     scalar minCondition = 0
00119 );
00120 
00121 
00122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00123 
00124 } // End namespace Foam
00125 
00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00127 
00128 #ifdef NoRepository
00129 #   include "scalarMatricesTemplates.C"
00130 #endif
00131 
00132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00133 
00134 #endif
00135 
00136 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines