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-2020 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 either of the below
57
58 // Option-1
59 sets
60 (
61 <faceSetName0>
62 <faceSetName1>
63 ...
64 );
65
66 // Option-2
67 set <faceSetName>;
68 }
69 \endverbatim
70
71 where the entries mean:
72 \table
73 Property | Description | Type | Req'd | Dflt
74 name | Name of cellSet | word | yes | -
75 type | Type name: cellSet | word | yes | -
76 action | Action applied on cells - see below | word | yes | -
77 source | Source name: faceToCell | word | yes | -
78 option | Selection type - see below | word | yes | -
79 \endtable
80
81 Options for the \c action entry:
82 \verbatim
83 new | Create a new cellSet from selected cells
84 add | Add selected cells into this cellSet
85 subtract | Remove selected cells from this cellSet
86 \endverbatim
87
88 Options for the \c option entry:
89 \verbatim
90 all | Cells that are either owner or neighbour of given faces
91 any | Cells that are either owner or neighbour of given faces
92 owner | Cells that are owner of given faces
93 neighbour | Cells that are neighbour of given faces
94 \endverbatim
95
96 Options for the conditional mandatory entries:
97 \verbatim
98 Entry | Description | Type | Req'd | Dflt
99 sets | Names of input faceSets | wordList | cond'l | -
100 set | Name of input faceSet | word | cond'l | -
101 \endverbatim
102
103Note
104 The order of precedence among the conditional mandatory entries from the
105 highest to the lowest is \c sets, and \c set.
106
107See also
108 - Foam::topoSetSource
109 - Foam::topoSetCellSource
110 - Foam::faceZoneToCell
111
112SourceFiles
113 faceToCell.C
114
115\*---------------------------------------------------------------------------*/
116
117#ifndef faceToCell_H
118#define faceToCell_H
119
120#include "topoSetCellSource.H"
121#include "Enum.H"
122
123// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124
125namespace Foam
126{
127
128/*---------------------------------------------------------------------------*\
129 Class faceToCell Declaration
130\*---------------------------------------------------------------------------*/
131
132class faceToCell
133:
134 public topoSetCellSource
135{
136public:
137 //- Enumeration defining the valid options
138 enum faceAction
139 {
140 ANY,
141 ALL,
142 OWNER,
144 };
145
146
147private:
148
149 // Private Data
150
151 static const Enum<faceAction> faceActionNames_;
152
153 //- Add usage string
154 static addToUsageTable usage_;
155
156 //- Names of sets to use
157 wordList names_;
158
159 //- Option
160 faceAction option_;
161
162
163 // Private Member Functions
164
165 //- Depending on face to cell option add to or delete from cellSet.
166 void combine(topoSet& set, const bool add, const word& setName) const;
167
168
169public:
170
171 //- Runtime type information
172 TypeName("faceToCell");
173
174
175 // Constructors
176
177 //- Construct from components
180 const polyMesh& mesh,
181 const word& setName,
182 const faceAction option
183 );
184
185 //- Construct from dictionary
186 faceToCell(const polyMesh& mesh, const dictionary& dict);
188 //- Construct from Istream
190
192 //- Destructor
193 virtual ~faceToCell() = default;
194
195
196 // Member Functions
197
198 virtual void applyToSet
199 (
200 const topoSetSource::setAction action,
201 topoSet& set
202 ) const;
203};
204
205
206// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207
208} // End namespace Foam
209
210// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211
212#endif
213
214// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A topoSetCellSource to select all cells based on usage in given faceSet(s), e.g. select cells that ar...
Definition: faceToCell.H:182
virtual ~faceToCell()=default
Destructor.
faceToCell(const polyMesh &mesh, const word &setName, const faceAction option)
Construct from components.
Definition: faceToCell.C:140
TypeName("faceToCell")
Runtime type information.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: faceToCell.C:186
faceAction
Enumeration defining the valid options.
Definition: faceToCell.H:186
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
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:67
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:63
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73