Loading...
Searching...
No Matches
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-2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::cellToFace
29
30Description
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
40Usage
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 one of the below
55
56 // Option-1
57 sets
58 (
59 <cellSetName1>
60 <cellSetName2>
61 ...
62 );
63
64 // Option-2
65 zones
66 (
67 <cellZoneName0>
68 <cellZoneName1>
69 ...
70 );
71
72 // Option-3
73 set <cellSetName>;
74
75 // Option-4
76 zone <cellZoneName>;
77 }
78 \endverbatim
79
80 where the entries mean:
81 \table
82 Property | Description | Type | Reqd | Deflt
83 name | Name of faceSet | word | yes | -
84 type | Type name: faceSet | word | yes | -
85 action | Action applied on faces - see below | word | yes | -
86 source | Source name: cellToFace | word | yes | -
87 option | Selection type - see below | word | yes | -
88 \endtable
89
90 Options for the \c action entry:
91 \verbatim
92 new | Create a new faceSet from selected cells of cellSet(s)
93 add | Add selected faces of cellSet(s) into this faceSet
94 subtract | Remove selected faces of cellSet(s) from this faceSet
95 \endverbatim
96
97 Options for the \c option entry:
98 \verbatim
99 all | All faces of cells in the cellSet
100 both | Faces where both neighbours are in the cellSet
101 outside | Faces with only one neighbour in the cellSet
102 \endverbatim
103
104 Options for the conditional mandatory entries (in order of precedence):
105 \verbatim
106 Entry | Description | Type | Reqd | Deflt
107 sets | Names of input cellSets | wordList | choice | -
108 zones | Names of input cellZones | wordList | cond'l | -
109 set | Name of input cellSet | word | choice | -
110 zone | Name of input cellZone | word | cond'l | -
111 \endverbatim
112
113Note
114 - The \c outside option applies to the cellSets individually.
115
116See also
117 - Foam::topoSetSource
118 - Foam::topoSetFaceSource
119
120SourceFiles
121 cellToFace.C
122
123\*---------------------------------------------------------------------------*/
124
125#ifndef Foam_cellToFace_H
126#define Foam_cellToFace_H
127
128#include "topoSetFaceSource.H"
129#include "Enum.H"
130
131// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132
133namespace Foam
134{
135
136/*---------------------------------------------------------------------------*\
137 Class cellToFace Declaration
138\*---------------------------------------------------------------------------*/
139
140class cellToFace
141:
142 public topoSetFaceSource
143{
144public:
145 //- Enumeration defining the valid options
146 enum cellAction
147 {
148 ALL,
149 BOTH,
150 OUTSIDE
151 };
152
153
154private:
155
156 // Private Data
157
158 //- Add usage string
159 static addToUsageTable usage_;
160
161 static const Enum<cellAction> cellActionNames_;
162
163 //- Names of sets or zones to use
164 wordList names_;
165
166 //- Is name a set or a zone
167 const bool isZone_;
168
169 //- Selection type
170 cellAction option_;
171
172
173 // Private Member Functions
174
175 //- Depending on face to cell option add to or delete from cellSet.
176 template<class Selector>
177 void combineImpl
178 (
179 topoSet& set,
180 const bool add,
181 const Selector& cellLabels
182 ) const;
184 //- Depending on face to cell option add to or delete from set.
185 void combine(topoSet& set, const bool add, const word& setName) const;
186
187
188public:
189
190 //- Runtime type information
191 TypeName("cellToFace");
192
194 // Constructors
196 //- Construct from components
198 (
199 const polyMesh& mesh,
200 const word& setName,
201 const cellAction option
202 );
203
204 //- Construct from dictionary
205 cellToFace(const polyMesh& mesh, const dictionary& dict);
206
207 //- Construct from Istream
208 cellToFace(const polyMesh& mesh, Istream& is);
209
210
211 //- Destructor
212 virtual ~cellToFace() = default;
213
214
215 // Member Functions
216
217 virtual void applyToSet
218 (
219 const topoSetSource::setAction action,
220 topoSet& set
221 ) const;
222};
223
224
225// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227} // End namespace Foam
228
229// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230
231#endif
232
233// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A topoSetFaceSource to select all the faces from given cellSet(s).
Definition cellToFace.H:186
cellToFace(const polyMesh &mesh, const word &setName, const cellAction option)
Construct from components.
Definition cellToFace.C:232
virtual ~cellToFace()=default
Destructor.
cellAction
Enumeration defining the valid options.
Definition cellToFace.H:192
TypeName("cellToFace")
Runtime type information.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition cellToFace.C:274
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
The topoSetFaceSource is a intermediate class for handling topoSet sources for selecting faces.
topoSetFaceSource(const polyMesh &mesh)
Construct from mesh.
Class with constructor to add usage string to table.
setAction
Enumeration defining various actions.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition topoSet.H:63
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68