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

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