cellToFace.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-2022 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::cellToFace
29 
30 Description
31  A \c topoSetFaceSource to select all the faces from given \c cellSet(s).
32 
33  Operands:
34  \table
35  Operand | Type | Location
36  input | cellSet(s) | constant/polyMesh/sets/<set>
37  output | faceSet | 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 cellToFace;
51  option <option>;
52 
53  // Conditional mandatory entries
54  // Select either of the below
55 
56  // Option-1
57  sets
58  (
59  <cellSetName1>
60  <cellSetName2>
61  ...
62  );
63 
64  // Option-2
65  set <cellSetName>;
66  }
67  \endverbatim
68 
69  where the entries mean:
70  \table
71  Property | Description | Type | Reqd | Deflt
72  name | Name of faceSet | word | yes | -
73  type | Type name: faceSet | word | yes | -
74  action | Action applied on faces - see below | word | yes | -
75  source | Source name: cellToFace | word | yes | -
76  option | Selection type - see below | word | yes | -
77  \endtable
78 
79  Options for the \c action entry:
80  \verbatim
81  new | Create a new faceSet from selected cells of cellSet(s)
82  add | Add selected faces of cellSet(s) into this faceSet
83  subtract | Remove selected faces of cellSet(s) from this faceSet
84  \endverbatim
85 
86  Options for the \c option entry:
87  \verbatim
88  all | All faces of cells in the cellSet
89  both | Faces where both neighbours are in the cellSet
90  outside | Faces with only one neighbour in the cellSet
91  \endverbatim
92 
93  Options for the conditional mandatory entries:
94  \verbatim
95  Entry | Description | Type | Reqd | Deflt
96  sets | Names of input cellSets | wordList | choice | -
97  set | Name of input cellSet | word | choice | -
98  \endverbatim
99 
100 Note
101  - The order of precedence among the conditional mandatory entries from the
102  highest to the lowest is \c sets, and \c set.
103  - The \c outside option applies to the cellSets individually.
104 
105 See also
106  - Foam::topoSetSource
107  - Foam::topoSetFaceSource
108 
109 SourceFiles
110  cellToFace.C
111 
112 \*---------------------------------------------------------------------------*/
113 
114 #ifndef Foam_cellToFace_H
115 #define Foam_cellToFace_H
116 
117 #include "topoSetFaceSource.H"
118 #include "Enum.H"
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 namespace Foam
123 {
124 
125 /*---------------------------------------------------------------------------*\
126  Class cellToFace Declaration
127 \*---------------------------------------------------------------------------*/
128 
129 class cellToFace
130 :
131  public topoSetFaceSource
132 {
133 public:
134  //- Enumeration defining the valid options
135  enum cellAction
136  {
137  ALL,
138  BOTH,
139  OUTSIDE
140  };
141 
142 
143 private:
144 
145  // Private Data
146 
147  //- Add usage string
148  static addToUsageTable usage_;
149 
150  static const Enum<cellAction> cellActionNames_;
151 
152  //- Names of cellSets to use
153  wordList names_;
154 
155  //- Selection type
156  cellAction option_;
157 
158 
159  // Private Member Functions
160 
161  //- Depending on face to cell option add to or delete from cellSet.
162  void combine(topoSet& set, const bool add, const word& setName) const;
163 
164 
165 public:
166 
167  //- Runtime type information
168  TypeName("cellToFace");
169 
170 
171  // Constructors
173  //- Construct from components
174  cellToFace
175  (
176  const polyMesh& mesh,
177  const word& setName,
178  const cellAction option
179  );
181  //- Construct from dictionary
184  //- Construct from Istream
185  cellToFace(const polyMesh& mesh, Istream& is);
186 
187 
188  //- Destructor
189  virtual ~cellToFace() = default;
190 
191 
192  // Member Functions
193 
194  virtual void applyToSet
195  (
196  const topoSetSource::setAction action,
197  topoSet& set
198  ) const;
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
cellAction
Enumeration defining the valid options.
Definition: cellToFace.H:180
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual ~cellToFace()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition: word.H:63
const polyMesh & mesh() const noexcept
Reference to the mesh.
setAction
Enumeration defining various actions.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: cellToFace.C:257
cellToFace(const polyMesh &mesh, const word &setName, const cellAction option)
Construct from components.
Definition: cellToFace.C:211
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
List< word > wordList
List of word.
Definition: fileName.H:59
TypeName("cellToFace")
Runtime type information.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.