pointToFace.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-2012 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::pointToFace
29 
30 Description
31  A \c topoSetFaceSource to select faces with any
32  point or any edge within a given \c pointSet(s).
33 
34  Operands
35  \table
36  Operand | Type | Location
37  input | pointSet(s) | $FOAM_CASE/constant/polyMesh/sets/<set>
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 pointToFace;
52  option <option>;
53 
54  // Conditional mandatory entries
55  // Select one of the below
56 
57  // Option-1
58  sets
59  (
60  <pointSetName1>
61  <pointSetName2>
62  ...
63  );
64 
65  // Option-2
66  zones
67  (
68  <pointZoneName0>
69  <pointZoneName1>
70  ...
71  );
72 
73  // Option-3
74  set <pointSetName>;
75 
76  // Option-4
77  zone <pointZoneName>;
78  }
79  \endverbatim
80 
81  where the entries mean:
82  \table
83  Property | Description | Type | Req'd | Dflt
84  name | Name of faceSet | word | yes | -
85  type | Type name: faceSet | word | yes | -
86  action | Action applied on faces - see below | word | yes | -
87  source | Source name: pointToFace | word | yes | -
88  option | Selection type - see below | word | yes | -
89  \endtable
90 
91  Options for the \c action entry:
92  \verbatim
93  new | Create a new faceSet from selected faces
94  add | Add selected faces into this faceSet
95  subtract | Remove selected faces from this faceSet
96  \endverbatim
97 
98  Options for the \c option entry:
99  \verbatim
100  any | Any point in the pointSet
101  edge | Two consecutive points (an edge) in the pointSet
102  all | All points in the pointSet
103  \endverbatim
104 
105  Options for the conditional mandatory entries (in order of precedence):
106  \verbatim
107  Entry | Description | Type | Req'd | Dflt
108  sets | Names of input pointSets | wordList | cond'l | -
109  zones | Names of input pointZones | wordList | cond'l | -
110  set | Name of input pointSet | word | cond'l | -
111  zone | Name of input pointZone | word | cond'l | -
112  \endverbatim
113 
114 See also
115  - Foam::topoSetSource
116  - Foam::topoSetFaceSource
117 
118 SourceFiles
119  pointToFace.C
120 
121 \*---------------------------------------------------------------------------*/
122 
123 #ifndef Foam_pointToFace_H
124 #define Foam_pointToFace_H
125 
126 #include "topoSetFaceSource.H"
127 #include "Enum.H"
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 namespace Foam
132 {
133 
134 /*---------------------------------------------------------------------------*\
135  Class pointToFace Declaration
136 \*---------------------------------------------------------------------------*/
137 
138 class pointToFace
139 :
140  public topoSetFaceSource
141 {
142 
143 public:
144 
145  //- Enumeration defining the valid options
146  enum pointAction
147  {
148  ANY,
149  ALL,
150  EDGE
151  };
152 
153 
154 private:
155 
156  //- Add usage string
157  static addToUsageTable usage_;
158 
159  static const Enum<pointAction> pointActionNames_;
160 
161  //- Names of sets or zones to use
162  wordList names_;
163 
164  //- Is name a set or a zone
165  const bool isZone_;
166 
167  //- Option
168  pointAction option_;
169 
170 
171  // Private Member Functions
172 
173  //- Depending on option add to or delete from set.
174  template<class Selector>
175  void combineImpl
176  (
177  topoSet& set,
178  const bool add,
179  const Selector& pointLabels
180  ) const;
182  //- Depending on face to cell option add to or delete from faceSet.
183  void combine(topoSet& set, const bool add, const word& setName) const;
184 
185 
186 public:
187 
188  //- Runtime type information
189  TypeName("pointToFace");
190 
192  // Constructors
194  //- Construct from components
196  (
197  const polyMesh& mesh,
198  const word& setName,
199  const pointAction option
200  );
201 
202  //- Construct from dictionary
203  pointToFace(const polyMesh& mesh, const dictionary& dict);
204 
205  //- Construct from Istream
206  pointToFace(const polyMesh& mesh, Istream& is);
207 
208 
209  //- Destructor
210  virtual ~pointToFace() = default;
211 
212 
213  // Member Functions
214 
215  virtual void applyToSet
216  (
217  const topoSetSource::setAction action,
218  topoSet& set
219  ) const;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
dictionary dict
labelList pointLabels(nPoints, -1)
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
pointToFace(const polyMesh &mesh, const word &setName, const pointAction option)
Construct from components.
Definition: pointToFace.C:179
pointAction
Enumeration defining the valid options.
Definition: pointToFace.H:191
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.
TypeName("pointToFace")
Runtime type information.
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
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: pointToFace.C:221
virtual ~pointToFace()=default
Destructor.
Namespace for OpenFOAM.