faceToPoint.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-2024 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::faceToPoint
29 
30 Description
31  A \c topoSetPointSource to select all
32  points based on usage in given \c faceSet(s).
33 
34  Operands:
35  \table
36  Operand | Type | Location
37  input | faceSet(s) | $FOAM_CASE/constant/polyMesh/sets/<set>
38  output | pointSet | $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 pointSet;
48  action <action>;
49 
50  // Mandatory entries
51  source faceToPoint;
52  option <option>;
53 
54  // Conditional mandatory entries
55  // Select one of the below
56 
57  // Option-1
58  sets
59  (
60  <faceSetName0>
61  <faceSetName1>
62  ...
63  );
64 
65  // Option-2
66  set <faceSetName>;
67  }
68  \endverbatim
69 
70  where the entries mean:
71  \table
72  Property | Description | Type | Req'd | Dflt
73  name | Name of pointSet | word | yes | -
74  type | Type name: pointSet | word | yes | -
75  action | Action applied on points - see below | word | yes | -
76  source | Source name: faceToPoint | word | yes | -
77  option | Selection type - see below | word | yes | -
78  \endtable
79 
80  Options for the \c action entry:
81  \verbatim
82  new | Create a new pointSet from selected points
83  add | Add selected points into this pointSet
84  subtract | Remove selected points from this pointSet
85  \endverbatim
86 
87  Options for the \c option entry:
88  \verbatim
89  all | Select all points of faces in the faceSet
90  \endverbatim
91 
92  Options for the conditional mandatory entries (in order of precedence):
93  \verbatim
94  Entry | Description | Type | Req'd | Dflt
95  sets | Names of input faceSets | wordList | cond'l | -
96  zones | Names of input faceZones | wordList | cond'l | -
97  set | Name of input faceSet | word | cond'l | -
98  zone | Name of input faceZone | word | cond'l | -
99  \endverbatim
100 
101 See also
102  - Foam::topoSetSource
103  - Foam::topoSetPointSource
104 
105 SourceFiles
106  faceToPoint.C
107 
108 \*---------------------------------------------------------------------------*/
109 
110 #ifndef faceToPoint_H
111 #define faceToPoint_H
112 
113 #include "topoSetPointSource.H"
114 #include "Enum.H"
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 namespace Foam
119 {
120 
121 /*---------------------------------------------------------------------------*\
122  Class faceToPoint Declaration
123 \*---------------------------------------------------------------------------*/
124 
125 class faceToPoint
126 :
127  public topoSetPointSource
128 {
129 
130 public:
131  //- Enumeration defining the valid options
132  enum faceAction
133  {
134  ALL
135  };
136 
137 
138 private:
139 
140  // Private Data
141 
142  //- Add usage string
143  static addToUsageTable usage_;
144 
145  static const Enum<faceAction> faceActionNames_;
146 
147  //- Names of sets or zones to use
148  wordList names_;
149 
150  //- Is name a set or a zone
151  const bool isZone_;
152 
153  //- Option
154  faceAction option_;
155 
156 
157  // Private Member Functions
158 
159  void combine(topoSet& set, const bool add, const word& setName) const;
160 
161 
162 public:
163 
164  //- Runtime type information
165  TypeName("faceToPoint");
166 
167 
168  // Constructors
169 
170  //- Construct from components
172  (
173  const polyMesh& mesh,
174  const word& setName,
175  const faceAction option
176  );
178  //- Construct from dictionary
180 
181  //- Construct from Istream
182  faceToPoint(const polyMesh& mesh, Istream& is);
183 
184 
185  //- Destructor
186  virtual ~faceToPoint() = default;
187 
188 
189  // Member Functions
190 
191  virtual void applyToSet
192  (
193  const topoSetSource::setAction action,
194  topoSet& set
195  ) const;
196 };
197 
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 } // End namespace Foam
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
dictionary dict
faceToPoint(const polyMesh &mesh, const word &setName, const faceAction option)
Construct from components.
Definition: faceToPoint.C:96
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual ~faceToPoint()=default
Destructor.
faceAction
Enumeration defining the valid options.
Definition: faceToPoint.H:177
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.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: faceToPoint.C:138
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
List< word > wordList
List of word.
Definition: fileName.H:59
TypeName("faceToPoint")
Runtime type information.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
Namespace for OpenFOAM.