surfaceToPoint.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-2015 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::surfaceToPoint
29 
30 Description
31  A topoSetPointSource to select points based on relation to surface.
32 
33  Select based on:
34  - distance to surface
35  - inside/outside status to surface
36  (Uses normal of nearest surface triangle so requires valid surface
37  topology!)
38 
39  \heading Dictionary parameters
40  \table
41  Property | Description | Required | Default
42  file | The surface "filename" | yes |
43  scale | surface scaling factor | no | -1
44  nearDistance | Near distance to the surface | yes |
45  includeInside | Include inside cells (bool) | yes |
46  includeOutside | Include outside cells (bool) | yes |
47  \endtable
48 
49 SourceFiles
50  surfaceToPoint.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef surfaceToPoint_H
55 #define surfaceToPoint_H
56 
57 #include "topoSetPointSource.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 // Forward declarations
65 class triSurfaceSearch;
66 
67 /*---------------------------------------------------------------------------*\
68  Class surfaceToPoint Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class surfaceToPoint
72 :
73  public topoSetPointSource
74 {
75 
76  // Private data
77 
78  //- Add usage string
79  static addToUsageTable usage_;
80 
81  //- Name of surface file
82  const fileName surfName_;
83 
84  //- Optional scaling for surface
85  const scalar scale_;
86 
87  //- If > 0 : include points with distance to surface less than nearDist.
88  const scalar nearDist_;
89 
90  //- Include all points on opposite sign of normal on nearest surface.
91  const bool includeInside_;
92 
93  //- Include all points on this sign of normal on nearest surface.
94  const bool includeOutside_;
95 
96 
97  // Private Member Functions
98 
99  //- Depending on surface add to or delete from pointSet.
100  void combine(topoSet& set, const bool add) const;
101 
102  //- Check settings at construction time.
103  void checkSettings() const;
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("surfaceToPoint");
109 
110  // Constructors
111 
112  //- Construct from components
114  (
115  const polyMesh& mesh,
116  const fileName& surfName,
117  const scalar nearDist,
118  const bool includeInside,
119  const bool includeOutside
120  );
121 
122  //- Construct from dictionary
123  surfaceToPoint(const polyMesh& mesh, const dictionary& dict);
124 
125  //- Construct from Istream
126  surfaceToPoint(const polyMesh& mesh, Istream& is);
127 
128 
129  //- Destructor
130  virtual ~surfaceToPoint() = default;
131 
132 
133  // Member Functions
134 
135  virtual void applyToSet
136  (
137  const topoSetSource::setAction action,
138  topoSet& set
139  ) const;
140 
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
Foam::surfaceToPoint::~surfaceToPoint
virtual ~surfaceToPoint()=default
Destructor.
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::combine
Definition: FaceCellWave.C:56
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:99
Foam::topoSetSource::mesh
const polyMesh & mesh() const
Reference to the mesh.
Definition: topoSetSource.H:333
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::surfaceToPoint::TypeName
TypeName("surfaceToPoint")
Runtime type information.
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:66
Foam::topoSetPointSource
Base class of a topoSet source for selecting points.
Definition: topoSetPointSource.H:50
Foam::surfaceToPoint
A topoSetPointSource to select points based on relation to surface.
Definition: surfaceToPoint.H:100
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::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfaceToPoint::surfaceToPoint
surfaceToPoint(const polyMesh &mesh, const fileName &surfName, const scalar nearDist, const bool includeInside, const bool includeOutside)
Construct from components.
Definition: surfaceToPoint.C:130
topoSetPointSource.H
Foam::surfaceToPoint::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: surfaceToPoint.C:186