random.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::decompositionMethods::random
26 
27 Description
28  Random decomposition. Good for testing. Very bad for anything else.
29 
30 SourceFiles
31  random.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef random_H
36 #define random_H
37 
38 #include "decompositionMethod.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace decompositionMethods
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class random Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class random
52 :
53  public decompositionMethod
54 {
55  // Private Data
56 
57  //- Generator seed
58  label seed_;
59 
60 
61 public:
62 
63  //- Runtime type information
64  TypeName("random");
65 
66 
67  // Constructors
68 
69  //- Construct given the decomposition dictionary
70  random
71  (
72  const dictionary& decompositionDict,
73  const dictionary& methodDict
74  );
75 
76  //- Disallow default bitwise copy construction
77  random(const random&) = delete;
78 
79 
80  //- Destructor
81  virtual ~random()
82  {}
83 
84 
85  // Member Functions
86 
87  //- Return for every coordinate the wanted processor number. Use the
88  // mesh connectivity.
89  virtual labelList decompose
90  (
91  const polyMesh& mesh,
92  const pointField& cellCentres,
93  const scalarField& cellWeights
94  );
95 
96  //- Return for every coordinate the wanted processor number. Explicitly
97  // provided connectivity. Does not use the mesh.
98  virtual labelList decompose
99  (
100  const labelListList& globalCellCells,
101  const pointField& cellCentres,
102  const scalarField& cellWeights
103  )
104  {
106  return labelList(0);
107  }
108 
109 
110  // Member Operators
111 
112  //- Disallow default bitwise assignment
113  void operator=(const random&) = delete;
114 };
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace decompositionMethods
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
Abstract base class for decomposition.
Random decomposition. Good for testing. Very bad for anything else.
Definition: random.H:53
TypeName("random")
Runtime type information.
virtual ~random()
Destructor.
Definition: random.H:80
virtual labelList decompose(const polyMesh &mesh, const pointField &cellCentres, const scalarField &cellWeights)
Return for every coordinate the wanted processor number. Use the.
Definition: random.C:72
void operator=(const random &)=delete
Disallow default bitwise assignment.
random(const dictionary &decompositionDict, const dictionary &methodDict)
Construct given the decomposition dictionary.
Definition: random.C:59
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: labelList.H:56
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59