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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::directions
28 
29 Description
30  Set of directions for each cell in the mesh. Either uniform and size=1
31  or one set of directions per cell.
32 
33  Used in splitting cells.
34  Either all cells have similar refinement direction ('global') or
35  direction is dependent on local cell geometry, or loads selected fields
36  by name ('fieldBased'). Controlled by dictionary.
37 
38 SourceFiles
39  directions.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef directions_H
44 #define directions_H
45 
46 #include "List.H"
47 #include "vectorField.H"
48 #include "Enum.H"
49 #include "point.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward declaration of classes
57 class polyMesh;
58 class twoDPointCorrector;
59 class primitiveMesh;
60 class polyPatch;
61 class dictionary;
62 
63 /*---------------------------------------------------------------------------*\
64  Class directions Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class directions
68 :
69  public List<vectorField>
70 {
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:69
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:66
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::label
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:62
Foam::Field< vector >
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
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:121
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: HashTable.H:102
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