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