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 
32 SourceFiles
33  randomDecomp.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef randomDecomp_H
38 #define randomDecomp_H
39 
40 #include "decompositionMethod.H"
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class randomDecomp Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class randomDecomp
50 :
51  public decompositionMethod
52 {
53  // Private Member Functions
54 
55  //- Random distribution on the 0-nCells interval
56  labelList randomMap(const label nCells) const;
57 
58  //- No copy construct
59  void operator=(const randomDecomp&) = delete;
60 
61  //- No copy assignment
62  randomDecomp(const randomDecomp&) = delete;
63 
64 
65 public:
66 
67  //- Runtime type information
68  TypeNameNoDebug("random");
69 
70 
71  // Constructors
72 
73  //- Construct for decomposition dictionary and optional region name
74  explicit randomDecomp
75  (
76  const dictionary& decompDict,
77  const word& regionName = ""
78  );
79 
80 
81  //- Destructor
82  virtual ~randomDecomp() = default;
83 
84 
85  // Member Functions
86 
87  //- Does not care about proc boundaries
88  virtual bool parallelAware() const
89  {
90  return true;
91  }
92 
93 
94  // No topology (implemented by geometric decomposers)
95 
96  //- Return for every coordinate the wanted processor number.
97  virtual labelList decompose
98  (
99  const pointField& points,
100  const scalarField& pointWeights
101  ) const;
102 
103  //- Decompose with uniform weights on the points
104  virtual labelList decompose(const pointField& points) const;
105 
106  //- Return for every coordinate the wanted processor number.
107  virtual labelList decompose
108  (
109  const polyMesh& mesh,
110  const pointField& cc,
111  const scalarField& cWeights
112  ) const;
113 
114  //- Return for every coordinate the wanted processor number.
115  // Explicitly provided connectivity - does not use mesh_.
116  virtual labelList decompose
117  (
118  const labelListList& globalCellCells,
119  const pointField& cc,
120  const scalarField& cWeights
121  ) const;
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace Foam
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
132 
133 // ************************************************************************* //
Foam::randomDecomp::decompose
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return for every coordinate the wanted processor number.
Definition: randomDecomp.C:78
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::randomDecomp
Decomposition according to pseudo-random number generator.
Definition: randomDecomp.H:48
Foam::randomDecomp::~randomDecomp
virtual ~randomDecomp()=default
Destructor.
Foam::randomDecomp::TypeNameNoDebug
TypeNameNoDebug("random")
Runtime type information.
decompositionMethod.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::Field< vector >
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::decompositionMethod
Abstract base class for domain decomposition.
Definition: decompositionMethod.H:51
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::randomDecomp::parallelAware
virtual bool parallelAware() const
Does not care about proc boundaries.
Definition: randomDecomp.H:87
Foam::List< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1