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  dictionary methodDict_;
70 
71  // Private Member Functions
72 
73  //- Check and print error message
74  static void check(const int, const char*);
75 
76  //- Decompose. Handles size 0 arrays
78  (
79  const fileName& meshPath,
80  const labelList& adjncy,
81  const labelList& xadj,
82  const scalarField& cellWeights,
83  labelList& decomp
84  ) const;
85 
86  //- Low level decompose
88  (
89  const fileName& meshPath,
90  const label adjncySize,
91  const label adjncy[],
92  const label xadjSize,
93  const label xadj[],
94  const scalarField& cellWeights,
95  labelList& decomp
96  ) const;
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("ptscotch");
103 
104 
105  // Constructors
106 
107  //- Construct given the decomposition dictionary
108  ptscotch
109  (
110  const dictionary& decompositionDict,
111  const dictionary& methodDict
112  );
113 
114  //- Disallow default bitwise copy construction
115  ptscotch(const ptscotch&) = delete;
116 
117 
118  //- Destructor
119  virtual ~ptscotch()
120  {}
121 
122 
123  // Member Functions
124 
125  //- Inherit decompose from decompositionMethod
127 
128  //- Return for every coordinate the wanted processor number. Use the
129  // mesh connectivity (if needed). See note on weights in scotch.H
130  virtual labelList decompose
131  (
132  const polyMesh& mesh,
133  const pointField& points,
134  const scalarField& pointWeights
135  );
136 
137  //- Return for every coordinate the wanted processor number. Gets
138  // passed agglomeration map (from fine to coarse cells) and coarse cell
139  // location. Can be overridden by decomposers that provide this
140  // functionality natively. See note on weights in scotch.H
141  virtual labelList decompose
142  (
143  const polyMesh& mesh,
144  const labelList& agglom,
145  const pointField& regionPoints,
146  const scalarField& regionWeights
147  );
148 
149  //- Return for every coordinate the wanted processor number. Explicitly
150  // provided mesh connectivity.
151  // The connectivity is equal to mesh.cellCells() except for
152  // - in parallel the cell numbers are global cell numbers (starting
153  // from 0 at processor0 and then incrementing all through the
154  // processors)
155  // - the connections are across coupled patches
156  // See note on weights in scotch.H
157  virtual labelList decompose
158  (
159  const labelListList& globalCellCells,
160  const pointField& cellCentres,
161  const scalarField& cellWeights
162  );
163 
164 
165  // Member Operators
166 
167  //- Disallow default bitwise assignment
168  void operator=(const ptscotch&) = delete;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace decompositionMethods
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
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:118
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Inherit decompose from decompositionMethod.
void operator=(const ptscotch &)=delete
Disallow default bitwise assignment.
ptscotch(const dictionary &decompositionDict, const dictionary &methodDict)
Construct given the decomposition dictionary.
TypeName("ptscotch")
Runtime type information.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for handling file names.
Definition: fileName.H:82
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
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
word meshPath
Definition: setMeshPath.H:1