faceZoneToCell.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::faceZoneToCell
29 
30 Description
31  A \c topoSetCellSource to select cells based on \c master
32  or \c slave side of given \c faceZone(s).
33 
34  Operands:
35  \table
36  Operand | Type | Location
37  input | faceZone(s) | $FOAM_CASE/constant/polyMesh/faceZones
38  output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
39  \endtable
40 
41 Usage
42  Minimal example by using \c system/topoSetDict.actions:
43  \verbatim
44  {
45  // Mandatory (inherited) entries
46  name <name>;
47  type cellSet;
48  action <action>;
49 
50  // Mandatory entries
51  source faceZoneToCell;
52  option <option>;
53 
54  // Conditional mandatory entries
55  // Select either of the below
56 
57  // Option-1
58  zones
59  (
60  <faceZoneName1>
61  <faceZoneName2>
62  ...
63  );
64 
65  // Option-2
66  set <faceZoneName>;
67  }
68  \endverbatim
69 
70  where the entries mean:
71  \table
72  Property | Description | Type | Req'd | Dflt
73  name | Name of cellSet | word | yes | -
74  type | Type name: cellSet | word | yes | -
75  action | Action applied on cells - see below | word | yes | -
76  source | Source name: faceZoneToCell | word | yes | -
77  option | Selection type - see below | word | yes | -
78  \endtable
79 
80  Options for the \c action entry:
81  \verbatim
82  new | Create a new cellSet from selected cells
83  add | Add selected cells into this cellSet
84  subtract | Remove selected cells from this cellSet
85  \endverbatim
86 
87  Options for the \c option entry:
88  \verbatim
89  master | Master side of the faceZone
90  slave | Slave side of the faceZone
91  \endverbatim
92 
93  Options for the conditional mandatory entries:
94  \verbatim
95  Entry | Description | Type | Req'd | Dflt
96  zones | Names of input faceZones | wordList | cond'l | -
97  zone | Name of input faceZone | word | cond'l | -
98  \verbatim
99 
100 Note
101  The order of precedence among the conditional mandatory entries from the
102  highest to the lowest is \c zones, and \c zone.
103 
104 See also
105  - Foam::topoSetSource
106  - Foam::topoSetCellSource
107  - Foam::faceToCell
108 
109 SourceFiles
110  faceZoneToCell.C
111 
112 \*---------------------------------------------------------------------------*/
113 
114 #ifndef faceZoneToCell_H
115 #define faceZoneToCell_H
116 
117 #include "topoSetCellSource.H"
118 #include "wordRes.H"
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 namespace Foam
123 {
124 
125 /*---------------------------------------------------------------------------*\
126  Class faceZoneToCell Declaration
127 \*---------------------------------------------------------------------------*/
128 
129 class faceZoneToCell
130 :
131  public topoSetCellSource
132 {
133 public:
134  //- Enumeration defining the valid options
135  enum faceAction
136  {
137  MASTER,
138  SLAVE
139  };
140 
141 
142 private:
143 
144  // Private Data
145 
146  static const Enum<faceAction> faceActionNames_;
147 
148  //- Add usage string
149  static addToUsageTable usage_;
150 
151  //- Matcher for face zones
152  wordRes selectedZones_;
153 
154  //- Selection type
155  faceAction option_;
156 
157 
158  // Private Member Functions
159 
160  void combine(topoSet& set, const bool add) const;
161 
162 
163 public:
164 
165  //- Runtime type information
166  TypeName("faceZoneToCell");
167 
168 
169  // Constructors
170 
171  //- Construct from components
172  faceZoneToCell
173  (
174  const polyMesh& mesh,
175  const wordRe& zoneName,
176  const faceAction option
177  );
178 
179  //- Construct from dictionary
180  faceZoneToCell(const polyMesh& mesh, const dictionary& dict);
181 
182  //- Construct from Istream
183  faceZoneToCell(const polyMesh& mesh, Istream& is);
184 
185 
186  //- Destructor
187  virtual ~faceZoneToCell() = default;
188 
189 
190  // Member Functions
191 
192  virtual void applyToSet
193  (
194  const topoSetSource::setAction action,
195  topoSet& set
196  ) const;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
TypeName
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
wordRes.H
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:99
Foam::ListListOps::combine
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
Definition: ListListOps.C:69
topoSetCellSource.H
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:939
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33