directions.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-2016 OpenFOAM Foundation
9  Copyright (C) 2020-2025 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::directions
29 
30 Description
31  Set of directions for each cell in the mesh. Either uniform and size=1
32  or one set of directions per cell.
33 
34  Used in splitting cells. Options:
35  - global : global xyz coordinate system
36  - user : user-defined coordinate system
37  - patchLocal : normal direction from (flat) given patch
38  - fieldBased : supply separate vectorIOField for each direction
39 
40 SourceFiles
41  directions.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef directions_H
46 #define directions_H
47 
48 #include "List.H"
49 #include "vectorField.H"
50 #include "Enum.H"
51 #include "point.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward Declarations
59 class polyMesh;
60 class twoDPointCorrector;
61 class primitiveMesh;
62 class polyPatch;
63 class dictionary;
64 
65 /*---------------------------------------------------------------------------*\
66  Class directions Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class directions
70 :
71  public List<vectorField>
72 {
73 public:
74 
75  // Data Types
76 
77  //- Enumeration listing the possible coordinate directions.
79  {
80  TAN1,
81  TAN2,
82  NORMAL
83  };
84 
85 
86 private:
87 
88  static const Enum<directionType> directionTypeNames_;
89 
90 
91  // Private Member Functions
92 
93  //- For debugging. Write point coordinate.
94  static void writeOBJ(Ostream& os, const point& pt);
95 
96  //- For debugging. Write edge between two points.
97  static void writeOBJ
98  (
99  Ostream& os,
100  const point& pt0,
101  const point& pt1,
102  label& vertI
103  );
104 
105  //- For debugging. Write hedgehog display of vectorField as obj file.
106  static void writeOBJ
107  (
108  const fileName& fName,
109  const primitiveMesh& mesh,
110  const vectorField& dirs
111  );
112 
113  //- Check if vec has no component in 2D normal direction. Exits if
114  // so.
115  static void check2D
116  (
117  const twoDPointCorrector* correct2DPtr,
118  const vector& vec
119  );
120 
121  //- Get coordinate direction for all cells in mesh by propagating from
122  // vector on patch.
123  static vectorField propagateDirection
124  (
125  const polyMesh& mesh,
126  const bool useTopo,
127  const polyPatch& pp,
128  const vectorField& ppField,
129  const vector& defaultDir
130  );
131 
132  //- No copy construct
133  directions(const directions&) = delete;
134 
135  //- No copy assignment
136  void operator=(const directions&) = delete;
137 
138 
139 public:
140 
141  // Constructors
142 
143  //- Construct from mesh and dictionary and optional 2D corrector.
144  directions
145  (
146  const polyMesh& mesh,
147  const dictionary& dict,
148  const twoDPointCorrector* correct2DPtr = nullptr
149  );
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
dictionary dict
A class for handling file names.
Definition: fileName.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Definition: directions.H:64
dynamicFvMesh & mesh
Class applies a two-dimensional correction to mesh motion point field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
directionType
Enumeration listing the possible coordinate directions.
Definition: directions.H:75
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.