fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / OpenFOAM / matrices / blockLduMatrix / BlockLduSolvers / BlockLduSolver / BlockLduSolver.H
blob62aa78379456d62e0e879d250576425e8401d449
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 Class
26     BlockLduSolver
28 Description
29     Linear equation solver for BlockLduMatrix.
31 Author
32     Hrvoje Jasak, Wikki Ltd.  All rights reserved
34 SourceFiles
35     BlockLduSolver.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef BlockLduSolver_H
40 #define BlockLduSolver_H
42 #include "blockLduMatrices.H"
43 #include "runTimeSelectionTables.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 // * * * * * * Forward declaration of template friend fuctions * * * * * * * //
52 template<class Type>
53 class BlockSolverPerformance;
55 /*---------------------------------------------------------------------------*\
56                         Class BlockLduSolver Declaration
57 \*---------------------------------------------------------------------------*/
59 template<class Type>
60 class BlockLduSolver
62     // Private data
64         //- Name of field being solved for
65         word fieldName_;
67         //- Control data dictionary
68         dictionary dict_;
71 protected:
73     // Protected data types
75     typedef Field<Type> TypeField;
78     // Protected data
80         //- Matrix
81         const BlockLduMatrix<Type>& matrix_;
84     // Protected Member Functions
86         //- Return dictionary
87         const dictionary& dict() const
88         {
89             return dict_;
90         }
92         //- Read a control parameter from the dictionary
93         template<class T>
94         void readControl
95         (
96             const dictionary& dict,
97             T& control,
98             const word& controlName
99         );
102 public:
104     //- Runtime type information
105     TypeName("BlockLduSolver");
108     // Static data
110         //- Large value for the use in solvers
111         static const scalar great_;
113         //- Small value for the use in solvers
114         static const scalar small_;
117     // Declare run-time constructor selection tables
119         declareRunTimeSelectionTable
120         (
121             autoPtr,
122             BlockLduSolver,
123             symMatrix,
124             (
125                 const word& fieldName,
126                 BlockLduMatrix<Type>& matrix,
127                 const dictionary& dict
128             ),
129             (
130                 fieldName,
131                 matrix,
132                 dict
133             )
134         );
136         declareRunTimeSelectionTable
137         (
138             autoPtr,
139             BlockLduSolver,
140             asymMatrix,
141             (
142                 const word& fieldName,
143                 BlockLduMatrix<Type>& matrix,
144                 const dictionary& dict
145             ),
146             (
147                 fieldName,
148                 matrix,
149                 dict
150             )
151         );
155     // Constructors
157         //- Construct from field name and matrix
158         BlockLduSolver
159         (
160             const word& fieldName,
161             const BlockLduMatrix<Type>& matrix
162         );
164         //- Construct from dictionary
165         BlockLduSolver
166         (
167             const word& fieldName,
168             const BlockLduMatrix<Type>& matrix,
169             const dictionary& dict
170         );
173     // Selectors
175         //- Return a new solver
176         static autoPtr<BlockLduSolver<Type> > New
177         (
178             const word& fieldName,
179             BlockLduMatrix<Type>& matrix,
180             const dictionary& dict
181         );
184     // Destructor
186         virtual ~BlockLduSolver()
187         {}
190     // Member functions
192         //- Return field name
193         const word& fieldName() const
194         {
195             return fieldName_;
196         }
198         //- Solve
199         virtual BlockSolverPerformance<Type> solve
200         (
201             TypeField& x,
202             const TypeField& b
203         ) = 0;
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 } // End namespace Foam
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 #ifdef NoRepository
214 #   include "BlockLduSolver.C"
215 #endif
218 #define makeBlockSolverTypeName(typeSolverType)                              \
219                                                                              \
220 defineNamedTemplateTypeNameAndDebug(typeSolverType, 0);
222 #define makeBlockSolvers(solverType)                                         \
223                                                                              \
224 makeBlockSolverTypeName(solverType##Scalar);                                 \
225 makeBlockSolverTypeName(solverType##Vector);                                 \
226 makeBlockSolverTypeName(solverType##Tensor);
229 #define addSolverToBlockMatrix(Type, typeSolverType, typeMatrix)             \
230                                                                              \
231 addToRunTimeSelectionTable(block##Type##Solver, typeSolverType, typeMatrix);
233 #define addSolversToBlockMatrix(solverType, typeMatrix)                      \
234                                                                              \
235 addSolverToBlockMatrix(Scalar, solverType##Scalar, typeMatrix);              \
236 addSolverToBlockMatrix(Vector, solverType##Vector, typeMatrix);              \
237 addSolverToBlockMatrix(Tensor, solverType##Tensor, typeMatrix);
239 #define addSymSolverToBlockMatrix(solverType)                                \
240                                                                              \
241 addSolversToBlockMatrix(solverType, symMatrix);
243 #define addAsymSolverToBlockMatrix(solverType)                               \
244                                                                              \
245 addSolversToBlockMatrix(solverType, asymMatrix);
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 #endif
252 // ************************************************************************* //