All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2020 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
73  label decompose
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
83  label 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
117  virtual bool parallelAware() const
118  {
119  // ptscotch does not know about proc boundaries
120  return true;
121  }
122 
123  //- Inherit decompose from decompositionMethod
125 
126  //- Return for every coordinate the wanted processor number. Use the
127  // mesh connectivity (if needed). See note on weights in scotchDecomp.H
128  virtual labelList decompose
129  (
130  const polyMesh& mesh,
131  const pointField& points,
132  const scalarField& pointWeights
133  );
134 
135  //- Return for every coordinate the wanted processor number. Gets
136  // passed agglomeration map (from fine to coarse cells) and coarse cell
137  // location. Can be overridden by decomposers that provide this
138  // functionality natively. See note on weights in scotchDecomp.H
139  virtual labelList decompose
140  (
141  const polyMesh& mesh,
142  const labelList& agglom,
143  const pointField& regionPoints,
144  const scalarField& regionWeights
145  );
146 
147  //- Return for every coordinate the wanted processor number. Explicitly
148  // provided mesh connectivity.
149  // The connectivity is equal to mesh.cellCells() except for
150  // - in parallel the cell numbers are global cell numbers (starting
151  // from 0 at processor0 and then incrementing all through the
152  // processors)
153  // - the connections are across coupled patches
154  // See note on weights in scotchDecomp.H
155  virtual labelList decompose
156  (
157  const labelListList& globalCellCells,
158  const pointField& cc,
159  const scalarField& cWeights
160  );
161 
162 
163  // Member Operators
164 
165  //- Disallow default bitwise assignment
166  void operator=(const ptscotchDecomp&) = delete;
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
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
A class for handling file names.
Definition: fileName.H:79
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
ptscotchDecomp(const dictionary &decompositionDict)
Construct given the decomposition dictionary and mesh.
dynamicFvMesh & mesh
const pointField & points
Abstract base class for decomposition.
virtual bool parallelAware() const
Is method parallel aware (i.e. does it synchronise domains across.
virtual ~ptscotchDecomp()
Destructor.
PTScotch domain decomposition. For the main details about how to define the strategies, see scotchDecomp.
TypeName("ptscotch")
Runtime type information.
void operator=(const ptscotchDecomp &)=delete
Disallow default bitwise assignment.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.