cellToFaceZone.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) 2022-2024 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::cellToFaceZone
28 
29 Description
30  A \c topoSetSource to select faces with only one
31  neighbour (i.e. outside) in a specified \c cellSet.
32 
33  This is just a shortcut for
34  - extracting outside faces as a \c faceSet (\c cellToFace with \c outside).
35  - using \c setsToFaceZone to convert \c faceSet
36  and \c cellSet to oriented \c faceZone.
37 
38  Operands:
39  \table
40  Operand | Type | Location
41  input | cellSet(s) | constant/polyMesh/sets/<set>
42  output | faceZone | constant/polyMesh/faceZones
43  \endtable
44 
45 Usage
46  Minimal example by using \c system/topoSetDict.actions:
47  \verbatim
48  {
49  // Mandatory entries
50  name <name>;
51  type faceZoneSet;
52  action <action>;
53  source cellToFaceZone;
54 
55  // Select one of the below
56 
57  // Option-1
58  sets
59  (
60  <word>
61  <word>
62  ...
63  );
64 
65  // Option-2
66  zones
67  (
68  <cellZoneName0>
69  <cellZoneName1>
70  ...
71  );
72 
73  // Option-3
74  set <cellSetName>;
75 
76  // Option-4
77  zone <cellZoneName>;
78 
79  // Optional entries
80  flip <bool>;
81  }
82  \endverbatim
83 
84  where the entries mean:
85  \table
86  Property | Description | Type | Reqd | Deflt
87  name | Name of faceZone | word | yes | -
88  type | Type name: faceZoneSet | word | yes | -
89  action | Action applied on faces - see below | word | yes | -
90  source | Source name: cellToFaceZone | word | yes | -
91  set(s) | Name of input cellSet(s) containing the slave cells <!--
92  --> | word | yes | -
93  flip | Flag to select master/slave cells | bool | no | false
94  \endtable
95 
96  Options for the \c action entry:
97  \verbatim
98  new | Create a new faceZone from selected faces
99  add | Add selected faces of a faceZoneSet into this faceZone
100  subtract | Remove selected faces of a faceZoneSet from this faceZone
101  \endverbatim
102 
103  Options for the conditional mandatory entries (in order of precedence):
104  \verbatim
105  Entry | Description | Type | Reqd | Deflt
106  sets | Names of input cellSets | wordList | choice | -
107  zones | Names of input cellZones | wordList | cond'l | -
108  set | Name of input cellSet | word | choice | -
109  zone | Name of input cellZone | word | cond'l | -
110  \endverbatim
111 
112 Notes
113  - \c flip=true sets the orientation of faces
114  pointing into the \c cellSet, and vice versa.
115 
116 SourceFiles
117  cellToFaceZone.C
118 
119 \*---------------------------------------------------------------------------*/
120 
121 #ifndef Foam_cellToFaceZone_H
122 #define Foam_cellToFaceZone_H
123 
124 #include "topoSetFaceZoneSource.H"
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 namespace Foam
129 {
130 
131 // Forward Declarations
132 class cellSet;
133 
134 /*---------------------------------------------------------------------------*\
135  Class cellToFaceZone Declaration
136 \*---------------------------------------------------------------------------*/
137 
138 class cellToFaceZone
139 :
140  public topoSetFaceZoneSource
141 {
142  // Private Data
143 
144  //- Add usage string
145  static addToUsageTable usage_;
146 
147  //- Names of sets or zones to use
148  wordList names_;
149 
150  //- Is name a set or a zone
151  const bool isZone_;
152 
153  //- Whether cellSet is slave cells or master cells
154  const bool flip_;
155 
156 
157  // Private Member Functions
158 
159  //- Select outside faces of cellSet
160  void selectFaces
161  (
162  const bitSet& cSet,
163  bitSet& selectedFace,
164  bitSet& doFlip
165  ) const;
166 
167 
168 public:
169 
170  //- Runtime type information
171  TypeName("cellToFaceZone");
172 
173 
174  // Constructors
175 
176  //- Construct from components
178  (
179  const polyMesh& mesh,
180  const word& cellSetName,
181  const bool flip
182  );
183 
184  //- Construct from dictionary
185  cellToFaceZone(const polyMesh& mesh, const dictionary& dict);
186 
187  //- Construct from Istream
188  cellToFaceZone(const polyMesh& mesh, Istream& is);
190 
191  //- Destructor
192  virtual ~cellToFaceZone() = default;
193 
194 
195  // Member Functions
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 // ************************************************************************* //
dictionary dict
virtual ~cellToFaceZone()=default
Destructor.
TypeName("cellToFaceZone")
Runtime type information.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
const polyMesh & mesh() const noexcept
Reference to the mesh.
setAction
Enumeration defining various actions.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
List< word > wordList
List of word.
Definition: fileName.H:59
cellToFaceZone(const polyMesh &mesh, const word &cellSetName, const bool flip)
Construct from components.
Namespace for OpenFOAM.