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

LUscalarMatrix.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     Foam::LUscalarMatrix
00026 
00027 Description
00028     Foam::LUscalarMatrix
00029 
00030 SourceFiles
00031     LUscalarMatrix.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef LUscalarMatrix_H
00036 #define LUscalarMatrix_H
00037 
00038 #include <OpenFOAM/scalarMatrices.H>
00039 #include <OpenFOAM/labelList.H>
00040 #include <OpenFOAM/FieldField.H>
00041 #include <OpenFOAM/lduInterfaceFieldPtrsList.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 class lduMatrix;
00049 class procLduMatrix;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class LUscalarMatrix Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class LUscalarMatrix
00056 :
00057     public scalarSquareMatrix
00058 {
00059     // Private data
00060 
00061         //- Processor matrix offsets
00062         labelList procOffsets_;
00063 
00064         //- The pivot indices used in the LU decomposition
00065         labelList pivotIndices_;
00066 
00067         //- Convert the given lduMatrix into this LUscalarMatrix
00068         void convert
00069         (
00070             const lduMatrix& ldum,
00071             const FieldField<Field, scalar>& interfaceCoeffs,
00072             const lduInterfaceFieldPtrsList& interfaces
00073         );
00074 
00075         //- Convert the given list of procLduMatrix into this LUscalarMatrix
00076         //  on the master processor
00077         void convert(const PtrList<procLduMatrix>& lduMatrices);
00078 
00079 
00080         //- Print the ratio of the mag-sum of the off-diagonal coefficients
00081         //  to the mag-diagonal
00082         void printDiagonalDominance() const;
00083 
00084 
00085 public:
00086 
00087     // Constructors
00088 
00089         //- Construct from scalarSquareMatrix and perform LU decomposition
00090         LUscalarMatrix(const scalarSquareMatrix&);
00091 
00092         //- Construct from lduMatrix and perform LU decomposition
00093         LUscalarMatrix
00094         (
00095             const lduMatrix&,
00096             const FieldField<Field, scalar>& interfaceCoeffs,
00097             const lduInterfaceFieldPtrsList& interfaces
00098         );
00099 
00100 
00101     // Member Functions
00102 
00103         //- Solve the matrix using the LU decomposition with pivoting
00104         //  returning the solution in the source
00105         template<class T>
00106         void solve(Field<T>& source) const;
00107 };
00108 
00109 
00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00111 
00112 } // End namespace Foam
00113 
00114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00115 
00116 #ifdef NoRepository
00117 #   include "LUscalarMatrixTemplates.C"
00118 #endif
00119 
00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00121 
00122 #endif
00123 
00124 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines