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 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::normalToFace
29 
30 Description
31  A topoSetFaceSource to select faces based on normal.
32 
33  \heading Dictionary parameters
34  \table
35  Property | Description | Required | Default
36  normal | The normal for selecting faces | yes |
37  cos | Tolerance angle (range -1, +1) | yes |
38  \endtable
39 
40 SourceFiles
41  normalToFace.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef normalToFace_H
46 #define normalToFace_H
47 
48 #include "topoSetFaceSource.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class normalToFace Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class normalToFace
60 :
61  public topoSetFaceSource
62 {
63 
64 private:
65 
66  //- Add usage string
67  static addToUsageTable usage_;
68 
69  //- (unit)vector to compare to
70  vector normal_;
71 
72  //- Tolerance (i.e. cos of angle between normal_ and faceNormal)
73  const scalar tol_;
74 
75 
76  // Private Member Functions
77 
78  //- Normalize normal and check tolerance
79  void setNormal();
80 
81 
82 public:
83 
84  //- Runtime type information
85  TypeName("normalToFace");
86 
87  // Constructors
88 
89  //- Construct from components
91  (
92  const polyMesh& mesh,
93  const vector& normal,
94  const scalar tol
95  );
96 
97  //- Construct from dictionary
98  normalToFace(const polyMesh& mesh, const dictionary& dict);
99 
100  //- Construct from Istream
101  normalToFace(const polyMesh& mesh, Istream&);
102 
103 
104  //- Destructor
105  virtual ~normalToFace() = default;
106 
107 
108  // Member Functions
109 
110  virtual void applyToSet
111  (
112  const topoSetSource::setAction action,
113  topoSet& set
114  ) const;
115 
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
Foam::normalToFace::TypeName
TypeName("normalToFace")
Runtime type information.
Foam::topoSetSource::addToUsageTable
Class with constructor to add usage string to table.
Definition: topoSetSource.H:124
Foam::normalToFace::normalToFace
normalToFace(const polyMesh &mesh, const vector &normal, const scalar tol)
Construct from components.
Definition: normalToFace.C:87
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:99
Foam::topoSetFaceSource
Base class of a topoSet source for selecting faces.
Definition: topoSetFaceSource.H:50
Foam::topoSetSource::mesh
const polyMesh & mesh() const
Reference to the mesh.
Definition: topoSetSource.H:333
Foam::normalToFace::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: normalToFace.C:127
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.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
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::normalToFace::~normalToFace
virtual ~normalToFace()=default
Destructor.
Foam::Vector< scalar >
Foam::normalToFace
A topoSetFaceSource to select faces based on normal.
Definition: normalToFace.H:73
topoSetFaceSource.H