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