Loading...
Searching...
No Matches
faceToCell.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::faceToCell
29
30Description
31 A \c topoSetCellSource to select all cells based on usage in given
32 \c faceSet(s), e.g. select cells that are the \c owner/neighbour/any
33 of the faces in a given \c faceSet.
34
35 Operands:
36 \table
37 Operand | Type | Location
38 input | faceSet(s) | $FOAM_CASE/constant/polyMesh/sets/<set>
39 output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
40 \endtable
41
42Usage
43 Minimal example by using \c system/topoSetDict.actions:
44 \verbatim
45 {
46 // Mandatory (inherited) entries
47 name <name>;
48 type cellSet;
49 action <action>;
50
51 // Mandatory entries
52 source faceToCell;
53 option <option>;
54
55 // Conditional mandatory entries
56 // Select one of the below
57
58 // Option-1
59 sets
60 (
61 <faceSetName0>
62 <faceSetName1>
63 ...
64 );
65
66 // Option-2
67 zones
68 (
69 <faceZoneName0>
70 <faceZoneName1>
71 ...
72 );
73
74 // Option-3
75 set <faceSetName>;
76
77 // Option-4
78 zone <faceZoneName>;
79 }
80 \endverbatim
81
82 where the entries mean:
83 \table
84 Property | Description | Type | Req'd | Dflt
85 name | Name of cellSet | word | yes | -
86 type | Type name: cellSet | word | yes | -
87 action | Action applied on cells - see below | word | yes | -
88 source | Source name: faceToCell | word | yes | -
89 option | Selection type - see below | word | yes | -
90 \endtable
91
92 Options for the \c action entry:
93 \verbatim
94 new | Create a new cellSet from selected cells
95 add | Add selected cells into this cellSet
96 subtract | Remove selected cells from this cellSet
97 \endverbatim
98
99 Options for the \c option entry:
100 \verbatim
101 all | Cells that are either owner or neighbour of given faces
102 any | Cells that are either owner or neighbour of given faces
103 owner | Cells that are owner of given faces
104 neighbour | Cells that are neighbour of given faces
105 \endverbatim
106
107 Options for the conditional mandatory entries (in order of precedence):
108 \verbatim
109 Entry | Description | Type | Req'd | Dflt
110 sets | Names of input faceSets | wordList | cond'l | -
111 zones | Names of input faceZones | wordList | cond'l | -
112 set | Name of input faceSet | word | cond'l | -
113 zone | Name of input faceZone | word | cond'l | -
114 \endverbatim
115
116See also
117 - Foam::topoSetSource
118 - Foam::topoSetCellSource
119 - Foam::faceZoneToCell
120
121SourceFiles
122 faceToCell.C
123
124\*---------------------------------------------------------------------------*/
125
126#ifndef Foam_faceToCell_H
127#define Foam_faceToCell_H
128
129#include "topoSetCellSource.H"
130#include "Enum.H"
131
132// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133
134namespace Foam
135{
136
137/*---------------------------------------------------------------------------*\
138 Class faceToCell Declaration
139\*---------------------------------------------------------------------------*/
140
141class faceToCell
142:
143 public topoSetCellSource
144{
145public:
146 //- Enumeration defining the valid options
147 enum faceAction
148 {
149 ANY,
150 ALL,
151 OWNER,
153 };
154
155
156private:
157
158 // Private Data
159
160 static const Enum<faceAction> faceActionNames_;
161
162 //- Add usage string
163 static addToUsageTable usage_;
164
165 //- Names of sets or zones to use
166 wordList names_;
167
168 //- Is name a set or a zone
169 const bool isZone_;
170
171 //- Option
172 faceAction option_;
173
174
175 // Private Member Functions
176
177 //- Depending on face to cell option add to or delete from cellSet.
178 template<class Selector>
179 void combineImpl
180 (
181 topoSet& set,
182 const bool add,
183 const Selector& faceLabels
184 ) const;
185
186 //- Depending on face to cell option add to or delete from cellSet.
187 void combine(topoSet& set, const bool add, const word& setName) const;
188
189
190public:
191
192 //- Runtime type information
193 TypeName("faceToCell");
196 // Constructors
198 //- Construct from components
200 (
201 const polyMesh& mesh,
202 const word& setName,
203 const faceAction option
204 );
205
206 //- Construct from dictionary
207 faceToCell(const polyMesh& mesh, const dictionary& dict);
208
209 //- Construct from Istream
210 faceToCell(const polyMesh& mesh, Istream& is);
211
212
213 //- Destructor
214 virtual ~faceToCell() = default;
215
216
217 // Member Functions
218
219 virtual void applyToSet
220 (
221 const topoSetSource::setAction action,
222 topoSet& set
223 ) const;
224};
225
226
227// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228
229} // End namespace Foam
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233#endif
234
235// ************************************************************************* //
labelList faceLabels(nFaceLabels)
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 list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A topoSetCellSource to select all cells based on usage in given faceSet(s), e.g. select cells that ar...
Definition faceToCell.H:187
virtual ~faceToCell()=default
Destructor.
faceToCell(const polyMesh &mesh, const word &setName, const faceAction option)
Construct from components.
Definition faceToCell.C:153
TypeName("faceToCell")
Runtime type information.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition faceToCell.C:195
faceAction
Enumeration defining the valid options.
Definition faceToCell.H:193
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
topoSetCellSource(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