directions.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::directions
26 
27 Description
28  Set of directions for each cell in the mesh. Either uniform and size=1
29  or one set of directions per cell.
30 
31  Used in splitting cells.
32  Either all cells have similar refinement direction ('global') or
33  direction is dependent on local cell geometry, or loads selected fields
34  by name ('fieldBased'). Controlled by dictionary.
35 
36 SourceFiles
37  directions.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef directions_H
42 #define directions_H
43 
44 #include "List.H"
45 #include "vectorField.H"
46 #include "NamedEnum.H"
47 #include "point.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of classes
55 class polyMesh;
56 class twoDPointCorrector;
57 class primitiveMesh;
58 class polyPatch;
59 class dictionary;
60 
61 /*---------------------------------------------------------------------------*\
62  Class directions Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class directions
66 :
67  public List<vectorField>
68 {
69 
70 public:
71 
72  // Data types
73 
74  //- Enumeration listing the possible coordinate directions.
75  enum directionType
76  {
77  e1,
78  e2,
80  };
81 
82 
83 private:
84 
85  static const NamedEnum<directionType, 3> directionTypeNames_;
86 
87 
88  // Private Member Functions
89 
90  //- For debugging. Write point coordinate.
91  static void writeOBJ(Ostream& os, const point& pt);
92 
93  //- For debugging. Write edge between two points.
94  static void writeOBJ
95  (
96  Ostream& os,
97  const point& pt0,
98  const point& pt1,
99  label& vertI
100  );
101 
102  //- For debugging. Write hedgehog display of vectorField as obj file.
103  static void writeOBJ
104  (
105  const fileName& fName,
106  const primitiveMesh& mesh,
107  const vectorField& dirs
108  );
109 
110  //- Check if vec has no component in 2D normal direction.
111  // Exits if so.
112  static void check2D
113  (
114  const twoDPointCorrector* correct2DPtr,
115  const vector& vec
116  );
117 
118  //- Get coordinate direction for all cells in mesh by propagating from
119  // vector on patch.
120  static vectorField propagateDirection
121  (
122  const polyMesh& mesh,
123  const bool useTopo,
124  const polyPatch& pp,
125  const vectorField& ppField,
126  const vector& defaultDir
127  );
128 
129 
130 public:
131 
132  // Constructors
133 
134  //- Construct from mesh and dictionary and optional 2D corrector.
135  directions
136  (
137  const polyMesh& mesh,
138  const dictionary& dict,
139  const twoDPointCorrector* correct2DPtr = nullptr
140  );
141 
142  //- Disallow default bitwise copy construction
143  directions(const directions&) = delete;
144 
145 
146  // Member Operators
147 
148  //- Disallow default bitwise assignment
149  void operator=(const directions&) = delete;
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Definition: directions.H:67
directions(const polyMesh &mesh, const dictionary &dict, const twoDPointCorrector *correct2DPtr=nullptr)
Construct from mesh and dictionary and optional 2D corrector.
Definition: directions.C:279
directionType
Enumeration listing the possible coordinate directions.
Definition: directions.H:75
void operator=(const directions &)=delete
Disallow default bitwise assignment.
A class for handling file names.
Definition: fileName.H:82
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
Class applies a two-dimensional correction to mesh motion point field.
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict