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 -------------------------------------------------------------------------------
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::pointToCell
29 
30 Description
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 
41 Usage
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 
100 Note
101  The order of precedence among the conditional mandatory entries from the
102  highest to the lowest is \c sets, and \c set.
103 
104 See also
105  - Foam::topoSetSource
106  - Foam::topoSetCellSource
107 
108 SourceFiles
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 
121 namespace Foam
122 {
123 
124 /*---------------------------------------------------------------------------*\
125  Class pointToCell Declaration
126 \*---------------------------------------------------------------------------*/
127 
128 class pointToCell
129 :
130  public topoSetCellSource
131 {
132 public:
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 
142 private:
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 
164 public:
165 
166  //- Runtime type information
167  TypeName("pointToCell");
168 
169 
170  // Constructors
171 
172  //- Construct from components
174  (
175  const polyMesh& mesh,
176  const word& setName,
177  const pointAction option
178  );
179 
180  //- Construct from dictionary
182 
183  //- Construct from Istream
185 
186 
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 // ************************************************************************* //
Foam::Enum< pointAction >
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::pointToCell::EDGE
Definition: pointToCell.H:184
Foam::combine
Definition: FaceCellWave.C:57
Foam::pointToCell
A topoSetCellSource to select cells with any point or any edge within a given pointSet(s).
Definition: pointToCell.H:175
Foam::pointToCell::pointAction
pointAction
Enumeration defining the valid options.
Definition: pointToCell.H:181
Foam::pointToCell::ANY
Definition: pointToCell.H:183
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::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::pointToCell::TypeName
TypeName("pointToCell")
Runtime type information.
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::pointToCell::~pointToCell
virtual ~pointToCell()=default
Destructor.
Foam::topoSet
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:63
topoSetCellSource.H
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
Foam::List< word >
Foam::topoSetCellSource
The topoSetCellSource is a intermediate class for handling topoSet sources for selecting cells.
Definition: topoSetCellSource.H:54
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::pointToCell::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: pointToCell.C:166
Foam::pointToCell::pointToCell
pointToCell(const polyMesh &mesh, const word &setName, const pointAction option)
Construct from components.
Definition: pointToCell.C:120
Enum.H