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