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-2018 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  //- Disallow default bitwise copy construct and assignment
95  void operator=(const ptscotchDecomp&);
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("ptscotch");
103 
104 
105  // Constructors
106 
107  //- Construct given the decomposition dictionary and mesh
108  ptscotchDecomp(const dictionary& decompositionDict);
109 
110 
111  //- Destructor
112  virtual ~ptscotchDecomp()
113  {}
114 
115 
116  // Member Functions
118  virtual bool parallelAware() const
119  {
120  // ptscotch does not know about proc boundaries
121  return true;
122  }
123 
124  //- Inherit decompose from decompositionMethod
126 
127  //- Return for every coordinate the wanted processor number. Use the
128  // mesh connectivity (if needed). See note on weights in scotchDecomp.H
129  virtual labelList decompose
130  (
131  const polyMesh& mesh,
132  const pointField& points,
133  const scalarField& pointWeights
134  );
135 
136  //- Return for every coordinate the wanted processor number. Gets
137  // passed agglomeration map (from fine to coarse cells) and coarse cell
138  // location. Can be overridden by decomposers that provide this
139  // functionality natively. See note on weights in scotchDecomp.H
140  virtual labelList decompose
141  (
142  const polyMesh& mesh,
143  const labelList& agglom,
144  const pointField& regionPoints,
145  const scalarField& regionWeights
146  );
147 
148  //- Return for every coordinate the wanted processor number. Explicitly
149  // provided mesh connectivity.
150  // The connectivity is equal to mesh.cellCells() except for
151  // - in parallel the cell numbers are global cell numbers (starting
152  // from 0 at processor0 and then incrementing all through the
153  // processors)
154  // - the connections are across coupled patches
155  // See note on weights in scotchDecomp.H
156  virtual labelList decompose
157  (
158  const labelListList& globalCellCells,
159  const pointField& cc,
160  const scalarField& cWeights
161  );
162 
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
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:69
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dynamicFvMesh & mesh
const pointField & points
Abstract base class for decomposition.
virtual bool parallelAware() const
Is method parallel aware (i.e. does it synchronize 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.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.