ptscotchDecomp.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2021 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::ptscotchDecomp
26 
27 Description
28  PTScotch domain decomposition.
29  For the main details about how to define the strategies, see scotchDecomp.
30 
31  Nonetheless, when decomposing in parallel, using <tt>writeGraph=true</tt>
32  will write out \c .dgr files for debugging. For example, use these files
33  with \c dgpart as follows:
34 
35  \verbatim
36  mpirun -np 4 dgpart 2 'region0_%r.dgr'
37  \endverbatim
38 
39  where:
40  - %r gets replaced by current processor rank
41  - it will decompose into 2 domains
42 
43 See also
44  Foam::scotchDecomp
45 
46 SourceFiles
47  ptscotchDecomp.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef ptscotchDecomp_H
52 #define ptscotchDecomp_H
53 
54 #include "decompositionMethod.H"
55 
56 namespace Foam
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class ptscotchDecomp Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class ptscotchDecomp
64 :
65  public decompositionMethod
66 {
67  // Private Member Functions
68 
69  //- Check and print error message
70  static void check(const int, const char*);
71 
72  //- Decompose. Handles size 0 arrays
74  (
75  const fileName& meshPath,
76  const List<label>& adjncy,
77  const List<label>& xadj,
78  const scalarField& cWeights,
79  List<label>& finalDecomp
80  ) const;
81 
82  //- Low level decompose
84  (
85  const fileName& meshPath,
86  const label adjncySize,
87  const label adjncy[],
88  const label xadjSize,
89  const label xadj[],
90  const scalarField& cWeights,
91  List<label>& finalDecomp
92  ) const;
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("ptscotch");
99 
100 
101  // Constructors
102 
103  //- Construct given the decomposition dictionary and mesh
104  ptscotchDecomp(const dictionary& decompositionDict);
105 
106  //- Disallow default bitwise copy construction
107  ptscotchDecomp(const ptscotchDecomp&) = delete;
108 
109 
110  //- Destructor
111  virtual ~ptscotchDecomp()
112  {}
113 
114 
115  // Member Functions
116 
117  //- Inherit decompose from decompositionMethod
119 
120  //- Return for every coordinate the wanted processor number. Use the
121  // mesh connectivity (if needed). See note on weights in scotchDecomp.H
122  virtual labelList decompose
123  (
124  const polyMesh& mesh,
125  const pointField& points,
126  const scalarField& pointWeights
127  );
128 
129  //- Return for every coordinate the wanted processor number. Gets
130  // passed agglomeration map (from fine to coarse cells) and coarse cell
131  // location. Can be overridden by decomposers that provide this
132  // functionality natively. See note on weights in scotchDecomp.H
133  virtual labelList decompose
134  (
135  const polyMesh& mesh,
136  const labelList& agglom,
137  const pointField& regionPoints,
138  const scalarField& regionWeights
139  );
140 
141  //- Return for every coordinate the wanted processor number. Explicitly
142  // provided mesh connectivity.
143  // The connectivity is equal to mesh.cellCells() except for
144  // - in parallel the cell numbers are global cell numbers (starting
145  // from 0 at processor0 and then incrementing all through the
146  // processors)
147  // - the connections are across coupled patches
148  // See note on weights in scotchDecomp.H
149  virtual labelList decompose
150  (
151  const labelListList& globalCellCells,
152  const pointField& cc,
153  const scalarField& cWeights
154  );
155 
156 
157  // Member Operators
158 
159  //- Disallow default bitwise assignment
160  void operator=(const ptscotchDecomp&) = delete;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
Abstract base class for decomposition.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A class for handling file names.
Definition: fileName.H:82
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
PTScotch domain decomposition. For the main details about how to define the strategies,...
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Inherit decompose from decompositionMethod.
void operator=(const ptscotchDecomp &)=delete
Disallow default bitwise assignment.
virtual ~ptscotchDecomp()
Destructor.
ptscotchDecomp(const dictionary &decompositionDict)
Construct given the decomposition dictionary and mesh.
TypeName("ptscotch")
Runtime type information.
const pointField & points
Namespace for OpenFOAM.
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