pairPatchAgglomeration.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::pairPatchAgglomeration
29
30Description
31 Primitive patch pair agglomerate method.
32
33SourceFiles
34 pairPatchAgglomeration.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef pairPatchAgglomeration_H
39#define pairPatchAgglomeration_H
40
43#include "List.H"
44#include "edgeHashes.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class pairPatchAgglomeration Declaration
53\*---------------------------------------------------------------------------*/
56{
57protected:
60
61 // Protected data
62
63 //- Number of levels to merge, 1 = don't merge, 2 = merge pairs etc.
64 label mergeLevels_;
65
66 //- Max number of levels
67 label maxLevels_;
68
69 //- Number of faces in coarsest level
71
72 //- Global number of faces in coarsest level
74
75 //- Feature angle
76 scalar featureAngle_;
77
78 //- The number of faces in each level
80
81 //- Cell restriction addressing array.
82 // Maps from the finer to coarse level
84
85 //- Maps from finest to coarsest
87
88 //- Hierarchy of patch addressing
90
91 //- Edge weights
93
94
95private:
96
97 // Private Member Functions
98
99 //- Assemble coarse patch
100 bool agglomeratePatch
101 (
102 const bPatch& patch,
103 const labelList& fineToCoarse,
104 const label fineLevelIndex
105 );
106
107 //- Agglomerate one level
108 tmp<labelField> agglomerateOneLevel
109 (
110 label& nCoarseCells,
111 const bPatch& patchLevel
112 );
113
114 //- Combine levels
115 void combineLevels(const label curLevel);
116
117 //- Shrink the number of levels to that specified
118 void compactLevels(const label fineLevelIndex);
119
120 //- Check the need for further agglomeration
121 bool continueAgglomerating
122 (
123 const label nLocal,
124 const label nLocalOld
125 );
126
127 //- Set edge weights
128 void setEdgeWeights(const label indexLevel);
129
130 //- Set base patch edge weights
131 void setLevel0EdgeWeights();
132
133 //- Maps current level with base patch
134 void mapBaseToTopAgglom(const label fineLevelIndex);
135
136 //- No copy construct
138
139 //- No copy assignment
140 void operator=(const pairPatchAgglomeration&) = delete;
141
142
143public:
144
145 // Constructors
146
147 //- Construct given faces, points and control dictionary
149 (
150 const faceList& faces,
151 const pointField& points,
153 );
154
155 //- Construct from components
157 (
158 const faceList& faces,
159 const pointField& points,
160 const label mergeLevels,
161 const label maxLevels,
162 const label nFacesInCoarsestLevel,
163 const label nGlobalFacesInCoarsestLevel,
164 const scalar featureAngle = 0
165 );
166
167
168 // Destructor
170
171
172 // Member Functions
173
174 //- Agglomerate patch
175 void agglomerate();
176
177
178 // Access
179
180 //- Return size
181 label size() const
182 {
183 return patchLevels_.size();
184 }
185
186 //- Return restriction from top level to bottom level
188 {
190 }
191
192 //- Return primitivePatch of given level
193 const bPatch& patchLevel(const label leveli) const;
194
195 //- Return cell restrict addressing of given level
196 const labelField& restrictAddressing(const label leveli) const
197 {
198 return restrictAddressing_[leveli];
199 }
200
201
202 // Restriction and prolongation
203
204 //- Restrict (integrate by summation) cell field
205 template<class Type>
206 void restrictField
207 (
208 Field<Type>& cf,
209 const Field<Type>& ff,
210 const label fineLevelIndex
211 ) const;
212
213 //- Prolong (interpolate by injection) cell field
214 template<class Type>
215 void prolongField
216 (
217 Field<Type>& ff,
218 const Field<Type>& cf,
219 const label coarseLevelIndex
220 ) const;
221};
222
223
224// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225
226} // End namespace Foam
227
228// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229
230#ifdef NoRepository
232#endif
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
237
238// ************************************************************************* //
Map from edge (expressed as its endpoints) to value. For easier forward declaration it is currently i...
Definition: EdgeMap.H:54
A list of faces which address into the list of points.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Primitive patch pair agglomerate method.
void prolongField(Field< Type > &ff, const Field< Type > &cf, const label coarseLevelIndex) const
Prolong (interpolate by injection) cell field.
void restrictField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex) const
Restrict (integrate by summation) cell field.
const labelList & restrictTopBottomAddressing() const
Return restriction from top level to bottom level.
PtrList< bPatch > patchLevels_
Hierarchy of patch addressing.
labelList nFaces_
The number of faces in each level.
const bPatch & patchLevel(const label leveli) const
Return primitivePatch of given level.
void agglomerate()
Agglomerate patch.
EdgeMap< scalar > facePairWeight_
Edge weights.
label mergeLevels_
Number of levels to merge, 1 = don't merge, 2 = merge pairs etc.
label size() const
Return size.
label maxLevels_
Max number of levels.
label nFacesInCoarsestLevel_
Number of faces in coarsest level.
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
const labelField & restrictAddressing(const label leveli) const
Return cell restrict addressing of given level.
PrimitivePatch< List< face >, const pointField > bPatch
label nGlobalFacesInCoarsestLevel_
Global number of faces in coarsest level.
labelList restrictTopBottomAddressing_
Maps from finest to coarsest.
A class for managing temporary objects.
Definition: tmp.H:65
runTime controlDict().readEntry("adjustTimeStep"
const pointField & points
Namespace for OpenFOAM.