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::diagonalPreconditioner 00026 00027 Description 00028 Diagonal preconditioner for both symmetric and asymmetric matrices. 00029 00030 The reciprocal of the diagonal is calculated and stored for reuse 00031 because on most systems '*' is faster than '/'. 00032 00033 SourceFiles 00034 diagonalPreconditioner.C 00035 00036 \*---------------------------------------------------------------------------*/ 00037 00038 #ifndef diagonalPreconditioner_H 00039 #define diagonalPreconditioner_H 00040 00041 #include <OpenFOAM/lduMatrix.H> 00042 00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00044 00045 namespace Foam 00046 { 00047 00048 /*---------------------------------------------------------------------------*\ 00049 Class diagonalPreconditioner Declaration 00050 \*---------------------------------------------------------------------------*/ 00051 00052 class diagonalPreconditioner 00053 : 00054 public lduMatrix::preconditioner 00055 { 00056 // Private data 00057 00058 //- The reciprocal diagonal 00059 scalarField rD; 00060 00061 00062 // Private Member Functions 00063 00064 //- Disallow default bitwise copy construct 00065 diagonalPreconditioner(const diagonalPreconditioner&); 00066 00067 //- Disallow default bitwise assignment 00068 void operator=(const diagonalPreconditioner&); 00069 00070 00071 public: 00072 00073 //- Runtime type information 00074 TypeName("diagonal"); 00075 00076 00077 // Constructors 00078 00079 //- Construct from matrix components and preconditioner solver controls 00080 diagonalPreconditioner 00081 ( 00082 const lduMatrix::solver&, 00083 const dictionary& solverControlsUnused 00084 ); 00085 00086 00087 // Destructor 00088 00089 virtual ~diagonalPreconditioner() 00090 {} 00091 00092 00093 // Member Functions 00094 00095 //- Return wA the preconditioned form of residual rA 00096 virtual void precondition 00097 ( 00098 scalarField& wA, 00099 const scalarField& rA, 00100 const direction cmpt=0 00101 ) const; 00102 00103 //- Return wT the transpose-matrix preconditioned form of residual rT. 00104 virtual void preconditionT 00105 ( 00106 scalarField& wT, 00107 const scalarField& rT, 00108 const direction cmpt=0 00109 ) const 00110 { 00111 return precondition(wT, rT, cmpt); 00112 } 00113 }; 00114 00115 00116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00117 00118 } // End namespace Foam 00119 00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00121 00122 #endif 00123 00124 // ************************ vim: set sw=4 sts=4 et: ************************ //