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-2020 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) | $FOAM_CASE/constant/polyMesh/sets/<set>
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 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 | Req'd | Dflt
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  \endverbatim
91 
92  Options for the conditional mandatory entries:
93  \verbatim
94  Entry | Description | Type | Req'd | Dflt
95  sets | Names of input cellSets | wordList | cond'l | -
96  set | Name of input cellSet | word | cond'l | -
97  \endverbatm
98 
99 Note
100  The order of precedence among the conditional mandatory entries from the
101  highest to the lowest is \c sets, and \c set.
102 
103 See also
104  - Foam::topoSetSource
105  - Foam::topoSetFaceSource
106 
107 SourceFiles
108  cellToFace.C
109 
110 \*---------------------------------------------------------------------------*/
111 
112 #ifndef cellToFace_H
113 #define cellToFace_H
114 
115 #include "topoSetFaceSource.H"
116 #include "Enum.H"
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 namespace Foam
121 {
122 
123 /*---------------------------------------------------------------------------*\
124  Class cellToFace Declaration
125 \*---------------------------------------------------------------------------*/
126 
127 class cellToFace
128 :
129  public topoSetFaceSource
130 {
131 public:
132  //- Enumeration defining the valid options
133  enum cellAction
134  {
135  ALL,
136  BOTH
137  };
138 
139 
140 private:
141 
142  // Private Data
143 
144  //- Add usage string
145  static addToUsageTable usage_;
146 
147  static const Enum<cellAction> cellActionNames_;
148 
149  //- Names of cellSets to use
150  wordList names_;
151 
152  //- Selection type
153  cellAction option_;
154 
155 
156  // Private Member Functions
157 
158  //- Depending on face to cell option add to or delete from cellSet.
159  void combine(topoSet& set, const bool add, const word& setName) const;
160 
161 
162 public:
163 
164  //- Runtime type information
165  TypeName("cellToFace");
166 
167 
168  // Constructors
169 
170  //- Construct from components
171  cellToFace
172  (
173  const polyMesh& mesh,
174  const word& setName,
175  const cellAction option
176  );
177 
178  //- Construct from dictionary
179  cellToFace(const polyMesh& mesh, const dictionary& dict);
180 
181  //- Construct from Istream
182  cellToFace(const polyMesh& mesh, Istream& is);
183 
184 
185  //- Destructor
186  virtual ~cellToFace() = default;
187 
188 
189  // Member Functions
190 
191  virtual void applyToSet
192  (
193  const topoSetSource::setAction action,
194  topoSet& set
195  ) const;
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
TypeName
#define TypeName(TypeNameString)
Definition: typeInfo.H:71
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Definition: BitOps.C:30
Foam::topoSetSource::setAction
setAction
Definition: topoSetSource.H:96
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:58
Foam::ListListOps::combine
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Definition: ListListOps.C:62
dict
dictionary dict
Definition: searchingEngine.H:14
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:932
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Definition: atmBoundaryLayer.C:26
topoSetFaceSource.H
Enum.H