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 | Copyright (C) 2011-2016 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  {
79  NORMAL
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. Exits if
111  // 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  //- Disallow default bitwise copy construct
130  directions(const directions&);
131 
132  //- Disallow default bitwise assignment
133  void operator=(const directions&);
134 
135 
136 public:
137 
138  // Constructors
139 
140  //- Construct from mesh and dictionary and optional 2D corrector.
141  directions
142  (
143  const polyMesh& mesh,
144  const dictionary& dict,
145  const twoDPointCorrector* correct2DPtr = nullptr
146  );
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #endif
157 
158 // ************************************************************************* //
dictionary dict
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
A class for handling file names.
Definition: fileName.H:69
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:60
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
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:53
directionType
Enumeration listing the possible coordinate directions.
Definition: directions.H:74
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.