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,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::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 one of the below
55 
56  // Option-1
57  sets
58  (
59  <pointSetName1>
60  <pointSetName2>
61  ...
62  );
63 
64  // Option-2
65  zones
66  (
67  <pointZoneName0>
68  <pointZoneName1>
69  ...
70  );
71 
72  // Option-3
73  set <pointSetName>;
74 
75  // Option-4
76  zone <pointZoneName>;
77  }
78  \endverbatim
79 
80  where the entries mean:
81  \table
82  Property | Description | Type | Req'd | Dflt
83  name | Name of pointSet | word | yes | -
84  type | Type name: pointSet | word | yes | -
85  action | Action applied on points - see below | word | yes | -
86  source | Source name: cellToPoint | word | yes | -
87  option | Selection type - see below | word | yes | -
88  \endtable
89 
90  Options for the \c action entry:
91  \verbatim
92  new | Create a new pointSet from selected points
93  add | Add selected points into this pointSet
94  subtract | Remove selected points from this pointSet
95  \endverbatim
96 
97  Options for the \c option entry:
98  \verbatim
99  all | Select all points of cells in the cellSet
100  \endverbatim
101 
102  Options for the conditional mandatory entries (in order of precedence):
103  \verbatim
104  Entry | Description | Type | Reqd | Deflt
105  sets | Names of input cellSets | wordList | choice | -
106  zones | Names of input cellZones | wordList | cond'l | -
107  set | Name of input cellSet | word | choice | -
108  zone | Name of input cellZone | word | cond'l | -
109  \endverbatim
110 
111 See also
112  - Foam::topoSetSource
113  - Foam::topoSetPointSource
114 
115 SourceFiles
116  cellToPoint.C
117 
118 \*---------------------------------------------------------------------------*/
119 
120 #ifndef cellToPoint_H
121 #define cellToPoint_H
122 
123 #include "topoSetPointSource.H"
124 #include "Enum.H"
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 namespace Foam
129 {
130 
131 /*---------------------------------------------------------------------------*\
132  Class cellToPoint Declaration
133 \*---------------------------------------------------------------------------*/
134 
135 class cellToPoint
136 :
137  public topoSetPointSource
138 {
139 
140 public:
141  //- Enumeration defining the valid options
142  enum cellAction
143  {
144  ALL
145  };
146 
147 
148 private:
149 
150  // Private Data
151 
152  //- Add usage string
153  static addToUsageTable usage_;
154 
155  static const Enum<cellAction> cellActionNames_;
156 
157  //- Names of sets or zones to use
158  wordList names_;
159 
160  //- Is name a set or a zone
161  const bool isZone_;
162 
163  //- Option
164  cellAction option_;
165 
166 
167  // Private Member Functions
168 
169  //- Depending on cell to point option add to or delete from pointSet.
170  template<class Selector>
171  void combineImpl
172  (
173  topoSet& set,
174  const bool add,
175  const Selector& cellLabels
176  ) const;
177 
178  void combine(topoSet& set, const bool add, const word& setName) const;
179 
180 
181 public:
182 
183  //- Runtime type information
184  TypeName("cellToPoint");
185 
186 
187  // Constructors
188 
189  //- Construct from components
191  (
192  const polyMesh& mesh,
193  const word& setName,
194  const cellAction option
195  );
196 
197  //- Construct from dictionary
198  cellToPoint(const polyMesh& mesh, const dictionary& dict);
199 
200  //- Construct from Istream
201  cellToPoint(const polyMesh& mesh, Istream& is);
202 
203 
204  //- Destructor
205  virtual ~cellToPoint() = default;
206 
207 
208  // Member Functions
209 
210  virtual void applyToSet
211  (
212  const topoSetSource::setAction action,
213  topoSet& set
214  ) const;
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
TypeName("cellToPoint")
Runtime type information.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
cellAction
Enumeration defining the valid options.
Definition: cellToPoint.H:187
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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 ~cellToPoint()=default
Destructor.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: cellToPoint.C:150
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
cellToPoint(const polyMesh &mesh, const word &setName, const cellAction option)
Construct from components.
Definition: cellToPoint.C:108
Namespace for OpenFOAM.