Loading...
Searching...
No Matches
faceZoneToCell.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-2023 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::faceZoneToCell
29
30Description
31 A \c topoSetCellSource to select cells based on \c front
32 or \c back side of given \c faceZone(s).
33
34 Operands:
35 \table
36 Operand | Type | Location
37 input | faceZone(s) | $FOAM_CASE/constant/polyMesh/faceZones
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 faceZoneToCell;
52 option <option>;
53
54 // Conditional mandatory entries
55 // Select one of the below
56
57 // Option-1
58 zones
59 (
60 <faceZoneName1>
61 <faceZoneName2>
62 ...
63 );
64
65 // Option-2
66 zone <faceZoneName>;
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Req'd | Dflt
73 name | Name of cellSet | word | yes | -
74 type | Type name: cellSet | word | yes | -
75 action | Action applied on cells - see below | word | yes | -
76 source | Source name: faceZoneToCell | word | yes | -
77 option | Selection type - see below | word | yes | -
78 \endtable
79
80 Options for the \c action entry:
81 \verbatim
82 new | Create a new cellSet from selected cells
83 add | Add selected cells into this cellSet
84 subtract | Remove selected cells from this cellSet
85 \endverbatim
86
87 Options for the \c option entry:
88 \verbatim
89 front | Cells on the front side of the faceZone (also as 'master')
90 back | Cells on the back side of the faceZone (also as 'slave')
91 both | Both front and back side of the faceZone
92 \endverbatim
93
94 Options for the conditional mandatory entries:
95 \verbatim
96 Entry | Description | Type | Req'd | Dflt
97 zones | Names of input faceZones | wordRes | cond'l | -
98 zone | Name of input faceZone | wordRe | cond'l | -
99 \endverbatim
100
101Note
102 The order of precedence among the conditional mandatory entries from the
103 highest to the lowest is \c zones, and \c zone.
104
105See also
106 - Foam::topoSetSource
107 - Foam::topoSetCellSource
108 - Foam::faceToCell
109
110SourceFiles
111 faceZoneToCell.C
112
113\*---------------------------------------------------------------------------*/
114
115#ifndef faceZoneToCell_H
116#define faceZoneToCell_H
117
118#include "topoSetCellSource.H"
119#include "wordRes.H"
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123namespace Foam
124{
125
126/*---------------------------------------------------------------------------*\
127 Class faceZoneToCell Declaration
128\*---------------------------------------------------------------------------*/
129
130class faceZoneToCell
131:
132 public topoSetCellSource
133{
134public:
135 //- Enumeration defining the valid options
136 enum faceAction
137 {
138 FRONT,
139 BACK,
140 BOTH,
141 // Compatibility
143 };
144
145
146private:
147
148 // Private Data
149
150 static const Enum<faceAction> faceActionNames_;
151
152 //- Add usage string
153 static addToUsageTable usage_;
154
155 //- Matcher for face zones
156 wordRes zoneMatcher_;
157
158 //- Selection type
159 faceAction option_;
160
161
162 // Private Member Functions
163
164 void combine
165 (
166 topoSet& set,
167 const labelUList& zoneIDs,
168 const bool add,
169 const bool verbosity
170 ) const;
171
172 void combine(topoSet& set, const bool add) const;
174
175public:
176
177 //- Runtime type information
178 TypeName("faceZoneToCell");
179
180
181 // Constructors
182
183 //- Construct from mesh, zones selector and selection option
186 const polyMesh& mesh,
187 const wordRes& zoneSelector,
188 const faceAction option
189 );
190
191 //- Construct from mesh, single zone selector and selection option
193 (
194 const polyMesh& mesh,
195 const wordRe& zoneName,
196 const faceAction option
197 );
198
199 //- Construct from dictionary
201
202 //- Construct from Istream
203 faceZoneToCell(const polyMesh& mesh, Istream& is);
204
205
206 //- Destructor
207 virtual ~faceZoneToCell() = default;
208
209
210 // Member Functions
211
212 //- Return the current zones selector
213 const wordRes& zones() const noexcept;
214
215 //- Define the zones selector
216 void zones(const wordRes& zoneSelector);
217
218 //- Define the zones selector with a single zone selector
219 void zones(const wordRe& zoneName);
220
221
222 virtual void applyToSet
223 (
224 const topoSetSource::setAction action,
225 topoSet& set
226 ) const;
227};
228
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232} // End namespace Foam
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
237
238// ************************************************************************* //
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 based on front or back side of given faceZone(s).
virtual ~faceZoneToCell()=default
Destructor.
faceZoneToCell(const polyMesh &mesh, const wordRes &zoneSelector, const faceAction option)
Construct from mesh, zones selector and selection option.
const wordRes & zones() const noexcept
Return the current zones selector.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
TypeName("faceZoneToCell")
Runtime type information.
faceAction
Enumeration defining the valid options.
@ BOTH
Both front and back side of faces.
@ FRONT
The front (positive normal) side of the faces.
@ BACK
The back (negative normal) side of the faces.
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.
Base class of a source for a topoSet.
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 wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition wordRe.H:81
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
const labelIOList & zoneIDs
Definition correctPhi.H:59
Namespace for OpenFOAM.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
const direction noexcept
Definition scalarImpl.H:265
UList< label > labelUList
A UList of labels.
Definition UList.H:75
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68