pointToCell.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-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::pointToCell
29
30Description
31 A \c topoSetCellSource to select cells with any
32 point or any edge within a given \c pointSet(s).
33
34 Operands
35 \table
36 Operand | Type | Location
37 input | pointSeti(s) | $FOAM_CASE/constant/polyMesh/sets/<set>
38 output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
39 \endtable
40
41Usage
42 Minimal example by using \c system/topoSetDict.actions:
43 \verbatim
44 {
45 // Mandatory (inherited) entries
46 name <name>;
47 type cellSet;
48 action <action>;
49
50 // Mandatory entries
51 source pointToCell;
52 option <option>;
53
54 // Conditional mandatory entries
55 // Select either of the below
56
57 // Option-1
58 sets
59 (
60 <pointSetName1>
61 <pointSetName2>
62 ...
63 );
64
65 // Option-2
66 set <pointSetName>;
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Req'd | Dflt
73 name | Name of cellSet | word | yes | -
74 type | Type name: cellSet | word | yes | -
75 action | Action applied on cells - see below | word | yes | -
76 source | Source name: pointToCell | 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 cellSet from selected cells
83 add | Add selected cells into this cellSet
84 subtract | Remove selected cells from this cellSet
85 \endverbatim
86
87 Options for the \c option entry:
88 \verbatim
89 any | Cells using any point in pointSet
90 edge | Cells using an edge with both points in pointSet
91 \endverbatim
92
93 Options for the conditional mandatory entries:
94 \verbatim
95 Entry | Description | Type | Req'd | Dflt
96 sets | Names of input pointSets | wordList | cond'l | -
97 set | Name of input pointSet | word | cond'l | -
98 \endverbatim
99
100Note
101 The order of precedence among the conditional mandatory entries from the
102 highest to the lowest is \c sets, and \c set.
103
104See also
105 - Foam::topoSetSource
106 - Foam::topoSetCellSource
107
108SourceFiles
109 pointToCell.C
110
111\*---------------------------------------------------------------------------*/
112
113#ifndef pointToCell_H
114#define pointToCell_H
115
116#include "topoSetCellSource.H"
117#include "Enum.H"
118
119// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120
121namespace Foam
122{
123
124/*---------------------------------------------------------------------------*\
125 Class pointToCell Declaration
126\*---------------------------------------------------------------------------*/
127
128class pointToCell
129:
130 public topoSetCellSource
131{
132public:
133 //- Enumeration defining the valid options
134 enum pointAction
135 {
136 ANY, // Cells using any point in set
137 EDGE // Cells using an edge with both points in set
138 //ALL // Possible extension: cells whose all points are in set
139 };
140
141
142private:
143
144 //Private Data
145
146 //- Add usage string
147 static addToUsageTable usage_;
148
149 static const Enum<pointAction> pointActionNames_;
150
151 //- Names of sets to use
152 wordList names_;
153
154 //- Selection type
155 pointAction option_;
156
157
158 // Private Member Functions
159
160 //- Depending on point-to-cell option add to or delete from cellSet.
161 void combine(topoSet& set, const bool add, const word& setName) const;
162
163
164public:
165
166 //- Runtime type information
167 TypeName("pointToCell");
168
169
170 // Constructors
171
172 //- Construct from components
174 (
176 const word& setName,
177 const pointAction option
178 );
179
180 //- Construct from dictionary
182
183 //- Construct from Istream
184 pointToCell(const polyMesh& mesh, Istream& is);
185
187 //- Destructor
188 virtual ~pointToCell() = default;
189
190
191 // Member Functions
192
193 virtual void applyToSet
194 (
195 const topoSetSource::setAction action,
196 topoSet& set
197 ) const;
198};
199
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202
203} // End namespace Foam
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207#endif
208
209// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A topoSetCellSource to select cells with any point or any edge within a given pointSet(s).
Definition: pointToCell.H:178
pointAction
Enumeration defining the valid options.
Definition: pointToCell.H:182
pointToCell(const polyMesh &mesh, const word &setName, const pointAction option)
Construct from components.
Definition: pointToCell.C:120
virtual ~pointToCell()=default
Destructor.
TypeName("pointToCell")
Runtime type information.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: pointToCell.C:166
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
setAction
Enumeration defining various actions.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:67
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:63
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73