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-2021 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  order | order of operation (unused) | no | xyz
38  delta | delta (jitter) for rotation matrix | no | 0.001
39  transform | cartesian coordinate transformation | no |
40  \endtable
41 
42 SourceFiles
43  simpleGeomDecomp.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef simpleGeomDecomp_H
48 #define simpleGeomDecomp_H
49 
50 #include "geomDecomp.H"
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class simpleGeomDecomp Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class simpleGeomDecomp
60 :
61  public geomDecomp
62 {
63  // Private Member Functions
64 
65  static void assignToProcessorGroup
66  (
67  labelList& processorGroup,
68  const label nProcGroup
69  );
70 
71  static void assignToProcessorGroup
72  (
73  labelList& processorGroup,
74  const label nProcGroup,
75  const labelList& indices,
76  const scalarField& weights,
77  const scalar summedWeights
78  );
79 
80  labelList decomposeOneProc(const pointField& points) const;
81 
82  labelList decomposeOneProc
83  (
84  const pointField& points,
85  const scalarField& weights
86  ) const;
87 
88 
89 public:
90 
91  //- No copy construct
92  void operator=(const simpleGeomDecomp&) = delete;
93 
94  //- No copy assignment
95  simpleGeomDecomp(const simpleGeomDecomp&) = delete;
96 
97  //- Runtime type information
98  TypeName("simple");
99 
100 
101  // Constructors
102 
103  //- Construct given decomposition dictionary and optional region name
104  explicit simpleGeomDecomp
105  (
106  const dictionary& decompDict,
107  const word& regionName = ""
108  );
109 
110 
111  //- Destructor
112  virtual ~simpleGeomDecomp() = default;
113 
114 
115  // Member Functions
116 
117  //- Simple sends all points to the master for decomposition.
118  virtual bool parallelAware() const
119  {
120  return true;
121  }
122 
123  //- Decompose with uniform weights.
124  virtual labelList decompose(const pointField& points) const;
125 
126  //- Return for every coordinate the wanted processor number.
127  virtual labelList decompose
128  (
129  const pointField& points,
130  const scalarField& weights
131  ) const;
132 
133  //- Decompose with uniform weights.
134  virtual labelList decompose
135  (
136  const polyMesh& mesh,
137  const pointField& points
138  ) const
139  {
140  checkDecompositionDirections(mesh.geometricD());
141  return decompose(points);
142  }
143 
144  //- Return for every coordinate the wanted processor number.
145  virtual labelList decompose
146  (
147  const polyMesh& mesh,
148  const pointField& points,
149  const scalarField& weights
150  ) const
151  {
152  checkDecompositionDirections(mesh.geometricD());
153  return decompose(points, weights);
154  }
155 
156  //- Explicitly provided connectivity
157  virtual labelList decompose
158  (
159  const labelListList& globalCellCells, // unused
160  const pointField& cc,
161  const scalarField& cWeights
162  ) const
163  {
164  return decompose(cc, cWeights);
165  }
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::simpleGeomDecomp
Simple geometric decomposition, selectable as simple.
Definition: simpleGeomDecomp.H:83
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
geomDecomp.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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::simpleGeomDecomp
simpleGeomDecomp(const simpleGeomDecomp &)=delete
No copy assignment.
Foam::simpleGeomDecomp::parallelAware
virtual bool parallelAware() const
Simple sends all points to the master for decomposition.
Definition: simpleGeomDecomp.H:142
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:86
Foam::Field< scalar >
Foam::geomDecomp::checkDecompositionDirections
void checkDecompositionDirections(const Vector< label > &) const
Check that mesh directions are compatible with decomposition.
Definition: geomDecomp.C:131
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
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::simpleGeomDecomp::operator=
void operator=(const simpleGeomDecomp &)=delete
No copy construct.
Foam::List< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1