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-2021 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 kahipDecomp_H
63 #define 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  //- No copy construct
94  kahipDecomp(const kahipDecomp&) = delete;
95 
96  //- No copy assignment
97  void operator=(const kahipDecomp&) = delete;
98 
99 
100 public:
101 
102  //- The predefined KaHIP configuration types
103  enum class configs
104  {
105  FAST = 0,
106  ECO = 1,
107  STRONG = 2,
108  FASTSOCIAL = 3,
109  ECOSOCIAL = 4,
110  STRONGSOCIAL = 5,
111  };
112 
113 
114  //- The selection names for predefined KaHIP configurations
115  static const Enum<configs> configNames;
116 
117 
118  //- Runtime type information
119  TypeName("kahip");
120 
121 
122  // Constructors
123 
124  //- Construct given decomposition dictionary and optional region name
125  explicit kahipDecomp
126  (
127  const dictionary& decompDict,
128  const word& regionName = ""
129  );
130 
131 
132  //- Destructor
133  virtual ~kahipDecomp() = default;
134 
135 
136  // Member Functions
137 
138  virtual bool parallelAware() const
139  {
140  return true;
141  }
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::Enum< configs >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::kahipDecomp::configs::STRONGSOCIAL
Foam::kahipDecomp::configs::ECO
Foam::kahipDecomp::decomposeSerial
virtual label decomposeSerial(const labelList &adjncy, const labelList &xadj, const List< scalar > &cellWeights, labelList &decomp) const
Call kahip with options from dictionary.
Definition: dummyKahipDecomp.C:57
Foam::kahipDecomp::configs::ECOSOCIAL
Foam::kahipDecomp::configs::FASTSOCIAL
Foam::kahipDecomp::configs::STRONG
Foam::kahipDecomp::parallelAware
virtual bool parallelAware() const
Is method parallel aware?
Definition: kahipDecomp.H:157
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::kahipDecomp::configNames
static const Enum< configs > configNames
The selection names for predefined KaHIP configurations.
Definition: kahipDecomp.H:134
Foam::kahipDecomp::configs
configs
The predefined KaHIP configuration types.
Definition: kahipDecomp.H:122
Foam::metisLikeDecomp
Domain decomposition using METIS-like data structures.
Definition: metisLikeDecomp.H:51
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::kahipDecomp::configs::FAST
default
Foam::kahipDecomp::operator=
void operator=(const kahipDecomp &)=delete
No copy assignment.
metisLikeDecomp.H
Foam::kahipDecomp::~kahipDecomp
virtual ~kahipDecomp()=default
Destructor.
Foam::List< label >
Foam::kahipDecomp::kahipDecomp
kahipDecomp(const kahipDecomp &)=delete
No copy construct.
Foam::kahipDecomp::TypeName
TypeName("kahip")
Runtime type information.
Foam::kahipDecomp
Domain decomposition using KaHIP http://algo2.iti.kit.edu/documents/kahip/.
Definition: kahipDecomp.H:94
Enum.H