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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::ptscotchDecomp
29
30Description
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
49See also
50 Foam::scotchDecomp
51
52SourceFiles
53 ptscotchDecomp.C
54
55\*---------------------------------------------------------------------------*/
56
57#ifndef ptscotchDecomp_H
58#define ptscotchDecomp_H
59
60#include "decompositionMethod.H"
61
62namespace Foam
63{
64
65/*---------------------------------------------------------------------------*\
66 Class ptscotchDecomp Declaration
67\*---------------------------------------------------------------------------*/
70:
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
100public:
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
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// ************************************************************************* //
Abstract base class for domain decomposition.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
PTScotch domain decomposition.
virtual ~ptscotchDecomp()=default
Destructor.
virtual bool parallelAware() const
Is method parallel aware?
TypeName("ptscotch")
Runtime type information.
bool decompose() const noexcept
Query the decompose flag (normally off)
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
Foam::word regionName(Foam::polyMesh::defaultRegion)
const pointField & points
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73