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 | Name of faceSet 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 regionToFace_H
85 #define 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 to use
109  word setName_;
110 
111  //- Coordinate that is nearest/on connected region
112  point nearPoint_;
113 
114 
115  // Private Member Functions
116 
117  //- Walk edge-face-edge
118  void markZone
119  (
121  const label proci,
122  const label facei,
123  const label zoneI,
124  labelList& faceZone
125  ) const;
126 
127  void combine(topoSet& set, const bool add) const;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("regionToFace");
134 
135 
136  // Constructors
137 
138  //- Construct from components
140  (
141  const polyMesh& mesh,
142  const word& setName,
143  const point& nearPoint
144  );
145 
146  //- Construct from dictionary
147  regionToFace(const polyMesh& mesh, const dictionary& dict);
148 
149  //- Construct from Istream
150  regionToFace(const polyMesh& mesh, Istream& is);
151 
152 
153  //- Destructor
154  virtual ~regionToFace() = default;
155 
156 
157  // Member Functions
158 
159  virtual void applyToSet
160  (
161  const topoSetSource::setAction action,
162  topoSet&
163  ) const;
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::regionToFace::TypeName
TypeName("regionToFace")
Runtime type information.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::regionToFace::~regionToFace
virtual ~regionToFace()=default
Destructor.
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::regionToFace::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Apply specified action to the topoSet.
Definition: regionToFace.C:252
Foam::topoSetFaceSource
The topoSetFaceSource is a intermediate class for handling topoSet sources for selecting faces.
Definition: topoSetFaceSource.H:54
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::regionToFace::regionToFace
regionToFace(const polyMesh &mesh, const word &setName, const point &nearPoint)
Construct from components.
Definition: regionToFace.C:213
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:64
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
Foam::regionToFace
A topoSetFaceSource to select cells belonging to a topologically connected region (that contains give...
Definition: regionToFace.H:152
indirectPrimitivePatch.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::indirectPrimitivePatch
PrimitivePatch< IndirectList< face >, const pointField & > indirectPrimitivePatch
A PrimitivePatch with an IndirectList for the faces, const reference for the point field.
Definition: indirectPrimitivePatch.H:49
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::List< label >
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
topoSetFaceSource.H
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79