fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / OpenFOAM / matrices / blockLduMatrix / BlockLduSolvers / BlockIterativeSolver / BlockIterativeSolver.H
blobc34033c48641db2a28f34ce888b55246d689e10e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-6 H. Jasak All rights reserved
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     BlockIterativeSolver
28 Description
29     Virtual base class for a block iterative solvers
31 Author
32     Hrvoje Jasak, Wikki Ltd.  All rights reserved
34 SourceFiles
35     BlockIterativeSolver.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef BlockIterativeSolver_H
40 #define BlockIterativeSolver_H
42 #include "BlockLduSolver.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 /*---------------------------------------------------------------------------*\
50                     Class BlockIterativeSolver Declaration
51 \*---------------------------------------------------------------------------*/
53 template<class Type>
54 class BlockIterativeSolver
56     public BlockLduSolver<Type>
58     // Private data
60         //- Solver tolerance
61         scalar tolerance_;
63         //- Relative tolerance
64         scalar relTolerance_;
66         //- Minimum number of iterations
67         //  (forced irrespective of convergence)
68         label minIter_;
70         //- Maximum number of iterations
71         label maxIter_;
74     // Private Member Functions
76         //- Disallow default bitwise copy construct
77         BlockIterativeSolver(const BlockIterativeSolver&);
79         //- Disallow default bitwise assignment
80         void operator=(const BlockIterativeSolver&);
83 protected:
85     // Protected Member Functions
87         //- Return normalisation factor
88         scalar normFactor
89         (
90             Field<Type>& x,
91             const Field<Type>& b
92         ) const;
94         //- Is the stop criterion reached
95         bool stop(BlockSolverPerformance<Type>& solverPerf) const;
98 public:
100     // Constructors
102         //- Construct from matrix components and solver data stream
103         BlockIterativeSolver
104         (
105             const word& fieldName,
106             const BlockLduMatrix<Type>& matrix,
107             const dictionary& dict
108         );
111     // Destructor
113         virtual ~BlockIterativeSolver()
114         {}
117     // Member Functions
119         // Access
121             //- Return tolerance
122             scalar tolerance() const
123             {
124                 return tolerance_;
125             }
127             //- Return relative tolerance
128             scalar relTolerance() const
129             {
130                 return relTolerance_;
131             }
133             //- Return minimum number of iterations
134             label minIter() const
135             {
136                 return minIter_;
137             }
139             //- Return maximum number of iterations
140             label maxIter() const
141             {
142                 return maxIter_;
143             }
146         // Solve
148             //- Solve the matrix with this solver
149             virtual BlockSolverPerformance<Type> solve
150             (
151                 Field<Type>& x,
152                 const Field<Type>& b
153             ) = 0;
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 } // End namespace Foam
161 #ifdef NoRepository
162 #   include "BlockIterativeSolver.C"
163 #endif
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 #endif
169 // ************************************************************************* //