MGridGenGAMGAgglomeration.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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::MGridGenGAMGAgglomeration
28 
29 Description
30  Agglomerate using the MGridGen algorithm.
31 
32 SourceFiles
33  MGridGenGAMGAgglomeration.C
34  MGridGenGAMGAgglomerate.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef MGridGenGAMGAgglomeration_H
39 #define MGridGenGAMGAgglomeration_H
40 
41 #include "fvMesh.H"
42 #include "GAMGAgglomeration.H"
43 
44 extern "C"
45 {
46  #include "mgridgen.h"
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 class fvMesh;
56 
57 /*---------------------------------------------------------------------------*\
58  Class MGridGenGAMGAgglomeration Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 :
63  public GAMGAgglomeration
64 {
65  // Private data
66 
67  const fvMesh& fvMesh_;
68 
69  // Min, max size of agglomerated cells
70  const label minSize_;
71  const label maxSize_;
72 
73  // Number of iterations applied to improve agglomeration consistency
74  // across processor boundaries
75  label nProcConsistencyIter_;
76 
77 
78  // Private Member Functions
79 
80  void swap
81  (
82  const lduInterfacePtrsList& interfaces,
83  const labelUList& cellValues,
84  PtrList<labelList>& nbrValues
85  ) const;
86 
87  void getNbrAgglom
88  (
89  const lduAddressing& addr,
90  const lduInterfacePtrsList& interfaces,
91  const PtrList<labelList>& nbrGlobalAgglom,
92  labelList& cellToNbrAgglom
93  ) const;
94 
95  void detectSharedFaces
96  (
97  const lduMesh& mesh,
98  const labelList& value,
99  labelHashSet& sharedFaces
100  ) const;
101 
102 
103  //- Construct the CSR format addressing
104  void makeCompactCellFaceAddressingAndFaceWeights
105  (
106  const lduAddressing& fineAddressing,
107  List<idxtype>& cellCells,
108  List<idxtype>& cellCellOffsets,
109  const scalarField& magSi,
110  List<scalar>& faceWeights
111  );
112 
113  //- Calculate and return agglomeration
114  tmp<labelField> agglomerate
115  (
116  label& nCoarseCells,
117  const label minSize,
118  const label maxSize,
119  const lduAddressing& fineAddressing,
120  const scalarField& V,
121  const scalarField& magSf,
122  const scalarField& magSb
123  );
124 
125 
126  //- No copy construct
128 
129  //- No copy assignment
130  void operator=(const MGridGenGAMGAgglomeration&) = delete;
131 
132 
133 public:
134 
135  //- Runtime type information
136  TypeName("MGridGen");
137 
138 
139  // Constructors
140 
141  //- Construct given mesh and controls
143  (
144  const lduMesh& mesh,
145  const dictionary& controlDict
146  );
147 
148  //- Agglomerate from a starting level. Starting level is usually 0
149  //- (initial mesh) but sometimes >0 (restarting after processor
150  //- agglomeration)
151  virtual void agglomerate
152  (
153  const label nCellsInCoarsestLevel,
154  const label startLevel,
155  const scalarField& startFaceWeights,
156  const bool doProcessorAgglomerate = true
157  );
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition: lduMesh.H:53
const lduMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
Agglomerate using the MGridGen algorithm.
runTime controlDict().readEntry("adjustTimeStep"
The central control dictionary, the contents of which are either taken directly from the FOAM_CONTROL...
Definition: debug.C:142
TypeName("MGridGen")
Runtime type information.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
The class contains the addressing required by the lduMatrix: upper, lower and losort.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Geometric agglomerated algebraic multigrid agglomeration class.
Namespace for OpenFOAM.