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-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::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 geomDecomp_H
48 #define 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 
109 public:
110 
111  // Constructors
112 
113  //- Construct for derived type name and decomposition dictionary
114  geomDecomp
115  (
116  const word& derivedType,
117  const dictionary& decompDict,
118  int select = selectionType::DEFAULT
119  );
120 
121  //- Construct for derived type name, decomposition dictionary
122  //- and region name
123  geomDecomp
124  (
125  const word& derivedType,
126  const dictionary& decompDict,
127  const word& regionName,
128  int select = selectionType::DEFAULT
129  );
130 
131 
132  // Member Functions
133 
134  //- Return for every coordinate the wanted processor number.
135  virtual labelList decompose
136  (
137  const pointField& points,
138  const scalarField& pointWeights
139  ) const = 0;
140 
141  //- Decompose with uniform weights on the points
142  virtual labelList decompose(const pointField& points) const = 0;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
Foam::geomDecomp::coeffsDict_
const dictionary & coeffsDict_
Coefficients for all derived methods.
Definition: geomDecomp.H:121
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::geomDecomp::decompose
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const =0
Return for every coordinate the wanted processor number.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Vector.H
decompositionMethod.H
cartesianCS.H
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::geomDecomp
Base for geometrical domain decomposition methods.
Definition: geomDecomp.H:86
Foam::Field< vector >
Foam::geomDecomp::order_
Vector< direction > order_
Decomposition order in terms of components (optional)
Definition: geomDecomp.H:118
Foam::geomDecomp::geomDecomp
geomDecomp(const word &derivedType, const dictionary &decompDict, int select=selectionType::DEFAULT)
Construct for derived type name and decomposition dictionary.
Definition: geomDecomp.C:153
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
Foam::decompositionMethod
Abstract base class for domain decomposition.
Definition: decompositionMethod.H:51
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
tmp.H
Foam::coordSystem::cartesian
A Cartesian coordinate system.
Definition: cartesianCS.H:69
Foam::Vector< label >
Foam::List< label >
Foam::geomDecomp::adjustPoints
tmp< pointField > adjustPoints(const pointField &) const
Apply delta (jitter) or rotation to coordinates.
Definition: geomDecomp.C:122
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::geomDecomp::n_
Vector< label > n_
The divisions.
Definition: geomDecomp.H:115