fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / OpenFOAM / matrices / blockLduMatrix / BlockLduPrecons / BlockLduPrecon / BlockLduPrecon.H
blob9ba8f0aee29516bc6423a75100b3c390cfa4efa2
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     BlockLduPrecon
28 Description
29     Block LDU matrix preconditioner virtual base class
31 Author
32     Hrvoje Jasak, Wikki Ltd.  All rights reserved.
34 SourceFiles
35     newBlockLduPrecon.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef BlockLduPrecon_H
40 #define BlockLduPrecon_H
42 #include "BlockLduMatrix.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 /*---------------------------------------------------------------------------*\
50                       Class BlockLduPrecon Declaration
51 \*---------------------------------------------------------------------------*/
53 template<class Type>
54 class BlockLduPrecon
56     // Private Member Functions
58         //- Disallow default bitwise copy construct
59         BlockLduPrecon(const BlockLduPrecon&);
61         //- Disallow default bitwise assignment
62         void operator=(const BlockLduPrecon&);
65 protected:
67     // Protected data
69         //- Matrix reference
70         const BlockLduMatrix<Type>& matrix_;
73     // Protected member functions
75         //- Find the smoother name (directly or from a sub-dictionary)
76         static word getName(const dictionary&);
79 public:
81     //- Runtime type information
82     TypeName("BlockLduPrecon");
85     // Declare run-time constructor selection tables
87         declareRunTimeSelectionTable
88         (
89             autoPtr,
90             BlockLduPrecon,
91             dictionary,
92             (
93                 const BlockLduMatrix<Type>& matrix,
94                 const dictionary& dict
95             ),
96             (
97                 matrix,
98                 dict
99             )
100         );
103     // Constructors
105         //- Construct from matrix
106         BlockLduPrecon(const BlockLduMatrix<Type>& matrix)
107         :
108             matrix_(matrix)
109         {}
112     // Selectors
114         //- Select given matrix and dictionary
115         static autoPtr<BlockLduPrecon<Type> > New
116         (
117             const BlockLduMatrix<Type>& matrix,
118             const dictionary& dict
119         );
122     // Destructor
124         virtual ~BlockLduPrecon()
125         {}
128     // Member Functions
130         //- Execute preconditioning
131         virtual void precondition
132         (
133             Field<Type>& x,
134             const Field<Type>& b
135         ) const = 0;
137         //- Execute preconditioning on a transposed matrix
138         virtual void preconditionT
139         (
140             Field<Type>& xT,
141             const Field<Type>& bT
142         ) const
143         {
144             notImplemented
145             (
146                 type() +"::preconditionT"
147                 "(Field<Type>& xT, const Field<Type>& bT) const"
148             );
149         }
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 #ifdef NoRepository
160 #   include "BlockLduPrecon.C"
161 #endif
163 #define makeBlockPrecon(PreconType, typePreconType)                          \
164                                                                              \
165 defineNamedTemplateTypeNameAndDebug(typePreconType, 0);                      \
166                                                                              \
167 addToRunTimeSelectionTable(PreconType, typePreconType, dictionary);
169 #define makeBlockPrecons(preconType)                                         \
170                                                                              \
171 makeBlockPrecon(blockScalarPrecon, preconType##Scalar);                      \
172 makeBlockPrecon(blockVectorPrecon, preconType##Vector);                      \
173 makeBlockPrecon(blockTensorPrecon, preconType##Tensor);
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 #endif
180 // ************************************************************************* //