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 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 either of the below
56 
57  // Option-1
58  sets
59  (
60  <word>
61  <word>
62  ...
63  );
64 
65  // Option-2
66  set <word>;
67 
68  // Optional entries
69  flip <bool>;
70  }
71  \endverbatim
72 
73  where the entries mean:
74  \table
75  Property | Description | Type | Reqd | Deflt
76  name | Name of faceZone | word | yes | -
77  type | Type name: faceZoneSet | word | yes | -
78  action | Action applied on faces - see below | word | yes | -
79  source | Source name: cellToFaceZone | word | yes | -
80  set(s) | Name of input cellSet(s) containing the slave cells <!--
81  --> | word | yes | -
82  flip | Flag to select master/slave cells | bool | no | false
83  \endtable
84 
85  Options for the \c action entry:
86  \verbatim
87  new | Create a new faceZone from selected faces
88  add | Add selected faces of a faceZoneSet into this faceZone
89  subtract | Remove selected faces of a faceZoneSet from this faceZone
90  \endverbatim
91 
92 Notes
93  - \c flip=true sets the orientation of faces
94  pointing into the \c cellSet, and vice versa.
95 
96 SourceFiles
97  cellToFaceZone.C
98 
99 \*---------------------------------------------------------------------------*/
100 
101 #ifndef Foam_cellToFaceZone_H
102 #define Foam_cellToFaceZone_H
103 
104 #include "topoSetFaceZoneSource.H"
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 namespace Foam
109 {
110 
111 // Forward Declarations
112 class cellSet;
113 
114 /*---------------------------------------------------------------------------*\
115  Class cellToFaceZone Declaration
116 \*---------------------------------------------------------------------------*/
117 
118 class cellToFaceZone
119 :
120  public topoSetFaceZoneSource
121 {
122  // Private Data
123 
124  //- Add usage string
125  static addToUsageTable usage_;
126 
127  //- Names of cellSets to use
128  wordList names_;
129 
130  //- Whether cellSet is slave cells or master cells
131  const bool flip_;
132 
133 
134  // Private Member Functions
135 
136  //- Select outside faces of cellSet
137  void selectFaces
138  (
139  const cellSet& cSet,
140  bitSet& selectedFace,
141  bitSet& doFlip
142  ) const;
143 
144 
145 public:
146 
147  //- Runtime type information
148  TypeName("cellToFaceZone");
149 
150 
151  // Constructors
152 
153  //- Construct from components
155  (
156  const polyMesh& mesh,
157  const word& cellSetName,
158  const bool flip
159  );
160 
161  //- Construct from dictionary
162  cellToFaceZone(const polyMesh& mesh, const dictionary& dict);
163 
164  //- Construct from Istream
165  cellToFaceZone(const polyMesh& mesh, Istream& is);
166 
167 
168  //- Destructor
169  virtual ~cellToFaceZone() = default;
170 
171 
172  // Member Functions
173 
174  virtual void applyToSet
175  (
176  const topoSetSource::setAction action,
177  topoSet& set
178  ) const;
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
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.