geomDecomp.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-2023 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::geomDecomp
29 
30 Description
31  Base for geometrical domain decomposition methods
32 
33  Base coefficients:
34  \table
35  Property | Description | Required | Default
36  n | (nx ny nz) | yes |
37  order | order of operation | no | xyz
38  delta | delta (jitter) for rotation matrix | no | 0.001
39  rotation | coordinate rotation | no |
40  \endtable
41 
42 SourceFiles
43  geomDecomp.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef Foam_geomDecomp_H
48 #define Foam_geomDecomp_H
49 
50 #include "decompositionMethod.H"
51 #include "cartesianCS.H"
52 #include "Vector.H"
53 #include "tmp.H"
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class geomDecomp Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class geomDecomp
63 :
64  public decompositionMethod
65 {
66  // Private Data
67 
68  //- Small delta (default: 0.001) to avoid staggering when
69  //- mesh itself is aligned with x/y/z
70  scalar delta_;
71 
72  //- Local coordinates, or delta rotation tensor
73  coordSystem::cartesian csys_;
74 
75 
76  // Private Member Functions
77 
78  //- Convert ordering string ("xyz") into list of components.
79  // Checks for bad entries, but no check for duplicate entries.
80  void setOrder();
81 
82  //- Read input values and initialize rotation matrix
83  void readCoeffs();
84 
85 
86 protected:
87 
88  // Protected Data
89 
90  //- The divisions
92 
93  //- Decomposition order in terms of components (optional)
95 
96  //- Coefficients for all derived methods
97  const dictionary& coeffsDict_;
98 
99 
100  // Protected Member Functions
101 
102  //- Apply delta (jitter) or rotation to coordinates
104 
105  //- Check that mesh directions are compatible with decomposition
106  void checkDecompositionDirections(const Vector<label>&) const;
107 
108 public:
109 
110  // Constructors
111 
112  //- Construct with number of x/y/z division
113  //- (no coefficients or constraints)
114  explicit geomDecomp(const Vector<label>& divisions);
115 
116  //- Construct for derived type name and decomposition dictionary
117  geomDecomp
118  (
119  const word& derivedType,
120  const dictionary& decompDict,
121  int select = selectionType::DEFAULT
122  );
123 
124  //- Construct for derived type name, decomposition dictionary
125  //- and region name
126  geomDecomp
127  (
128  const word& derivedType,
129  const dictionary& decompDict,
130  const word& regionName,
131  int select = selectionType::DEFAULT
132  );
133 
134 
135  // Member Functions
136 
137  //- Purely geometric methods
138  virtual bool geometric() const { return true; }
139 
140  //- Return for every coordinate the wanted processor number.
141  virtual labelList decompose
142  (
143  const pointField& points,
144  const scalarField& pointWeights = scalarField::null()
145  ) const = 0;
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
Definition: BitOps.C:134
Vector< label > n_
The divisions.
Definition: geomDecomp.H:122
Vector< direction > order_
Decomposition order in terms of components (optional)
Definition: geomDecomp.H:127
void checkDecompositionDirections(const Vector< label > &) const
Check that mesh directions are compatible with decomposition.
Definition: geomDecomp.C:124
const pointField & points
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual labelList decompose(const pointField &points, const scalarField &pointWeights=scalarField::null()) const =0
Return for every coordinate the wanted processor number.
tmp< pointField > adjustPoints(const pointField &) const
Apply delta (jitter) or rotation to coordinates.
Definition: geomDecomp.C:115
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
static const Field< scalar > & null()
Return nullObject reference Field.
Definition: FieldI.H:24
virtual bool geometric() const
Purely geometric methods.
Definition: geomDecomp.H:185
geomDecomp(const Vector< label > &divisions)
Construct with number of x/y/z division (no coefficients or constraints)
Definition: geomDecomp.C:145
const dictionary & coeffsDict_
Coefficients for all derived methods.
Definition: geomDecomp.H:132
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.