patchToCell.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) 2018-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::patchToCell
28 
29 Description
30  A \c topoSetCellSource to select cells associated with given patch(es).
31 
32  Operands:
33  \table
34  Operand | Type | Location
35  output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
36  \endtable
37 
38 Usage
39  Minimal example by using \c system/topoSetDict.actions:
40  \verbatim
41  {
42  // Mandatory (inherited) entries
43  name <name>;
44  type cellSet;
45  action <action>;
46 
47  // Mandatory entries
48  source patchToCell;
49 
50  // Conditional mandatory entries
51  // Select either of the below
52 
53  // Option-1
54  patches
55  (
56  <patchName1>
57  <patchName2>
58  ...
59  );
60 
61  // Option-2
62  patch <patchName>;
63  }
64  \endverbatim
65 
66  where the entries mean:
67  \table
68  Property | Description | Type | Req'd | Dflt
69  name | Name of cellSet | word | yes | -
70  type | Type name: cellSet | word | yes | -
71  action | Action applied on cells - see below | word | yes | -
72  source | Source name: patchToCell | word | yes | -
73  \endtable
74 
75  Options for the \c action entry:
76  \verbatim
77  new | Create a new cellSet from selected cells
78  add | Add selected cells into this cellSet
79  subtract | Remove selected cells from this cellSet
80  \endverbatim
81 
82  Options for the conditional mandatory entries:
83  \verbatim
84  Entry | Description | Type | Req'd | Dflt
85  patches | Names of patches or wildcards | wordList | cond'l | -
86  patch | Name of patch or wildcard | word | cond'l | -
87  \endverbatim
88 
89 Note
90  The order of precedence among the conditional mandatory entries from the
91  highest to the lowest is \c patches, and \c patch.
92 
93 See also
94  - Foam::topoSetSource
95  - Foam::topoSetCellSource
96  - Foam::boundaryToCell
97 
98 SourceFiles
99  patchToCell.C
100 
101 \*---------------------------------------------------------------------------*/
102 
103 #ifndef patchToCell_H
104 #define patchToCell_H
105 
106 #include "topoSetCellSource.H"
107 #include "wordRes.H"
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 namespace Foam
112 {
113 
114 /*---------------------------------------------------------------------------*\
115  Class patchToCell Declaration
116 \*---------------------------------------------------------------------------*/
117 
118 class patchToCell
119 :
120  public topoSetCellSource
121 {
122  // Private Data
123 
124  //- Add usage string
125  static addToUsageTable usage_;
126 
127  //- Matcher for patches
128  wordRes selectedPatches_;
129 
130 
131  // Private Member Functions
132 
133  void combine(topoSet& set, const bool add) const;
134 
135 
136 public:
137 
138  //- Runtime type information
139  TypeName("patchToCell");
140 
141  // Constructors
142 
143  //- Construct from components
144  patchToCell(const polyMesh& mesh, const wordRe& patchName);
145 
146  //- Construct from dictionary
147  patchToCell(const polyMesh& mesh, const dictionary& dict);
148 
149  //- Construct from Istream
150  patchToCell(const polyMesh& mesh, Istream& is);
151 
152 
153  //- Destructor
154  virtual ~patchToCell() = default;
155 
156 
157  // Member Functions
158 
159  virtual void applyToSet
160  (
161  const topoSetSource::setAction action,
162  topoSet& set
163  ) const;
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
wordRes.H
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::patchToCell::patchToCell
patchToCell(const polyMesh &mesh, const wordRe &patchName)
Construct from components.
Definition: patchToCell.C:112
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::wordRe
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:80
Foam::patchToCell::TypeName
TypeName("patchToCell")
Runtime type information.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::patchToCell::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: patchToCell.C:155
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
Foam::patchToCell
A topoSetCellSource to select cells associated with given patch(es).
Definition: patchToCell.H:155
topoSetCellSource.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
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
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchToCell::~patchToCell
virtual ~patchToCell()=default
Destructor.
Foam::topoSetCellSource
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Definition: topoSetCellSource.H:54
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342