ptscotch.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-2024 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::decompositionMethods::ptscotch
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::decompositionMethods::scotch
45 
46 SourceFiles
47  ptscotch.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef ptscotch_H
52 #define ptscotch_H
53 
54 #include "decompositionMethod.H"
55 
56 namespace Foam
57 {
58 namespace decompositionMethods
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class ptscotch Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class ptscotch
66 :
67  public decompositionMethod
68 {
69  // Private Member Functions
70 
71  //- Check and print error message
72  static void check(const int, const char*);
73 
74  //- Decompose. Handles size 0 arrays
76  (
77  const fileName& meshPath,
78  const labelList& adjncy,
79  const labelList& xadj,
80  const scalarField& cellWeights,
81  labelList& decomp
82  ) const;
83 
84  //- Low level decompose
86  (
87  const fileName& meshPath,
88  const label adjncySize,
89  const label adjncy[],
90  const label xadjSize,
91  const label xadj[],
92  const scalarField& cellWeights,
93  labelList& decomp
94  ) const;
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("ptscotch");
101 
102 
103  // Constructors
104 
105  //- Construct given the decomposition dictionary
106  ptscotch(const dictionary& decompositionDict);
107 
108  //- Disallow default bitwise copy construction
109  ptscotch(const ptscotch&) = delete;
110 
111 
112  //- Destructor
113  virtual ~ptscotch()
114  {}
115 
116 
117  // Member Functions
118 
119  //- Inherit decompose from decompositionMethod
121 
122  //- Return for every coordinate the wanted processor number. Use the
123  // mesh connectivity (if needed). See note on weights in scotch.H
124  virtual labelList decompose
125  (
126  const polyMesh& mesh,
127  const pointField& points,
128  const scalarField& pointWeights
129  );
130 
131  //- Return for every coordinate the wanted processor number. Gets
132  // passed agglomeration map (from fine to coarse cells) and coarse cell
133  // location. Can be overridden by decomposers that provide this
134  // functionality natively. See note on weights in scotch.H
135  virtual labelList decompose
136  (
137  const polyMesh& mesh,
138  const labelList& agglom,
139  const pointField& regionPoints,
140  const scalarField& regionWeights
141  );
142 
143  //- Return for every coordinate the wanted processor number. Explicitly
144  // provided mesh connectivity.
145  // The connectivity is equal to mesh.cellCells() except for
146  // - in parallel the cell numbers are global cell numbers (starting
147  // from 0 at processor0 and then incrementing all through the
148  // processors)
149  // - the connections are across coupled patches
150  // See note on weights in scotch.H
151  virtual labelList decompose
152  (
153  const labelListList& globalCellCells,
154  const pointField& cellCentres,
155  const scalarField& cellWeights
156  );
157 
158 
159  // Member Operators
160 
161  //- Disallow default bitwise assignment
162  void operator=(const ptscotch&) = delete;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace decompositionMethods
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Abstract base class for decomposition.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
PTScotch domain decomposition. For the main details about how to define the strategies,...
Definition: ptscotch.H:67
virtual ~ptscotch()
Destructor.
Definition: ptscotch.H:112
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Inherit decompose from decompositionMethod.
ptscotch(const dictionary &decompositionDict)
Construct given the decomposition dictionary.
void operator=(const ptscotch &)=delete
Disallow default bitwise assignment.
TypeName("ptscotch")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for handling file names.
Definition: fileName.H:82
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
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