normalToFace.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 OpenFOAM Foundation
9 Copyright (C) 2018-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::normalToFace
29
30Description
31 A \c topoSetFaceSource to select faces whose surface normal aligned
32 with a given direction.
33
34 Operands:
35 \table
36 Operand | Type | Location
37 output | faceSet | $FOAM_CASE/constant/polyMesh/sets/<set>
38 \endtable
39
40Usage
41 Minimal example by using \c system/topoSetDict.actions:
42 \verbatim
43 {
44 // Mandatory (inherited) entries
45 name <name>;
46 type faceSet;
47 action <action>;
48
49 // Mandatory entries
50 source normalToFace;
51 normal (1 0 0);
52 cos 0.01;
53 }
54 \endverbatim
55
56 where the entries mean:
57 \table
58 Property | Description | Type | Req'd | Dflt
59 name | Name of faceSet | word | yes | -
60 type | Type name: faceSet | word | yes | -
61 action | Action applied on faces - see below | word | yes | -
62 source | Source name: normalToFace | word | yes | -
63 normal | The surface normal direction | vector | yes | -
64 cos | Tolerance angle (range -1, +1), i.e. cosine of angle <!--
65 --> between the input normal and face normal | scalar | yes | -
66 \endtable
67
68 Options for the \c action entry:
69 \verbatim
70 new | Create a new faceSet from selected faces
71 add | Add selected faces into this faceSet
72 subtract | Remove selected faces from this faceSet
73 \endverbatim
74
75See also
76 - Foam::topoSetSource
77 - Foam::topoSetFaceSource
78
79SourceFiles
80 normalToFace.C
81
82\*---------------------------------------------------------------------------*/
83
84#ifndef normalToFace_H
85#define normalToFace_H
86
87#include "topoSetFaceSource.H"
88
89// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90
91namespace Foam
92{
93
94/*---------------------------------------------------------------------------*\
95 Class normalToFace Declaration
96\*---------------------------------------------------------------------------*/
97
98class normalToFace
99:
100 public topoSetFaceSource
101{
102 // Private Data
103
104 //- Add usage string
105 static addToUsageTable usage_;
106
107 //- The surface normal direction
108 vector normal_;
109
110 //- Tolerance (i.e. cos of angle between normal_ and faceNormal)
111 const scalar tol_;
112
113
114 // Private Member Functions
115
116 //- Normalize normal and check tolerance
117 void setNormal();
118
119
120public:
121
122 //- Runtime type information
123 TypeName("normalToFace");
124
125
126 // Constructors
127
128 //- Construct from components
130 (
131 const polyMesh& mesh,
132 const vector& normal,
133 const scalar tol
134 );
135
136 //- Construct from dictionary
137 normalToFace(const polyMesh& mesh, const dictionary& dict);
138
139 //- Construct from Istream
140 normalToFace(const polyMesh& mesh, Istream&);
141
142
143 //- Destructor
144 virtual ~normalToFace() = default;
145
146
147 // Member Functions
148
149 virtual void applyToSet
150 (
151 const topoSetSource::setAction action,
152 topoSet& set
153 ) const;
154};
155
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159} // End namespace Foam
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163#endif
164
165// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A topoSetFaceSource to select faces whose surface normal aligned with a given direction.
Definition: normalToFace.H:152
TypeName("normalToFace")
Runtime type information.
virtual ~normalToFace()=default
Destructor.
normalToFace(const polyMesh &mesh, const vector &normal, const scalar tol)
Construct from components.
Definition: normalToFace.C:87
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: normalToFace.C:127
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetFaceSource is a intermediate class for handling topoSet sources for selecting faces.
Class with constructor to add usage string to table.
setAction
Enumeration defining various actions.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:67
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73