Report patch name instead of index in debug
[foam-extend-3.2.git] / src / foam / matrices / blockLduMatrix / BlockAmg / fineBlockAmgLevel.H
blobb26109e0a2a4d0ff4034018ddab26a589bf8f09a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     fineBlockAmgLevel
27 Description
28     Fine AMG level refers to matrix, x and b data from the solver or
29     preconditioner, implemented for the BlockLduMatrix
31 Author
32     Klas Jareteg, 2012-12-13
34 SourceFiles
35     fineBlockAmgLevel.C
37 \*---------------------------------------------------------------------------*/
39 #ifndef fineBlockAmgLevel_H
40 #define fineBlockAmgLevel_H
42 #include "BlockAmgLevel.H"
43 #include "BlockLduSmoother.H"
44 #include "BlockLduMatrix.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 namespace Foam
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 template<class Type>
55 class coarseBlockAmgLevel;
57 template<class Type>
58 class BlockMatrixCoarsening;
60 /*---------------------------------------------------------------------------*\
61                         Class fineBlockAmgLevel Declaration
62 \*---------------------------------------------------------------------------*/
64 template<class Type>
65 class fineBlockAmgLevel
67     public BlockAmgLevel<Type>
69     // Private data
71          //- Reference to matrix
72         const BlockLduMatrix<Type>& matrix_;
74         //- Dictionary
75         const dictionary& dict_;
77         //- AMG coarsening
78         autoPtr<BlockMatrixCoarsening<Type> > coarseningPtr_;
80         //- Smoother
81         autoPtr<BlockLduSmoother<Type> > smootherPtr_;
83         //- Ax buffer
84         mutable Field<Type> Ax_;
87     // Private Member Functions
89         //- Disallow default bitwise copy construct
90         fineBlockAmgLevel(const fineBlockAmgLevel<Type>&);
92         //- Disallow default bitwise assignment
93         void operator=(const fineBlockAmgLevel<Type>&);
96 public:
98     //- Runtime type information
99     TypeName("fineBlockAmgLevel");
102     // Constructors
104         //- Construct from components
105         fineBlockAmgLevel
106         (
107             const BlockLduMatrix<Type>& matrix,
108             const dictionary& dict,
109             const word& coarseningType,
110             const label groupSize,
111             const label minCoarseEqns
112         );
115     // Destructor
117         virtual ~fineBlockAmgLevel()
118         {}
121     // Member Functions
123         //- Return reference to dictionary
124         const dictionary& dict() const
125         {
126             return dict_;
127         }
129         //- Return reference to x
130         virtual Field<Type>& x();
132         //- Return reference to b
133         virtual Field<Type>& b();
135         //- Calculate residual
136         virtual void residual
137         (
138             const Field<Type>& x,
139             const Field<Type>& b,
140             Field<Type>& res
141         ) const;
143         //- Restrict residual
144         virtual void restrictResidual
145         (
146             const Field<Type>& x,
147             const Field<Type>& b,
148             Field<Type>& xBuffer,
149             Field<Type>& coarseRes,
150             bool preSweepsDone
151         ) const;
153         //- Prolongate correction
154         virtual void prolongateCorrection
155         (
156             Field<Type>& x,
157             const Field<Type>& coarseX
158         ) const;
160         //- Smooth level
161         virtual void smooth
162         (
163             Field<Type>& x,
164             const Field<Type>& b,
165             const label nSweeps
166         ) const;
168         //- Solve level
169         virtual void solve
170         (
171             Field<Type>& x,
172             const Field<Type>& b,
173             const scalar tolerance,
174             const scalar relTol
175         ) const;
177         //- Scale x
178         virtual void scaleX
179         (
180             Field<Type>& x,
181             const Field<Type>& b,
182             Field<Type>& xBuffer
183         ) const;
185         //- Create next level from current level
186         virtual autoPtr<BlockAmgLevel<Type> > makeNextLevel() const;
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 } // End namespace Foam
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 #ifdef NoRepository
197 #   include "fineBlockAmgLevel.C"
198 #endif
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 #endif
204 // ************************************************************************* //