patchToPoint.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) 2024 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::patchToPoint
28 
29 Description
30  A \c topoSetPointSource to select points associated with given patch(es).
31 
32  Operands:
33  \table
34  Operand | Type | Location
35  output | pointSet | $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 pointSet;
45  action <action>;
46 
47  // Mandatory entries
48  source patchToPoint;
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 pointSet | word | yes | -
70  type | Type name: pointSet | word | yes | -
71  action | Action applied on points - see below | word | yes | -
72  source | Source name: patchToPoint | word | yes | -
73  \endtable
74 
75  Options for the \c action entry:
76  \verbatim
77  new | Create a new pointSet from selected points
78  add | Add selected points into this pointSet
79  subtract | Remove selected points from this pointSet
80  \endverbatim
81 
82  Options for the conditional mandatory entries:
83  \verbatim
84  Entry | Description | Type | Req'd | Dflt
85  patches | Names of patches | wordList | cond'l | -
86  patch | Name of patch | 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::patchToFace
95 
96 SourceFiles
97  patchToPoint.C
98 
99 \*---------------------------------------------------------------------------*/
100 
101 #ifndef patchToPoint_H
102 #define patchToPoint_H
103 
104 #include "topoSetPointSource.H"
105 #include "wordRes.H"
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 namespace Foam
110 {
111 
112 /*---------------------------------------------------------------------------*\
113  Class patchToPoint Declaration
114 \*---------------------------------------------------------------------------*/
115 
116 class patchToPoint
117 :
118  public topoSetPointSource
119 {
120  // Private Data
121 
122  //- Add usage string
123  static addToUsageTable usage_;
124 
125  //- Matcher for patches
126  wordRes selectedPatches_;
127 
128 
129  // Private Member Functions
130 
131  void combine(topoSet& set, const bool add) const;
132 
133 
134 public:
135 
136  //- Runtime type information
137  TypeName("patchToPoint");
138 
139 
140  // Constructors
141 
142  //- Construct from components
143  patchToPoint(const polyMesh& mesh, const wordRe& patchName);
144 
145  //- Construct from dictionary
146  patchToPoint(const polyMesh& mesh, const dictionary& dict);
147 
148  //- Construct from Istream
150 
151 
152  //- Destructor
153  virtual ~patchToPoint() = default;
154 
155 
156  // Member Functions
157 
158  virtual void applyToSet
159  (
160  const topoSetSource::setAction action,
161  topoSet& set
162  ) const;
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
dictionary dict
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
TypeName("patchToPoint")
Runtime type information.
patchToPoint(const polyMesh &mesh, const wordRe &patchName)
Construct from components.
Definition: patchToPoint.C:102
const polyMesh & mesh() const noexcept
Reference to the mesh.
setAction
Enumeration defining various actions.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: patchToPoint.C:145
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
virtual ~patchToPoint()=default
Destructor.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
Namespace for OpenFOAM.