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-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::faceZoneToCell
29
30Description
31 A \c topoSetCellSource to select cells based on \c master
32 or \c slave 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 either of the below
56
57 // Option-1
58 zones
59 (
60 <faceZoneName1>
61 <faceZoneName2>
62 ...
63 );
64
65 // Option-2
66 set <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 master | Master side of the faceZone
90 slave | Slave side of the faceZone
91 \endverbatim
92
93 Options for the conditional mandatory entries:
94 \verbatim
95 Entry | Description | Type | Req'd | Dflt
96 zones | Names of input faceZones | wordRes | cond'l | -
97 zone | Name of input faceZone | wordRe | cond'l | -
98 \endverbatim
99
100Note
101 The order of precedence among the conditional mandatory entries from the
102 highest to the lowest is \c zones, and \c zone.
103
104See also
105 - Foam::topoSetSource
106 - Foam::topoSetCellSource
107 - Foam::faceToCell
108
109SourceFiles
110 faceZoneToCell.C
111
112\*---------------------------------------------------------------------------*/
113
114#ifndef faceZoneToCell_H
115#define faceZoneToCell_H
116
117#include "topoSetCellSource.H"
118#include "wordRes.H"
119
120// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121
122namespace Foam
123{
124
125/*---------------------------------------------------------------------------*\
126 Class faceZoneToCell Declaration
127\*---------------------------------------------------------------------------*/
128
129class faceZoneToCell
130:
131 public topoSetCellSource
132{
133public:
134 //- Enumeration defining the valid options
135 enum faceAction
136 {
137 MASTER,
138 SLAVE
139 };
140
141
142private:
143
144 // Private Data
145
146 static const Enum<faceAction> faceActionNames_;
147
148 //- Add usage string
149 static addToUsageTable usage_;
150
151 //- Matcher for face zones
152 wordRes zoneMatcher_;
153
154 //- Selection type
155 faceAction option_;
156
157
158 // Private Member Functions
159
160 void combine
161 (
162 topoSet& set,
163 const labelUList& zoneIDs,
164 const bool add,
165 const bool verbosity
166 ) const;
167
168 void combine(topoSet& set, const bool add) const;
169
170
171public:
172
173 //- Runtime type information
174 TypeName("faceZoneToCell");
175
177 // Constructors
178
179 //- Construct from mesh, zones selector and selection option
181 (
183 const wordRes& zoneSelector,
184 const faceAction option
185 );
187 //- Construct from mesh, single zone selector and selection option
189 (
190 const polyMesh& mesh,
191 const wordRe& zoneName,
192 const faceAction option
193 );
194
195 //- Construct from dictionary
197
198 //- Construct from Istream
199 faceZoneToCell(const polyMesh& mesh, Istream& is);
200
201
202 //- Destructor
203 virtual ~faceZoneToCell() = default;
204
205
206 // Member Functions
207
208 //- Return the current zones selector
209 const wordRes& zones() const noexcept;
210
211 //- Define the zones selector
212 void zones(const wordRes& zoneSelector);
213
214 //- Define the zones selector with a single zone selector
215 void zones(const wordRe& zoneName);
216
217
218 virtual void applyToSet
219 (
220 const topoSetSource::setAction action,
222 ) const;
223};
224
225
226// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227
228} // End namespace Foam
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232#endif
233
234// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
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 topoSetCellSource to select cells based on master or slave side of given faceZone(s).
virtual ~faceZoneToCell()=default
Destructor.
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.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
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
const labelIOList & zoneIDs
Definition: correctPhi.H:59
Namespace for OpenFOAM.
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