ptscotchDecomp.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ptscotchDecomp
29 
30 Description
31  PTScotch domain decomposition.
32 
33  For the main details about how to define the strategies, see scotchDecomp.
34 
35  Coefficients dictionary: \a scotchCoeffs, \a coeffs.
36 
37  Nonetheless, when decomposing in parallel, using <tt>writeGraph=true</tt>
38  will write out \c .dgr files for debugging. For example, use these files
39  with \c dgpart as follows:
40 
41  \verbatim
42  mpirun -np 4 dgpart 2 'region0_%r.dgr'
43  \endverbatim
44 
45  where:
46  - %r gets replaced by current processor rank
47  - it will decompose into 2 domains
48 
49 See also
50  Foam::scotchDecomp
51 
52 SourceFiles
53  ptscotchDecomp.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef ptscotchDecomp_H
58 #define ptscotchDecomp_H
59 
60 #include "decompositionMethod.H"
61 
62 namespace Foam
63 {
64 
65 /*---------------------------------------------------------------------------*\
66  Class ptscotchDecomp Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class ptscotchDecomp
70 :
71  public decompositionMethod
72 {
73  // Private Data
74 
75  //- Original coefficients for this method
76  dictionary coeffsDict_;
77 
78  //- Output path and name for optional grf file.
79  mutable fileName graphPath_;
80 
81 
82  // Private Member Functions
83 
84  //- Decompose. Handles size 0 arrays
85  label decompose
86  (
87  const labelList& adjncy,
88  const labelList& xadj,
89  const List<scalar>& cWeights,
90  labelList& decomp
91  ) const;
92 
93  //- No copy construct
94  ptscotchDecomp(const ptscotchDecomp&) = delete;
95 
96  //- No copy assignment
97  void operator=(const ptscotchDecomp&) = delete;
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("ptscotch");
104 
105 
106  // Constructors
107 
108  //- Construct given decomposition dictionary and optional region name
109  explicit ptscotchDecomp
110  (
111  const dictionary& decompDict,
112  const word& regionName = ""
113  );
114 
115 
116  //- Destructor
117  virtual ~ptscotchDecomp() = default;
118 
119 
120  // Member Functions
121 
122  virtual bool parallelAware() const
123  {
124  return true;
125  }
126 
127  //- Inherit decompose from decompositionMethod
129 
130  //- Return for every coordinate the wanted processor number.
131  // Use the mesh connectivity (if needed).
132  // See note on weights in scotchDecomp.H
133  virtual labelList decompose
134  (
135  const polyMesh& mesh,
136  const pointField& points,
137  const scalarField& pointWeights
138  ) const;
139 
140  //- Return for every coordinate the wanted processor number.
141  // Gets passed agglomeration map (from fine to coarse cells) and
142  // coarse cell location.
143  // Can be overridden by decomposers that provide this
144  // functionality natively. See note on weights in scotchDecomp.H
145  virtual labelList decompose
146  (
147  const polyMesh& mesh,
148  const labelList& agglom,
149  const pointField& regionPoints,
150  const scalarField& regionWeights
151  ) const;
152 
153  //- Return for every coordinate the wanted processor number.
154  // Explicitly provided mesh connectivity.
155  // The connectivity is equal to mesh.cellCells() except for
156  // - in parallel the cell numbers are global cell numbers (starting
157  // from 0 at processor0 and then incrementing all through the
158  // processors)
159  // - the connections are across coupled patches
160  // See note on weights in scotchDecomp.H
161  virtual labelList decompose
162  (
163  const labelListList& globalCellCells,
164  const pointField& cc,
165  const scalarField& cWeights
166  ) const;
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
decompositionMethod.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::Field< vector >
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::decompositionMethod
Abstract base class for domain decomposition.
Definition: decompositionMethod.H:51
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::decompositionMethod::decompose
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
Definition: decompositionMethod.C:1325
Foam::ptscotchDecomp::parallelAware
virtual bool parallelAware() const
Is method parallel aware?
Definition: ptscotchDecomp.H:121
Foam::List< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::ptscotchDecomp
PTScotch domain decomposition.
Definition: ptscotchDecomp.H:68
Foam::ptscotchDecomp::~ptscotchDecomp
virtual ~ptscotchDecomp()=default
Destructor.
Foam::ptscotchDecomp::TypeName
TypeName("ptscotch")
Runtime type information.