simpleGeomDecomp.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) 2011 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::simpleGeomDecomp
29 
30 Description
31  Simple geometric decomposition, selectable as \c simple
32 
33  Method coefficients:
34  \table
35  Property | Description | Required | Default
36  n | (nx ny nz) | yes
37  delta | delta for rotation matrix | no | 0.001
38  \endtable
39 
40 SourceFiles
41  simpleGeomDecomp.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef simpleGeomDecomp_H
46 #define simpleGeomDecomp_H
47 
48 #include "geomDecomp.H"
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class simpleGeomDecomp Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class simpleGeomDecomp
58 :
59  public geomDecomp
60 {
61  // Private Member Functions
62 
63  static void assignToProcessorGroup(labelList&, const label);
64 
65  static void assignToProcessorGroup
66  (
67  labelList& processorGroup,
68  const label nProcGroup,
69  const labelList& indices,
70  const scalarField& weights,
71  const scalar summedWeights
72  );
73 
74  labelList decomposeOneProc(const pointField& points) const;
75 
76  labelList decomposeOneProc
77  (
78  const pointField& points,
79  const scalarField& weights
80  ) const;
81 
82 
83  //- No copy construct
84  void operator=(const simpleGeomDecomp&) = delete;
85 
86  //- No copy assignment
87  simpleGeomDecomp(const simpleGeomDecomp&) = delete;
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("simple");
94 
95 
96  // Constructors
97 
98  //- Construct given decomposition dictionary
99  simpleGeomDecomp(const dictionary& decompDict);
100 
101  //- Construct given decomposition dictionary and region name
103  (
104  const dictionary& decompDict,
105  const word& regionName
106  );
107 
108 
109  //- Destructor
110  virtual ~simpleGeomDecomp() = default;
111 
112 
113  // Member Functions
114 
115  //- Simple sends all points to the master for decomposition.
116  virtual bool parallelAware() const
117  {
118  return true;
119  }
120 
121  //- Decompose with uniform weights.
122  virtual labelList decompose(const pointField& points) const;
123 
124  //- Return for every coordinate the wanted processor number.
125  virtual labelList decompose
126  (
127  const pointField& points,
128  const scalarField& weights
129  ) const;
130 
131  //- Decompose with uniform weights.
132  virtual labelList decompose
133  (
134  const polyMesh& mesh,
135  const pointField& points
136  ) const
137  {
138  checkDecompositionDirections(mesh.geometricD());
139  return decompose(points);
140  }
141 
142  //- Return for every coordinate the wanted processor number.
143  virtual labelList decompose
144  (
145  const polyMesh& mesh,
147  const scalarField& weights
148  ) const
149  {
150  checkDecompositionDirections(mesh.geometricD());
151  return decompose(points, weights);
152  }
153 
154  //- Explicitly provided connectivity
155  virtual labelList decompose
156  (
157  const labelListList& globalCellCells,
158  const pointField& cc,
159  const scalarField& cWeights
160  ) const
161  {
162  return decompose(cc, cWeights);
163  }
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
Foam::simpleGeomDecomp
Simple geometric decomposition, selectable as simple.
Definition: simpleGeomDecomp.H:70
geomDecomp.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::simpleGeomDecomp::~simpleGeomDecomp
virtual ~simpleGeomDecomp()=default
Destructor.
Foam::simpleGeomDecomp::decompose
virtual labelList decompose(const pointField &points) const
Decompose with uniform weights.
Definition: simpleGeomDecomp.C:330
Foam::simpleGeomDecomp::parallelAware
virtual bool parallelAware() const
Simple sends all points to the master for decomposition.
Definition: simpleGeomDecomp.H:129
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::simpleGeomDecomp::TypeName
TypeName("simple")
Runtime type information.
Foam::geomDecomp
Base for geometrical domain decomposition methods.
Definition: geomDecomp.H:71
Foam::Field< scalar >
Foam::geomDecomp::checkDecompositionDirections
void checkDecompositionDirections(const Vector< label > &) const
Check that mesh directions are compatible with decomposition.
Definition: geomDecomp.C:64
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
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1