Loading...
Searching...
No Matches
cellToPoint.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,2024 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::cellToPoint
29
30Description
31 A \c topoSetPointSource to select all the points from given \c cellSet(s).
32
33 Operands:
34 \table
35 Operand | Type | Location
36 input | cellSet(s) | $FOAM_CASE/constant/polyMesh/sets/<set>
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 cellToPoint;
51 option <option>;
52
53 // Conditional mandatory entries
54 // Select one of the below
55
56 // Option-1
57 sets
58 (
59 <pointSetName1>
60 <pointSetName2>
61 ...
62 );
63
64 // Option-2
65 zones
66 (
67 <pointZoneName0>
68 <pointZoneName1>
69 ...
70 );
71
72 // Option-3
73 set <pointSetName>;
74
75 // Option-4
76 zone <pointZoneName>;
77 }
78 \endverbatim
79
80 where the entries mean:
81 \table
82 Property | Description | Type | Req'd | Dflt
83 name | Name of pointSet | word | yes | -
84 type | Type name: pointSet | word | yes | -
85 action | Action applied on points - see below | word | yes | -
86 source | Source name: cellToPoint | word | yes | -
87 option | Selection type - see below | word | yes | -
88 \endtable
89
90 Options for the \c action entry:
91 \verbatim
92 new | Create a new pointSet from selected points
93 add | Add selected points into this pointSet
94 subtract | Remove selected points from this pointSet
95 \endverbatim
96
97 Options for the \c option entry:
98 \verbatim
99 all | Select all points of cells in the cellSet
100 \endverbatim
101
102 Options for the conditional mandatory entries (in order of precedence):
103 \verbatim
104 Entry | Description | Type | Reqd | Deflt
105 sets | Names of input cellSets | wordList | choice | -
106 zones | Names of input cellZones | wordList | cond'l | -
107 set | Name of input cellSet | word | choice | -
108 zone | Name of input cellZone | word | cond'l | -
109 \endverbatim
110
111See also
112 - Foam::topoSetSource
113 - Foam::topoSetPointSource
114
115SourceFiles
116 cellToPoint.C
117
118\*---------------------------------------------------------------------------*/
119
120#ifndef cellToPoint_H
121#define cellToPoint_H
122
123#include "topoSetPointSource.H"
124#include "Enum.H"
125
126// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127
128namespace Foam
129{
130
131/*---------------------------------------------------------------------------*\
132 Class cellToPoint Declaration
133\*---------------------------------------------------------------------------*/
134
135class cellToPoint
136:
137 public topoSetPointSource
138{
139
140public:
141 //- Enumeration defining the valid options
142 enum cellAction
143 {
144 ALL
145 };
146
147
148private:
149
150 // Private Data
151
152 //- Add usage string
153 static addToUsageTable usage_;
154
155 static const Enum<cellAction> cellActionNames_;
156
157 //- Names of sets or zones to use
158 wordList names_;
159
160 //- Is name a set or a zone
161 const bool isZone_;
162
163 //- Option
164 cellAction option_;
165
166
167 // Private Member Functions
168
169 //- Depending on cell to point option add to or delete from pointSet.
170 template<class Selector>
171 void combineImpl
172 (
173 topoSet& set,
174 const bool add,
175 const Selector& cellLabels
176 ) const;
177
178 void combine(topoSet& set, const bool add, const word& setName) const;
179
180
181public:
182
183 //- Runtime type information
184 TypeName("cellToPoint");
185
186
187 // Constructors
188
189 //- Construct from components
191 (
192 const polyMesh& mesh,
193 const word& setName,
194 const cellAction option
195 );
196
197 //- Construct from dictionary
198 cellToPoint(const polyMesh& mesh, const dictionary& dict);
199
200 //- Construct from Istream
201 cellToPoint(const polyMesh& mesh, Istream& is);
202
203
204 //- Destructor
205 virtual ~cellToPoint() = default;
206
207
208 // Member Functions
209
210 virtual void applyToSet
211 (
212 const topoSetSource::setAction action,
213 topoSet& set
214 ) const;
215};
216
217
218// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219
220} // End namespace Foam
221
222// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223
224#endif
225
226// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A topoSetPointSource to select all the points from given cellSet(s).
TypeName("cellToPoint")
Runtime type information.
virtual ~cellToPoint()=default
Destructor.
cellToPoint(const polyMesh &mesh, const word &setName, const cellAction option)
Construct from components.
cellAction
Enumeration defining the valid options.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
The topoSetPointSource is a intermediate class for handling topoSet sources for selecting points.
topoSetPointSource(const polyMesh &mesh)
Construct from mesh.
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:63
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68