GAMGProcAgglomeration.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) 2013-2014 OpenFOAM Foundation
9  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::GAMGProcAgglomeration
29 
30 Description
31  Processor agglomeration of GAMGAgglomerations.
32 
33 SourceFiles
34  GAMGProcAgglomeration.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_GAMGProcAgglomeration_H
39 #define Foam_GAMGProcAgglomeration_H
40 
41 #include "runTimeSelectionTables.H"
42 #include "labelList.H"
43 #include "DynamicList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class GAMGAgglomeration;
52 class lduMesh;
53 class lduPrimitiveMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class GAMGProcAgglomeration Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 {
61 protected:
62 
63  // Protected Data
64 
65  //- Reference to agglomeration
67 
68  //- Allocated communicators
70 
71 
72  // Protected Member Functions
73 
74  //- Debug: write agglomeration info
75  void printStats(Ostream& os, GAMGAgglomeration& agglom) const;
76 
77  //- Agglomerate a level. Return true if anything has changed
78  bool agglomerate
79  (
80  const label fineLevelIndex,
81  const labelList& procAgglomMap,
82  const labelList& masterProcs,
83  const List<label>& agglomProcIDs,
84  const label procAgglomComm
85  );
86 
87  //- Debug: calculate global cell-cells
88  static labelListList globalCellCells(const lduMesh&);
89 
90  //- Clear/free allocated communicators
91  void clearCommunicators();
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("GAMGProcAgglomeration");
98 
99 
100  // Declare run-time constructor selection tables
101 
102  //- Runtime selection table for pure geometric agglomerators
104  (
105  autoPtr,
108  (
109  GAMGAgglomeration& agglom,
110  const dictionary& controlDict
111  ),
112  (
113  agglom,
115  )
116  );
117 
118 
119  //- No copy construct
121 
122  //- No copy assignment
123  void operator=(const GAMGProcAgglomeration&) = delete;
124 
125 
126  // Constructors
127 
128  //- Construct given agglomerator and controls
130  (
131  GAMGAgglomeration& agglom,
132  const dictionary& controlDict
133  );
134 
135 
136  // Selectors
137 
138  //- Return the selected agglomerator
140  (
141  const word& type,
142  GAMGAgglomeration& agglom,
143  const dictionary& controlDict
144  );
145 
146 
147  //- Destructor. Clears allocated communicators
148  virtual ~GAMGProcAgglomeration();
149 
150 
151  // Member Functions
152 
153  //- Modify agglomeration. \returns True if modified
154  virtual bool agglomerate() = 0;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
DynamicList< label > comms_
Allocated communicators.
GAMGAgglomeration & agglom_
Reference to agglomeration.
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
void printStats(Ostream &os, GAMGAgglomeration &agglom) const
Debug: write agglomeration info.
TypeName("GAMGProcAgglomeration")
Runtime type information.
static autoPtr< GAMGProcAgglomeration > New(const word &type, GAMGAgglomeration &agglom, const dictionary &controlDict)
Return the selected agglomerator.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
void clearCommunicators()
Clear/free allocated communicators.
A class for handling words, derived from Foam::string.
Definition: word.H:63
GAMGProcAgglomeration(const GAMGProcAgglomeration &)=delete
No copy construct.
runTime controlDict().readEntry("adjustTimeStep"
The central control dictionary, the contents of which are either taken directly from the FOAM_CONTROL...
Definition: debug.C:142
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
void operator=(const GAMGProcAgglomeration &)=delete
No copy assignment.
static labelListList globalCellCells(const lduMesh &)
Debug: calculate global cell-cells.
virtual bool agglomerate()=0
Modify agglomeration.
Processor agglomeration of GAMGAgglomerations.
declareRunTimeSelectionTable(autoPtr, GAMGProcAgglomeration, GAMGAgglomeration,(GAMGAgglomeration &agglom, const dictionary &controlDict),(agglom, controlDict))
Runtime selection table for pure geometric agglomerators.
virtual ~GAMGProcAgglomeration()
Destructor. Clears allocated communicators.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Macros to ease declaration of run-time selection tables.
Geometric agglomerated algebraic multigrid agglomeration class.
Namespace for OpenFOAM.