Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
matrices
lduMatrix
solvers
GAMG
GAMGAgglomerations
GAMGAgglomeration
GAMGAgglomeration.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
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
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
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.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::GAMGAgglomeration
26
27
Description
28
Geometric agglomerated algebraic multigrid agglomeration class.
29
30
SourceFiles
31
GAMGAgglomeration.C
32
GAMGAgglomerationTemplates.C
33
GAMGAgglomerate.C
34
GAMGAgglomerateLduAddressing.C
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef GAMGAgglomeration_H
39
#define GAMGAgglomeration_H
40
41
#include <
OpenFOAM/MeshObject.H
>
42
#include <
OpenFOAM/lduPrimitiveMesh.H
>
43
#include <
OpenFOAM/lduInterfacePtrsList.H
>
44
#include <
OpenFOAM/primitiveFields.H
>
45
#include <
OpenFOAM/runTimeSelectionTables.H
>
46
47
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49
namespace
Foam
50
{
51
52
class
lduMesh;
53
class
lduMatrix;
54
55
/*---------------------------------------------------------------------------*\
56
Class GAMGAgglomeration Declaration
57
\*---------------------------------------------------------------------------*/
58
59
class
GAMGAgglomeration
60
:
61
public
MeshObject
<lduMesh, GAMGAgglomeration>
62
{
63
protected
:
64
65
// Protected data
66
67
//- Max number of levels
68
label
maxLevels_
;
69
70
//- Number of cells in coarsest level
71
label
nCellsInCoarsestLevel_
;
72
73
//- The number of cells in each level
74
labelList
nCells_
;
75
76
//- Cell restriction addressing array.
77
// Maps from the finer to the coarser level.
78
PtrList<labelField>
restrictAddressing_
;
79
80
//- Face restriction addressing array.
81
// Maps from the finer to the coarser level.
82
// Positive indices map the finer faces which form part of the boundary
83
// of the coarser cells to the corresponding coarser cell face.
84
// Negative indices map the finer faces which are internal to the
85
// coarser cells to minus the corresponding coarser cell index minus 1.
86
PtrList<labelList>
faceRestrictAddressing_
;
87
88
//- Hierarchy of mesh addressing
89
PtrList<lduPrimitiveMesh>
meshLevels_
;
90
91
//- Hierarchy interfaces.
92
// Warning: Needs to be deleted explicitly.
93
PtrList<lduInterfacePtrsList>
interfaceLevels_
;
94
95
//- Assemble coarse mesh addressing
96
void
agglomerateLduAddressing
(
const
label fineLevelIndex);
97
98
//- Shrink the number of levels to that specified
99
void
compactLevels
(
const
label nCreatedLevels);
100
101
//- Check the need for further agglomeration
102
bool
continueAgglomerating
(
const
label nCoarseCells)
const
;
103
104
105
// Private Member Functions
106
107
//- Disallow default bitwise copy construct
108
GAMGAgglomeration
(
const
GAMGAgglomeration
&);
109
110
//- Disallow default bitwise assignment
111
void
operator=
(
const
GAMGAgglomeration
&);
112
113
114
public
:
115
116
//- Runtime type information
117
TypeName
(
"GAMGAgglomeration"
);
118
119
120
// Declare run-time constructor selection tables
121
122
//- Runtime selection table for pure geometric agglomerators
123
declareRunTimeSelectionTable
124
(
125
autoPtr
,
126
GAMGAgglomeration
,
127
lduMesh
,
128
(
129
const
lduMesh
&
mesh
,
130
const
dictionary
&
controlDict
131
),
132
(
133
mesh,
134
controlDict
135
)
136
);
137
138
//- Runtime selection table for matrix or mixed geometric/matrix
139
// agglomerators
140
declareRunTimeSelectionTable
141
(
142
autoPtr
,
143
GAMGAgglomeration
,
144
lduMatrix
,
145
(
146
const
lduMatrix
& matrix,
147
const
dictionary
& controlDict
148
),
149
(
150
matrix,
151
controlDict
152
)
153
);
154
155
156
// Constructors
157
158
//- Construct given mesh and controls
159
GAMGAgglomeration
160
(
161
const
lduMesh
& mesh,
162
const
dictionary
& controlDict
163
);
164
165
166
// Selectors
167
168
//- Return the selected geometric agglomerator
169
static
const
GAMGAgglomeration
&
New
170
(
171
const
lduMesh
& mesh,
172
const
dictionary
& controlDict
173
);
174
175
//- Return the selected matrix agglomerator
176
static
const
GAMGAgglomeration
&
New
177
(
178
const
lduMatrix
& matrix,
179
const
dictionary
& controlDict
180
);
181
182
183
// Destructor
184
185
~GAMGAgglomeration
();
186
187
188
// Member Functions
189
190
// Access
191
192
label
size
()
const
193
{
194
return
meshLevels_
.
size
();
195
}
196
197
//- Return LDU mesh of given level
198
const
lduMesh
&
meshLevel
(
const
label leveli)
const
;
199
200
//- Return LDU interface addressing of given level
201
const
lduInterfacePtrsList
&
interfaceLevel
202
(
203
const
label leveli
204
)
const
;
205
206
//- Return cell restrict addressing of given level
207
const
labelField
&
restrictAddressing
(
const
label leveli)
const
208
{
209
return
restrictAddressing_
[leveli];
210
}
211
212
//- Return face restrict addressing of given level
213
const
labelList
&
faceRestrictAddressing
(
const
label leveli)
const
214
{
215
return
faceRestrictAddressing_
[leveli];
216
}
217
218
219
// Restriction and prolongation
220
221
//- Restrict (integrate by summation) cell field
222
template
<
class
Type>
223
void
restrictField
224
(
225
Field<Type>
& cf,
226
const
Field<Type>
&
ff
,
227
const
label fineLevelIndex
228
)
const
;
229
230
//- Restrict (integrate by summation) face field
231
template
<
class
Type>
232
void
restrictFaceField
233
(
234
Field<Type>
& cf,
235
const
Field<Type>
&
ff
,
236
const
label fineLevelIndex
237
)
const
;
238
239
//- Prolong (interpolate by injection) cell field
240
template
<
class
Type>
241
void
prolongField
242
(
243
Field<Type>
&
ff
,
244
const
Field<Type>
& cf,
245
const
label coarseLevelIndex
246
)
const
;
247
};
248
249
250
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251
252
}
// End namespace Foam
253
254
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255
256
#ifdef NoRepository
257
# include <
OpenFOAM/GAMGAgglomerationTemplates.C
>
258
#endif
259
260
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262
#endif
263
264
// ************************ vim: set sw=4 sts=4 et: ************************ //