initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / matrices / LUscalarMatrix / LUscalarMatrix.H
blobbf20c9374ec3c1ac1997a758f6787707a21b4929
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::LUscalarMatrix
28 Description
29     Foam::LUscalarMatrix
31 SourceFiles
32     LUscalarMatrix.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef LUscalarMatrix_H
37 #define LUscalarMatrix_H
39 #include "scalarMatrices.H"
40 #include "labelList.H"
41 #include "FieldField.H"
42 #include "lduInterfaceFieldPtrsList.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 class lduMatrix;
50 class procLduMatrix;
52 /*---------------------------------------------------------------------------*\
53                            Class LUscalarMatrix Declaration
54 \*---------------------------------------------------------------------------*/
56 class LUscalarMatrix
58     public scalarSquareMatrix
60     // Private data
62         //- Processor matrix offsets
63         labelList procOffsets_;
65         //- The pivot indices used in the LU decomposition
66         labelList pivotIndices_;
68         //- Convert the given lduMatrix into this LUscalarMatrix
69         void convert
70         (
71             const lduMatrix& ldum,
72             const FieldField<Field, scalar>& interfaceCoeffs,
73             const lduInterfaceFieldPtrsList& interfaces
74         );
76         //- Convert the given list of procLduMatrix into this LUscalarMatrix
77         //  on the master processor
78         void convert(const PtrList<procLduMatrix>& lduMatrices);
81         //- Print the ratio of the mag-sum of the off-diagonal coefficients
82         //  to the mag-diagonal
83         void printDiagonalDominance() const;
86 public:
88     // Constructors
90         //- Construct from scalarSquareMatrix and perform LU decomposition
91         LUscalarMatrix(const scalarSquareMatrix&);
93         //- Construct from lduMatrix and perform LU decomposition
94         LUscalarMatrix
95         (
96             const lduMatrix&,
97             const FieldField<Field, scalar>& interfaceCoeffs,
98             const lduInterfaceFieldPtrsList& interfaces
99         );
102     // Member Functions
104         //- Solve the matrix using the LU decomposition with pivoting
105         //  returning the solution in the source
106         template<class T>
107         void solve(Field<T>& source) const;
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 } // End namespace Foam
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 #ifdef NoRepository
118 #   include "LUscalarMatrixTemplates.C"
119 #endif
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 #endif
125 // ************************************************************************* //