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-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::surfaceToPoint
29
30Description
31 A \c topoSetPointSource to select points based on
32 relation to a surface given by an external file.
33
34 \c surfaceToPoint can select based on:
35 - distance to surface
36 - inside/outside status to surface
37 (Uses normal of nearest surface triangle so requires valid surface
38 topology.)
39
40 Operands:
41 \table
42 Operand | Type | Location
43 input | triSurface | $FOAM_CASE/constant/triSurface/<file>
44 output | pointSet | $FOAM_CASE/constant/polyMesh/sets/<set>
45 \endtable
46
47Usage
48 Minimal example by using \c system/topoSetDict.actions:
49 \verbatim
50 {
51 // Mandatory (inherited) entries
52 name <name>;
53 type pointSet;
54 action <action>;
55
56 // Mandatory entries
57 source surfaceToPoint;
58 file <surfaceFileName>;
59 includeInside false;
60 includeOutside true;
61 nearDistance 0.5;
62
63 // Optional entries
64 fileType stl;
65 scale 2.0;
66 }
67 \endverbatim
68
69 where the entries mean:
70 \table
71 Property | Description | Type | Req'd | Dflt
72 name | Name of pointSet | word | yes | -
73 type | Type name: pointSet | word | yes | -
74 action | Action applied on points - see below | word | yes | -
75 source | Source name: surfaceToPoint | word | yes | -
76 file | The surface "filename" | word | yes | -
77 fileType | The format of the surface file | word | no | ""
78 nearDistance | Near distance to the surface | scalar | yes | -
79 includeInside | Flag to include inside cells | bool | yes | -
80 includeOutside | Flag to include outside cells | bool | yes | -
81 scale | Surface scaling factor | scalar | no | -1
82 \endtable
83
84 Options for the \c action entry:
85 \verbatim
86 new | Create a new pointSet from selected points
87 add | Add selected points into this pointSet
88 subtract | Remove selected points from this pointSet
89 \endverbatim
90
91See also
92 - Foam::topoSetSource
93 - Foam::topoSetPointSource
94
95SourceFiles
96 surfaceToPoint.C
97
98\*---------------------------------------------------------------------------*/
99
100#ifndef surfaceToPoint_H
101#define surfaceToPoint_H
102
103#include "topoSetPointSource.H"
104
105// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106
107namespace Foam
108{
109
110/*---------------------------------------------------------------------------*\
111 Class surfaceToPoint Declaration
112\*---------------------------------------------------------------------------*/
113
114class surfaceToPoint
115:
116 public topoSetPointSource
117{
118 // Private Data
119
120 //- Add usage string
121 static addToUsageTable usage_;
122
123 //- Name of surface file
124 const fileName surfName_;
125
126 //- Surface file type (optional)
127 const word surfType_;
128
129 //- Surface scaling factor (optional)
130 const scalar scale_;
131
132 //- If > 0 : include points with distance to surface less than nearDist.
133 const scalar nearDist_;
134
135 //- Include all points on opposite sign of normal on nearest surface.
136 const bool includeInside_;
137
138 //- Include all points on this sign of normal on nearest surface.
139 const bool includeOutside_;
140
141
142 // Private Member Functions
143
144 //- Depending on surface add to or delete from pointSet.
145 void combine(topoSet& set, const bool add) const;
146
147 //- Check settings at construction time.
148 void checkSettings() const;
149
150
151public:
152
153 //- Runtime type information
154 TypeName("surfaceToPoint");
155
156
157 // Constructors
158
159 //- Construct from components
161 (
162 const polyMesh& mesh,
163 const fileName& surfName,
164 const scalar nearDist,
165 const bool includeInside,
166 const bool includeOutside
167 );
168
169 //- Construct from dictionary
170 surfaceToPoint(const polyMesh& mesh, const dictionary& dict);
171
172 //- Construct from Istream
173 surfaceToPoint(const polyMesh& mesh, Istream& is);
174
175
176 //- Destructor
177 virtual ~surfaceToPoint() = default;
178
179
180 // Member Functions
181
182 virtual void applyToSet
183 (
184 const topoSetSource::setAction action,
185 topoSet& set
186 ) const;
187};
188
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192} // End namespace Foam
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196#endif
197
198// ************************************************************************* //
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 class for handling file names.
Definition: fileName.H:76
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A topoSetPointSource to select points based on relation to a surface given by an external file.
TypeName("surfaceToPoint")
Runtime type information.
virtual ~surfaceToPoint()=default
Destructor.
surfaceToPoint(const polyMesh &mesh, const fileName &surfName, const scalar nearDist, const bool includeInside, const bool includeOutside)
Construct from components.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
The topoSetPointSource is a intermediate class for handling topoSet sources for selecting points.
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 class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73