zoneToPoint.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-2021 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::zoneToPoint
29
30Description
31 A \c topoSetPointSource to convert \c pointZone(s) to a \c pointSet.
32
33 Operands:
34 \table
35 Operand | Type | Location
36 input | pointZone(s) | $FOAM_CASE/constant/polyMesh/pointZones
37 output | pointSet | $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 pointSet;
47 action <action>;
48
49 // Mandatory entries
50 source zoneToPoint;
51
52 // Conditional mandatory entries
53 // Select either of the below
54
55 // Option-1
56 zones
57 (
58 <pointZoneName0>
59 <pointZoneName1>
60 ...
61 );
62
63 // Option-2
64 zone <pointZoneName>;
65 }
66 \endverbatim
67
68 where the entries mean:
69 \table
70 Property | Description | Type | Req'd | Dflt
71 name | Name of pointSet | word | yes | -
72 type | Type name: pointSet | word | yes | -
73 action | Action applied on points - see below | word | yes | -
74 source | Source name: zoneToPoint | word | yes | -
75 \endtable
76
77 Options for the \c action entry:
78 \verbatim
79 new | Create a new pointSet from selected points
80 add | Add selected points into this pointSet
81 subtract | Remove selected points from this pointSet
82 \endverbatim
83
84 Options for the conditional mandatory entries:
85 \verbatim
86 Entry | Description | Type | Req'd | Dflt
87 zones | Names of input pointZones | wordRes | cond'l | -
88 zone | Name of input pointZone | wordRe | cond'l | -
89 \endverbatim
90
91Note
92 The order of precedence among the conditional mandatory entries from the
93 highest to the lowest is \c zones, and \c zone.
94
95See also
96 - Foam::topoSetSource
97 - Foam::topoSetPointSource
98
99SourceFiles
100 zoneToPoint.C
101
102\*---------------------------------------------------------------------------*/
103
104#ifndef zoneToPoint_H
105#define zoneToPoint_H
106
107#include "topoSetPointSource.H"
108#include "wordRes.H"
109
110// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111
112namespace Foam
113{
114
115/*---------------------------------------------------------------------------*\
116 Class zoneToPoint Declaration
117\*---------------------------------------------------------------------------*/
118
119class zoneToPoint
120:
121 public topoSetPointSource
122{
123 // Private Data
124
125 //- Add usage string
126 static addToUsageTable usage_;
127
128 //- Matcher for zones
129 wordRes zoneMatcher_;
130
131 //- Explicitly specified zone ids
132 labelList zoneIDs_;
133
134
135 // Private Member Functions
136
137 void combine
138 (
139 topoSet& set,
140 const labelUList& zoneIDs,
141 const bool add,
142 const bool verbosity
143 ) const;
144
145 void combine(topoSet& set, const bool add) const;
146
147
148public:
149
150 //- Runtime type information
151 TypeName("zoneToPoint");
152
153
154 // Constructors
155
156 //- Construct from mesh and zones selector
157 zoneToPoint(const polyMesh& mesh, const wordRes& zoneSelector);
158
159 //- Construct from mesh and single zone selector
160 zoneToPoint(const polyMesh& mesh, const wordRe& zoneName);
161
162 //- Construct from mesh and specified zone IDs
164
165 //- Construct from dictionary
166 zoneToPoint(const polyMesh& mesh, const dictionary& dict);
167
168 //- Construct from Istream
169 zoneToPoint(const polyMesh& mesh, Istream& is);
170
171
172 //- Destructor
173 virtual ~zoneToPoint() = default;
174
175
176 // Member Functions
177
178 //- Return the current zones selector
179 const wordRes& zones() const noexcept;
180
181 //- Define the zones selector
182 void zones(const wordRes& zoneSelector);
183
184 //- Define the zones selector with a single zone selector
185 void zones(const wordRe& zoneName);
186
187 //- Define the pointZone IDs to use (must exist).
188 // Clears the zone name matcher
189 void zones(const labelUList& zoneIDs);
190
191 //- Define the pointZone ID to use (must exist).
192 // Clears the zone name matcher
193 void zones(const label zoneID);
194
195
196 virtual void applyToSet
197 (
198 const topoSetSource::setAction action,
199 topoSet& set
200 ) const;
201};
202
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206} // End namespace Foam
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210#endif
211
212// ************************************************************************* //
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
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetPointSource is a intermediate class for handling topoSet sources for selecting points.
Class with constructor to add usage string to table.
Base class of a source for a topoSet.
Definition: topoSetSource.H:68
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 wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:83
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:54
A topoSetPointSource to convert pointZone(s) to a pointSet.
Definition: zoneToPoint.H:163
TypeName("zoneToPoint")
Runtime type information.
zoneToPoint(const polyMesh &mesh, const wordRes &zoneSelector)
Construct from mesh and zones selector.
Definition: zoneToPoint.C:146
virtual ~zoneToPoint()=default
Destructor.
const wordRes & zones() const noexcept
Return the current zones selector.
Definition: zoneToPoint.C:210
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: zoneToPoint.C:247
const labelIOList & zoneIDs
Definition: correctPhi.H:59
const labelIOList & zoneID
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
Definition: ListListOps.C:69
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
const direction noexcept
Definition: Scalar.H:223
UList< label > labelUList
A UList of labels.
Definition: UList.H:85
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73