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-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::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 either 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:
93  \verbatim
94  Entry | Description | Type | Req'd | Dflt
95  sets | Names of input faceSets | wordList | cond'l | -
96  set | Name of input faceSet | word | cond'l | -
97  \endverbatim
98 
99 Note
100  The order of precedence among the conditional mandatory entries from the
101  highest to the lowest is \c sets, and \c set.
102 
103 See also
104  - Foam::topoSetSource
105  - Foam::topoSetPointSource
106 
107 SourceFiles
108  faceToPoint.C
109 
110 \*---------------------------------------------------------------------------*/
111 
112 #ifndef faceToPoint_H
113 #define faceToPoint_H
114 
115 #include "topoSetPointSource.H"
116 #include "Enum.H"
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 namespace Foam
121 {
122 
123 /*---------------------------------------------------------------------------*\
124  Class faceToPoint Declaration
125 \*---------------------------------------------------------------------------*/
126 
127 class faceToPoint
128 :
129  public topoSetPointSource
130 {
131 
132 public:
133  //- Enumeration defining the valid options
134  enum faceAction
135  {
136  ALL
137  };
138 
139 
140 private:
141 
142  // Private Data
143 
144  //- Add usage string
145  static addToUsageTable usage_;
146 
147  static const Enum<faceAction> faceActionNames_;
148 
149  //- Names of sets to use
150  wordList names_;
151 
152  //- Option
153  faceAction option_;
154 
155 
156  // Private Member Functions
157 
158  void combine(topoSet& set, const bool add, const word& setName) const;
159 
160 
161 public:
162 
163  //- Runtime type information
164  TypeName("faceToPoint");
165 
166 
167  // Constructors
168 
169  //- Construct from components
171  (
172  const polyMesh& mesh,
173  const word& setName,
174  const faceAction option
175  );
176 
177  //- Construct from dictionary
178  faceToPoint(const polyMesh& mesh, const dictionary& dict);
179 
180  //- Construct from Istream
182 
183 
184  //- Destructor
185  virtual ~faceToPoint() = default;
186 
187 
188  // Member Functions
189 
190  virtual void applyToSet
191  (
192  const topoSetSource::setAction action,
193  topoSet& set
194  ) const;
195 };
196 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 } // End namespace Foam
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #endif
205 
206 // ************************************************************************* //
Foam::Enum< faceAction >
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::combine
Definition: FaceCellWave.C:57
Foam::faceToPoint::faceAction
faceAction
Enumeration defining the valid options.
Definition: faceToPoint.H:181
Foam::faceToPoint::faceToPoint
faceToPoint(const polyMesh &mesh, const word &setName, const faceAction option)
Construct from components.
Definition: faceToPoint.C:88
Foam::faceToPoint::ALL
Definition: faceToPoint.H:183
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::faceToPoint::~faceToPoint
virtual ~faceToPoint()=default
Destructor.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::faceToPoint::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: faceToPoint.C:134
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::faceToPoint::TypeName
TypeName("faceToPoint")
Runtime type information.
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
Foam::topoSetPointSource
The topoSetPointSource is a intermediate class for handling topoSet sources for selecting points.
Definition: topoSetPointSource.H:54
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
topoSetPointSource.H
Foam::List< word >
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::faceToPoint
A topoSetPointSource to select all points based on usage in given faceSet(s).
Definition: faceToPoint.H:174
Enum.H