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 | Copyright (C) 2011 OpenFOAM Foundation
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::pairPatchAgglomeration
26 
27 Description
28  Primitive patch pair agglomerate method.
29 
30 SourceFiles
31  pairPatchAgglomeration.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef pairPatchAgglomeration_H
36 #define pairPatchAgglomeration_H
37 
38 #include "mathematicalConstants.H"
39 #include "polyPatch.H"
40 #include "indirectPrimitivePatch.H"
41 #include "List.H"
42 #include "EdgeMap.H"
43 
44 namespace Foam
45 {
47 }
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class pairPatchAgglomeration Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 {
60 protected:
61 
62  // Protected data
63 
64  //- Number of levels to merge, 1 = don't merge, 2 = merge pairs etc.
66 
67  //- Max number of levels
69 
70  //- Number of faces in coarsest level
72 
73  //- Feature angle
74  scalar featureAngle_;
75 
76  //- The number of faces in each level
78 
79  //- Cell restriction addressing array.
80  // Maps from the finer to coarse level
82 
83  //- Maps from finest to coarsest
85 
86  //- Hierarchy of patch addressing
88 
89  //- Edge weights
91 
92 
93 private:
94 
95  // Private Member Functions
96 
97  //- Assemble coarse patch
98  bool agglomeratePatch
99  (
100  const bPatch& patch,
101  const labelList& fineToCoarse,
102  const label fineLevelIndex
103  );
104 
105  //- Agglomerate one level
107  (
108  label& nCoarseCells,
109  const bPatch& patchLevel
110  );
111 
112  //- Combine leves
113  void combineLevels(const label curLevel);
114 
115  //- Shrink the number of levels to that specified
116  void compactLevels(const label fineLevelIndex);
117 
118  //- Check the need for further agglomeration
119  bool continueAgglomerating(const label fineLevelIndex);
120 
121  //- Set edge weights
122  void setEdgeWeights(const label indexLevel);
123 
124  //- Set base patch edge weights
125  void setBasedEdgeWeights();
126 
127  //- Maps current level with base patch
128  void mapBaseToTopAgglom(const label fineLevelIndex);
129 
130  //- Disallow default bitwise copy construct
132 
133  //- Disallow default bitwise assignment
134  void operator=(const pairPatchAgglomeration&);
135 
136 
137 public:
138 
139  // Constructors
140 
141  //- Construct given mesh and controls
143  (
144  const polyPatch& patch,
145  const dictionary& controlDict,
146  const bool additionalWeights = false
147  );
148 
149 
150  // Destructor
152 
153 
154  // Member Functions
155 
156  //- Agglomerate patch
157  void agglomerate();
158 
159 
160  // Access
161 
162  //- Return size
163  label size() const
164  {
165  return patchLevels_.size();
166  }
167 
168  //- Return restriction from top level to bottom level
170  {
172  }
173 
174  //- Return primitivePatch of given level
175  const bPatch& patchLevel(const label leveli) const;
176 
177  //- Return cell restrict addressing of given level
178  const labelField& restrictAddressing(const label leveli) const
179  {
180  return restrictAddressing_[leveli];
181  }
182 
183 
184  // Restriction and prolongation
185 
186  //- Restrict (integrate by summation) cell field
187  template<class Type>
188  void restrictField
189  (
190  Field<Type>& cf,
191  const Field<Type>& ff,
192  const label fineLevelIndex
193  ) const;
194 
195  //- Prolong (interpolate by injection) cell field
196  template<class Type>
197  void prolongField
198  (
199  Field<Type>& ff,
200  const Field<Type>& cf,
201  const label coarseLevelIndex
202  ) const;
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #ifdef NoRepository
214 #endif
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
Foam::pairPatchAgglomeration::pairPatchAgglomeration
pairPatchAgglomeration(const pairPatchAgglomeration &)
Disallow default bitwise copy construct.
Foam::pairPatchAgglomeration::operator=
void operator=(const pairPatchAgglomeration &)
Disallow default bitwise assignment.
mathematicalConstants.H
List.H
polyPatch.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::pairPatchAgglomeration::mergeLevels_
label mergeLevels_
Number of levels to merge, 1 = don't merge, 2 = merge pairs etc.
Definition: pairPatchAgglomeration.H:64
Foam::pairPatchAgglomeration
Primitive patch pair agglomerate method.
Definition: pairPatchAgglomeration.H:57
Foam::pairPatchAgglomeration::nFaces_
labelList nFaces_
The number of faces in each level.
Definition: pairPatchAgglomeration.H:76
Foam::pairPatchAgglomeration::featureAngle_
scalar featureAngle_
Feature angle.
Definition: pairPatchAgglomeration.H:73
Foam::pairPatchAgglomeration::continueAgglomerating
bool continueAgglomerating(const label fineLevelIndex)
Check the need for further agglomeration.
Definition: pairPatchAgglomeration.C:41
Foam::pairPatchAgglomeration::restrictTopBottomAddressing_
labelList restrictTopBottomAddressing_
Maps from finest to coarsest.
Definition: pairPatchAgglomeration.H:83
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::pairPatchAgglomeration::restrictTopBottomAddressing
const labelList & restrictTopBottomAddressing() const
Return restriction from top level to bottom level.
Definition: pairPatchAgglomeration.H:168
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
controlDict
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep
Foam::pairPatchAgglomeration::facePairWeight_
EdgeMap< scalar > facePairWeight_
Edge weights.
Definition: pairPatchAgglomeration.H:89
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::pairPatchAgglomeration::size
label size() const
Return size.
Definition: pairPatchAgglomeration.H:162
Foam::pairPatchAgglomeration::agglomerateOneLevel
tmp< labelField > agglomerateOneLevel(label &nCoarseCells, const bPatch &patchLevel)
Agglomerate one level.
Definition: pairPatchAgglomeration.C:435
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::pairPatchAgglomeration::~pairPatchAgglomeration
~pairPatchAgglomeration()
Definition: pairPatchAgglomeration.C:236
Foam::pairPatchAgglomeration::maxLevels_
label maxLevels_
Max number of levels.
Definition: pairPatchAgglomeration.H:67
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::pairPatchAgglomeration::restrictAddressing_
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
Definition: pairPatchAgglomeration.H:80
Foam::pairPatchAgglomeration::restrictField
void restrictField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex) const
Restrict (integrate by summation) cell field.
Definition: pairPatchAgglomerationTemplates.C:32
Foam::pairPatchAgglomeration::mapBaseToTopAgglom
void mapBaseToTopAgglom(const label fineLevelIndex)
Maps current level with base patch.
Definition: pairPatchAgglomeration.C:252
Foam::pairPatchAgglomeration::patchLevels_
PtrList< bPatch > patchLevels_
Hierarchy of patch addressing.
Definition: pairPatchAgglomeration.H:86
pairPatchAgglomerationTemplates.C
Foam::pairPatchAgglomeration::agglomeratePatch
bool agglomeratePatch(const bPatch &patch, const labelList &fineToCoarse, const label fineLevelIndex)
Assemble coarse patch.
Definition: pairPatchAgglomeration.C:266
Foam::fv::ff
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
Definition: CrankNicolsonDdtScheme.C:272
Foam::EdgeMap< scalar >
Foam::pairPatchAgglomeration::agglomerate
void agglomerate()
Agglomerate patch.
Definition: pairPatchAgglomeration.C:354
Foam::pairPatchAgglomeration::compactLevels
void compactLevels(const label fineLevelIndex)
Shrink the number of levels to that specified.
Definition: pairPatchAgglomeration.C:32
Foam::bPatch
PrimitivePatch< face, List, const pointField > bPatch
Definition: pairPatchAgglomeration.H:45
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::pairPatchAgglomeration::setEdgeWeights
void setEdgeWeights(const label indexLevel)
Set edge weights.
Definition: pairPatchAgglomeration.C:106
Foam::pairPatchAgglomeration::setBasedEdgeWeights
void setBasedEdgeWeights()
Set base patch edge weights.
Definition: pairPatchAgglomeration.C:52
Foam::pairPatchAgglomeration::prolongField
void prolongField(Field< Type > &ff, const Field< Type > &cf, const label coarseLevelIndex) const
Prolong (interpolate by injection) cell field.
Definition: pairPatchAgglomerationTemplates.C:60
EdgeMap.H
Foam::pairPatchAgglomeration::nFacesInCoarsestLevel_
label nFacesInCoarsestLevel_
Number of faces in coarsest level.
Definition: pairPatchAgglomeration.H:70
Foam::pairPatchAgglomeration::combineLevels
void combineLevels(const label curLevel)
Combine leves.
Definition: pairPatchAgglomeration.C:540
Foam::pairPatchAgglomeration::patchLevel
const bPatch & patchLevel(const label leveli) const
Return primitivePatch of given level.
Definition: pairPatchAgglomeration.C:243
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88
Foam::pairPatchAgglomeration::restrictAddressing
const labelField & restrictAddressing(const label leveli) const
Return cell restrict addressing of given level.
Definition: pairPatchAgglomeration.H:177