zoneToFace.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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::zoneToFace
29 
30 Description
31  A \c topoSetFaceSource to convert \c faceZone(s) to a \c faceSet.
32 
33  Operands:
34  \table
35  Operand | Type | Location
36  input | faceZone(s) | $FOAM_CASE/constant/polyMesh/faceZones
37  output | faceSet | $FOAM_CASE/constant/polyMesh/sets/<set>
38  \endtable
39 
40 Usage
41  Minimal example by using \c system/topoSetDict.actions:
42  \verbatim
43  {
44  // Mandatory (inherited) entries
45  name <name>;
46  type faceSet;
47  action <action>;
48 
49  // Mandatory entries
50  source zoneToFace;
51 
52  // Conditional mandatory entries
53  // Select either of the below
54 
55  // Option-1
56  zones
57  (
58  <faceZoneName0>
59  <faceZoneName1>
60  ...
61  );
62 
63  // Option-2
64  zone <faceZoneName>;
65  }
66  \endverbatim
67 
68  where the entries mean:
69  \table
70  Property | Description | Type | Req'd | Dflt
71  name | Name of faceSet | word | yes | -
72  type | Type name: faceSet | word | yes | -
73  action | Action applied on faces - see below | word | yes | -
74  source | Source name: zoneToFace | word | yes | -
75  \endtable
76 
77  Options for the \c action entry:
78  \verbatim
79  new | Create a new faceSet from selected faces
80  add | Add selected faces into this faceSet
81  subtract | Remove selected faces from this faceSet
82  \endverbatim
83 
84  Options for the conditional mandatory entries:
85  \verbatim
86  Entry | Description | Type | Req'd | Dflt
87  zones | Names of input faceZones | wordRes | cond'l | -
88  zone | Name of input faceZone | wordRe | cond'l | -
89  \endverbatim
90 
91 Note
92  The order of precedence among the conditional mandatory entries from the
93  highest to the lowest is \c zones, and \c zone.
94 
95 See also
96  - Foam::topoSetSource
97  - Foam::topoSetFaceSource
98 
99 SourceFiles
100  zoneToFace.C
101 
102 \*---------------------------------------------------------------------------*/
103 
104 #ifndef zoneToFace_H
105 #define zoneToFace_H
106 
107 #include "topoSetFaceSource.H"
108 #include "wordRes.H"
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 namespace Foam
113 {
114 
115 /*---------------------------------------------------------------------------*\
116  Class zoneToFace Declaration
117 \*---------------------------------------------------------------------------*/
118 
119 class zoneToFace
120 :
121  public topoSetFaceSource
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 
136  // Private Member Functions
137 
138  void combine
139  (
140  topoSet& set,
141  const labelUList& zoneIDs,
142  const bool add,
143  const bool verbosity
144  ) const;
145 
146  void combine(topoSet& set, const bool add) const;
147 
148 
149 public:
150 
151  //- Runtime type information
152  TypeName("zoneToFace");
153 
154 
155  // Constructors
156 
157  //- Construct from mesh and zones selector
158  zoneToFace(const polyMesh& mesh, const wordRes& zoneSelector);
159 
160  //- Construct from mesh and single zone selector
161  zoneToFace(const polyMesh& mesh, const wordRe& zoneName);
162 
163  //- Construct from mesh and specified zone IDs
164  zoneToFace(const polyMesh& mesh, const labelUList& zoneIDs);
165 
166  //- Construct from dictionary
167  zoneToFace(const polyMesh& mesh, const dictionary& dict);
168 
169  //- Construct from Istream
170  zoneToFace(const polyMesh& mesh, Istream& is);
171 
172 
173  //- Destructor
174  virtual ~zoneToFace() = default;
175 
176 
177  // Member Functions
178 
179  //- Return the current zones selector
180  const wordRes& zones() const noexcept;
181 
182  //- Define the zones selector
183  void zones(const wordRes& zoneSelector);
184 
185  //- Define the zones selector with a single zone selector
186  void zones(const wordRe& zoneName);
187 
188  //- Define the faceZone IDs to use (must exist).
189  // Clears the zone name matcher
190  void zones(const labelUList& zoneIDs);
191 
192  //- Define the faceZone ID to use (must exist).
193  // Clears the zone name matcher
194  void zones(const label zoneID);
195 
196 
197  virtual void applyToSet
198  (
199  const topoSetSource::setAction action,
200  topoSet& set
201  ) const;
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
wordRes.H
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::zoneToFace::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: zoneToFace.C:247
Foam::zoneToFace::zones
const wordRes & zones() const noexcept
Return the current zones selector.
Definition: zoneToFace.C:210
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::topoSetFaceSource
The topoSetFaceSource is a intermediate class for handling topoSet sources for selecting faces.
Definition: topoSetFaceSource.H:54
Foam::wordRe
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:80
zoneIDs
const labelIOList & zoneIDs
Definition: correctPhi.H:59
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::zoneToFace
A topoSetFaceSource to convert faceZone(s) to a faceSet.
Definition: zoneToFace.H:160
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
zoneID
const labelIOList & zoneID
Definition: interpolatedFaces.H:22
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::topoSetSource
Base class of a source for a topoSet.
Definition: topoSetSource.H:67
Foam::zoneToFace::TypeName
TypeName("zoneToFace")
Runtime type information.
Foam::List< label >
Foam::UList< label >
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::zoneToFace::zoneToFace
zoneToFace(const polyMesh &mesh, const wordRes &zoneSelector)
Construct from mesh and zones selector.
Definition: zoneToFace.C:146
topoSetFaceSource.H
Foam::labelUList
UList< label > labelUList
A UList of labels.
Definition: UList.H:85
Foam::zoneToFace::~zoneToFace
virtual ~zoneToFace()=default
Destructor.