Loading...
Searching...
No Matches
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-2023 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 Foam_ptscotchDecomp_H
58#define Foam_ptscotchDecomp_H
59
60#include "decompositionMethod.H"
61
62namespace Foam
63{
65/*---------------------------------------------------------------------------*\
66 Class ptscotchDecomp Declaration
67\*---------------------------------------------------------------------------*/
68
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
93public:
94
95 // Generated Methods
96
97 //- No copy construct
98 ptscotchDecomp(const ptscotchDecomp&) = delete;
99
100 //- No copy assignment
101 void operator=(const ptscotchDecomp&) = delete;
102
103
104 //- Runtime type information
105 TypeName("ptscotch");
107
108 // Constructors
109
110 //- Construct with number of domains (no coefficients or constraints)
111 explicit ptscotchDecomp(const label numDomains);
113 //- Construct given decomposition dictionary and optional region name
114 explicit ptscotchDecomp
115 (
116 const dictionary& decompDict,
117 const word& regionName = ""
118 );
119
120
121 //- Destructor
122 virtual ~ptscotchDecomp() = default;
123
124
125 // Member Functions
126
127 //- Knows about coupled boundaries
128 virtual bool parallelAware() const
129 {
130 return true;
131 }
132
133 //- Inherit decompose from decompositionMethod
136 //- Return for every coordinate the wanted processor number.
137 // Use the mesh connectivity (if needed).
138 // See note on weights in scotchDecomp.H
139 virtual labelList decompose
140 (
141 const polyMesh& mesh,
143 const scalarField& pointWeights = scalarField::null()
144 ) const;
145
146 //- Return for every coordinate the wanted processor number.
147 // Gets passed agglomeration map (from fine to coarse cells) and
148 // coarse cell location.
149 // Can be overridden by decomposers that provide this
150 // functionality natively. See note on weights in scotchDecomp.H
151 virtual labelList decompose
152 (
153 const polyMesh& mesh,
154 const labelList& agglom,
155 const pointField& agglomPoints,
156 const scalarField& agglomWeights = scalarField::null()
157 ) const;
158
159 //- Return for every coordinate the wanted processor number.
160 virtual labelList decompose
161 (
162 const CompactListList<label>& globalCellCells,
163 const pointField& cc = pointField::null(),
164 const scalarField& cWeights = scalarField::null()
165 ) const;
166
167 //- Return for every coordinate the wanted processor number.
168 // Explicitly provided mesh connectivity.
169 // The connectivity is equal to mesh.cellCells() except for
170 // - in parallel the cell numbers are global cell numbers (starting
171 // from 0 at processor0 and then incrementing all through the
172 // processors)
173 // - the connections are across coupled patches
174 // See note on weights in scotchDecomp.H
175 virtual labelList decompose
176 (
177 const labelListList& globalCellCells,
178 const pointField& cc = pointField::null(),
179 const scalarField& cWeights = scalarField::null()
180 ) const;
181};
182
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186} // End namespace Foam
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190#endif
191
192// ************************************************************************* //
A packed storage of objects of type <T> using an offset table for access.
static const Field< vector > & null() noexcept
Definition Field.H:192
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
decompositionMethod(const label numDomains)
Construct with specified number of domains, no coefficients or constraints.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights=scalarField::null()) const
Return the wanted processor number for every coordinate, using uniform or specified point weights.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A class for handling file names.
Definition fileName.H:75
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
virtual ~ptscotchDecomp()=default
Destructor.
void operator=(const ptscotchDecomp &)=delete
No copy assignment.
virtual bool parallelAware() const
Knows about coupled boundaries.
ptscotchDecomp(const ptscotchDecomp &)=delete
No copy construct.
TypeName("ptscotch")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
const pointField & points
Namespace for OpenFOAM.
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
vectorField pointField
pointField is a vectorField.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68