kahipDecomp.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) 2017-2023 OpenCFD Ltd.
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::kahipDecomp
28 
29 Description
30  Domain decomposition using KaHIP
31  http://algo2.iti.kit.edu/documents/kahip/
32 
33  When run in parallel will collect the entire graph on to the master,
34  decompose and send back.
35 
36  Coefficients dictionary: \a kahipCoeffs, \a coeffs.
37 
38  \verbatim
39  numberOfSubdomains N;
40  method kahip;
41 
42  kahipCoeffs
43  {
44  config fast;
45  imbalance 0.01;
46  }
47  \endverbatim
48 
49  Method coefficients:
50  \table
51  Property | Description | Required | Default
52  config | fast / eco / strong | no | fast
53  imbalance | imbalance on cells between domains | no | 0.01
54  seed | initial value for random number generator | no | 0
55  \endtable
56 
57 SourceFiles
58  kahipDecomp.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef Foam_kahipDecomp_H
63 #define Foam_kahipDecomp_H
64 
65 #include "metisLikeDecomp.H"
66 #include "Enum.H"
67 
68 namespace Foam
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class kahipDecomp Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class kahipDecomp
76 :
77  public metisLikeDecomp
78 {
79 protected:
80 
81  // Protected Member Functions
82 
83  //- Call kahip with options from dictionary.
84  virtual label decomposeSerial
85  (
86  const labelList& adjncy,
87  const labelList& xadj,
88  const List<scalar>& cellWeights,
89  labelList& decomp
90  ) const;
91 
92 
93 public:
94 
95  //- The predefined KaHIP configuration types
96  enum class configs
97  {
98  FAST = 0,
99  ECO = 1,
100  STRONG = 2,
101  FASTSOCIAL = 3,
102  ECOSOCIAL = 4,
103  STRONGSOCIAL = 5,
104  };
105 
106 
107  //- The selection names for predefined KaHIP configurations
108  static const Enum<configs> configNames;
109 
110 
111  // Generated Methods
112 
113  //- No copy construct
114  kahipDecomp(const kahipDecomp&) = delete;
116  //- No copy assignment
117  void operator=(const kahipDecomp&) = delete;
118 
119 
120  //- Runtime type information
121  TypeName("kahip");
122 
123 
124  // Constructors
125 
126  //- Construct with number of domains (no coefficients or constraints)
127  explicit kahipDecomp(const label numDomains);
128 
129  //- Construct given decomposition dictionary and optional region name
130  explicit kahipDecomp
131  (
132  const dictionary& decompDict,
133  const word& regionName = ""
134  );
135 
136 
137  //- Destructor
138  virtual ~kahipDecomp() = default;
139 
140 
141  // Member Functions
142 
143  //- Method is parallel aware
144  virtual bool parallelAware() const
145  {
146  return true;
147  }
148 };
149 
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual label decomposeSerial(const labelList &adjncy, const labelList &xadj, const List< scalar > &cellWeights, labelList &decomp) const
Call kahip with options from dictionary.
Definition: kahipDecomp.C:74
Domain decomposition using KaHIP http://algo2.iti.kit.edu/documents/kahip/.
Definition: kahipDecomp.H:90
configs
The predefined KaHIP configuration types.
Definition: kahipDecomp.H:115
TypeName("kahip")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const Enum< configs > configNames
The selection names for predefined KaHIP configurations.
Definition: kahipDecomp.H:129
void operator=(const kahipDecomp &)=delete
No copy assignment.
virtual bool parallelAware() const
Method is parallel aware.
Definition: kahipDecomp.H:179
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
kahipDecomp(const kahipDecomp &)=delete
No copy construct.
virtual ~kahipDecomp()=default
Destructor.
List< label > labelList
A List of labels.
Definition: List.H:62
Namespace for OpenFOAM.