Loading...
Searching...
No Matches
randomDecomp.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) 2019-2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::randomDecomp
28
29Description
30 Decomposition according to pseudo-random number generator,
31 which is useful for development and stress testing implementations
32 but obviously sub-optimal for normal uses.
33 Can optionally specify the number of consecutive cells to assign
34 to the same processor (agglomeration).
35
36 Coefficients:
37 \table
38 Property | Description | Required | Default
39 agglom | Number of cells to agglomerate | no | 0
40 \endtable
41
42SourceFiles
43 randomDecomp.C
44
45\*---------------------------------------------------------------------------*/
46
47#ifndef Foam_randomDecomp_H
48#define Foam_randomDecomp_H
49
50#include "decompositionMethod.H"
51
52namespace Foam
53{
54
55/*---------------------------------------------------------------------------*\
56 Class randomDecomp Declaration
57\*---------------------------------------------------------------------------*/
58
59class randomDecomp
60:
62{
63 // Private Data
65 //- Number of cells to agglomerate per random value (default: 0)
66 label agglom_;
67
68
69 // Private Member Functions
70
71 //- Random distribution on the 0-nCells interval
72 labelList randomMap(const label nCells) const;
73
74public:
75
76 // Generated Methods
77
78 //- No copy construct
79 randomDecomp(const randomDecomp&) = delete;
80
81 //- No copy assignment
82 void operator=(const randomDecomp&) = delete;
83
84
85 //- Runtime type information
86 TypeNameNoDebug("random");
87
88
89 // Constructors
91 //- Construct with number of domains (no coefficients or constraints)
92 explicit randomDecomp(const label numDomains);
93
94 //- Construct for decomposition dictionary and optional region name
95 explicit randomDecomp
96 (
97 const dictionary& decompDict,
98 const word& regionName = "",
99 int select = selectionType::DEFAULT
100 );
102
103 //- Destructor
104 virtual ~randomDecomp() = default;
105
106
107 // Member Functions
108
109 //- Does not care about proc boundaries
110 virtual bool parallelAware() const
111 {
112 return true;
113 }
114
115 //- Return for every coordinate the wanted processor number.
116 virtual labelList decompose
117 (
118 const pointField& points,
119 const scalarField& pointWeights_unused = scalarField::null()
120 ) const;
121
122 //- Return for every coordinate the wanted processor number.
123 virtual labelList decompose
124 (
126 const pointField& cc_unused = pointField::null(),
127 const scalarField& cWeights_unused = scalarField::null()
128 ) const;
129
130 //- Return for every coordinate the wanted processor number.
131 // Explicitly provided connectivity - does not use mesh_.
132 virtual labelList decompose
134 const CompactListList<label>& globalCellCells,
135 const pointField& cc_unused = pointField::null(),
136 const scalarField& cWeights_unused = scalarField::null()
137 ) const;
138
139 //- Return for every coordinate the wanted processor number.
140 // Explicitly provided connectivity - does not use mesh_.
141 virtual labelList decompose
142 (
143 const labelListList& globalCellCells,
144 const pointField& cc_unused = pointField::null(),
145 const scalarField& cWeights_unused = scalarField::null()
146 ) const;
147};
148
149
150// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151
152} // End namespace Foam
153
154// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155
156#endif
157
158// ************************************************************************* //
A packed storage of objects of type <T> using an offset table for access.
static const Field< scalar > & null() noexcept
Definition Field.H:192
Abstract base class for domain decomposition.
decompositionMethod(const label numDomains)
Construct with specified number of domains, no coefficients or constraints.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Decomposition according to pseudo-random number generator, which is useful for development and stress...
virtual ~randomDecomp()=default
Destructor.
TypeNameNoDebug("random")
Runtime type information.
void operator=(const randomDecomp &)=delete
No copy assignment.
virtual bool parallelAware() const
Does not care about proc boundaries.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights_unused=scalarField::null()) const
Return for every coordinate the wanted processor number.
randomDecomp(const randomDecomp &)=delete
No copy construct.
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 TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61