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 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  TypeName("random");
69 
70 
71  // Constructors
72 
73  //- Construct given the decomposition dictionary
74  randomDecomp(const dictionary& decompDict);
75 
76  //- Construct for decomposition dictionary and region name
78  (
79  const dictionary& decompDict,
80  const word& regionName
81  );
82 
83 
84  //- Destructor
85  virtual ~randomDecomp() = default;
86 
87 
88  // Member Functions
89 
90  //- Does not care about proc boundaries
91  virtual bool parallelAware() const
92  {
93  return true;
94  }
95 
96  // No topology (implemented by geometric decomposers)
97 
98  //- Return for every coordinate the wanted processor number.
99  virtual labelList decompose
100  (
101  const pointField& points,
102  const scalarField& pointWeights
103  ) const;
104 
105  //- Decompose with uniform weights on the points
106  virtual labelList decompose(const pointField& points) const;
107 
108  //- Return for every coordinate the wanted processor number.
109  virtual labelList decompose
110  (
111  const polyMesh& mesh,
112  const pointField& cc,
113  const scalarField& cWeights
114  ) const;
115 
116  //- Return for every coordinate the wanted processor number.
117  // Explicitly provided connectivity - does not use mesh_.
118  virtual labelList decompose
119  (
120  const labelListList& globalCellCells,
121  const pointField& cc,
122  const scalarField& cWeights
123  ) const;
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 #endif
134 
135 // ************************************************************************* //
Foam::randomDecomp::decompose
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return for every coordinate the wanted processor number.
Definition: randomDecomp.C:92
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::randomDecomp
Decomposition according to pseudo-random number generator.
Definition: randomDecomp.H:48
Foam::randomDecomp::~randomDecomp
virtual ~randomDecomp()=default
Destructor.
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:121
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:90
Foam::List< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::randomDecomp::TypeName
TypeName("random")
Runtime type information.