regionToFace.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) 2012-2016 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::regionToFace
29 
30 Description
31  A \c topoSetFaceSource to select cells belonging to a topologically
32  connected region (that contains given points).
33 
34  Operands:
35  \table
36  Operand | Type | Location
37  input | region | $FOAM_CASE/constant/\{<region>, polyMesh\}
38  output | faceSet | $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 faceSet;
48  action <action>;
49 
50  // Mandatory entries
51  source regionToFace;
52  set <faceSetName>;
53  nearPoint <point>;
54  }
55  \endverbatim
56 
57  where the entries mean:
58  \table
59  Property | Description | Type | Req'd | Dflt
60  name | Name of faceSet | word | yes | -
61  type | Type name: faceSet | word | yes | -
62  action | Action applied on faces - see below | word | yes | -
63  source | Source name: regionToFace | word | yes | -
64  set / zone | Name of faceSet / zone restricting search | word | yes | -
65  nearPoint | The point on/near to the region | vector | yes | -
66  \endtable
67 
68  Options for the \c action entry:
69  \verbatim
70  new | Create a new faceSet from selected faces
71  add | Add selected faces into this faceSet
72  subtract | Remove selected faces from this faceSet
73  \endverbatim
74 
75 See also
76  - Foam::topoSetSource
77  - Foam::topoSetFaceSource
78 
79 SourceFiles
80  regionToFace.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef Foam_regionToFace_H
85 #define Foam_regionToFace_H
86 
87 #include "topoSetFaceSource.H"
88 #include "indirectPrimitivePatch.H"
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 namespace Foam
93 {
94 
95 /*---------------------------------------------------------------------------*\
96  Class regionToFace Declaration
97 \*---------------------------------------------------------------------------*/
98 
99 class regionToFace
100 :
101  public topoSetFaceSource
102 {
103  // Private Data
104 
105  //- Add usage string
106  static addToUsageTable usage_;
107 
108  //- Name of set or zone to use
109  word setName_;
110 
111  //- Is name a set or a zone
112  bool isZone_;
113 
114  //- Coordinate that is nearest/on connected region
115  const point nearPoint_;
116 
117 
118  // Private Member Functions
119 
120  //- Walk edge-face-edge
121  void markZone
122  (
124  const label proci,
125  const label facei,
126  const label zoneI,
127  labelList& faceZone
128  ) const;
129 
130  void combine
131  (
132  topoSet& set,
133  const bool add,
134  const labelUList& ids
135  ) const;
136 
137 
138 public:
139 
140  //- Runtime type information
141  TypeName("regionToFace");
142 
143 
144  // Constructors
145 
146  //- Construct from components
148  (
149  const polyMesh& mesh,
150  const word& setName,
151  const point& nearPoint
152  );
153 
154  //- Construct from dictionary
155  regionToFace(const polyMesh& mesh, const dictionary& dict);
156 
157  //- Construct from Istream
158  regionToFace(const polyMesh& mesh, Istream& is);
159 
160 
161  //- Destructor
162  virtual ~regionToFace() = default;
163 
164 
165  // Member Functions
166 
167  virtual void applyToSet
168  (
169  const topoSetSource::setAction action,
170  topoSet&
171  ) const;
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Apply specified action to the topoSet.
Definition: regionToFace.C:258
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field...
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
A class for handling words, derived from Foam::string.
Definition: word.H:63
const polyMesh & mesh() const noexcept
Reference to the mesh.
setAction
Enumeration defining various actions.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
regionToFace(const polyMesh &mesh, const word &setName, const point &nearPoint)
Construct from components.
Definition: regionToFace.C:208
vector point
Point is a vector.
Definition: point.H:37
const std::string patch
OpenFOAM patch number as a std::string.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
virtual ~regionToFace()=default
Destructor.
List< label > labelList
A List of labels.
Definition: List.H:62
TypeName("regionToFace")
Runtime type information.
Namespace for OpenFOAM.