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-2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::randomDecomp
28 
29 Description
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 | 1
40  \endtable
41 
42 SourceFiles
43  randomDecomp.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef Foam_randomDecomp_H
48 #define Foam_randomDecomp_H
49 
50 #include "decompositionMethod.H"
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class randomDecomp Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class randomDecomp
60 :
61  public decompositionMethod
62 {
63  // Private Data
64 
65  //- Number of cells to agglomerate per random value (default: 1)
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 
74  //- No copy construct
75  void operator=(const randomDecomp&) = delete;
76 
77  //- No copy assignment
78  randomDecomp(const randomDecomp&) = delete;
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeNameNoDebug("random");
85 
86 
87  // Constructors
88 
89  //- Construct for decomposition dictionary and optional region name
90  explicit randomDecomp
91  (
92  const dictionary& decompDict,
93  const word& regionName = "",
94  int select = selectionType::DEFAULT
95  );
96 
97 
98  //- Destructor
99  virtual ~randomDecomp() = default;
100 
101 
102  // Member Functions
103 
104  //- Does not care about proc boundaries
105  virtual bool parallelAware() const
106  {
107  return true;
108  }
109 
110 
111  // No topology (implemented by geometric decomposers)
112 
113  //- Return for every coordinate the wanted processor number.
114  virtual labelList decompose
115  (
116  const pointField& points,
117  const scalarField& pointWeights
118  ) const;
119 
120  //- Decompose with uniform weights on the points
121  virtual labelList decompose(const pointField& points) const;
122 
123  //- Return for every coordinate the wanted processor number.
124  virtual labelList decompose
125  (
126  const polyMesh& mesh,
127  const pointField& cc,
128  const scalarField& cWeights
129  ) const;
130 
131  //- Return for every coordinate the wanted processor number.
132  // Explicitly provided connectivity - does not use mesh_.
133  virtual labelList decompose
134  (
135  const labelListList& globalCellCells,
136  const pointField& cc,
137  const scalarField& cWeights
138  ) const;
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
Definition: BitOps.C:134
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return for every coordinate the wanted processor number.
Definition: randomDecomp.C:98
Foam::word regionName(Foam::polyMesh::defaultRegion)
dynamicFvMesh & mesh
const pointField & points
A class for handling words, derived from Foam::string.
Definition: word.H:63
Decomposition according to pseudo-random number generator, which is useful for development and stress...
Definition: randomDecomp.H:64
virtual ~randomDecomp()=default
Destructor.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
virtual bool parallelAware() const
Does not care about proc boundaries.
Definition: randomDecomp.H:126
TypeNameNoDebug("random")
Runtime type information.
Namespace for OpenFOAM.