clipPlaneToCell.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) 2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::clipPlaneToCell
28 
29 Description
30  A \c topoSetCellSource to select all cells
31  whose cell centre is above the specified plane
32 
33  Operands:
34  \table
35  Operand | Type | Location
36  output | cellSet | $FOAM_CASE/constant/polyMesh/sets/<set>
37  \endtable
38 
39 Usage
40  Minimal example by using \c system/topoSetDict.actions:
41  \verbatim
42  {
43  // Mandatory (inherited) entries
44  name <name>;
45  type cellSet;
46  action <action>;
47 
48  // Mandatory entries
49  source clipPlaneToCell;
50 
51  point (x y z);
52  normal (x y z);
53  }
54  \endverbatim
55 
56  where the entries mean:
57  \table
58  Property | Description | Type | Req'd | Dflt
59  name | Name of cellSet | word | yes | -
60  type | Type name: cellSet | word | yes | -
61  action | Action applied on cells - see below | word | yes | -
62  source | Source name: clipPlaneToCell | word | yes | -
63  \endtable
64 
65  Options for the \c action entry:
66  \verbatim
67  new | Create a new cellSet from selected cells
68  add | Add selected cells into this cellSet
69  subtract | Remove selected cells from this cellSet
70  \endverbatim
71 
72  Options for the conditional mandatory entries:
73  \verbatim
74  Entry | Description | Type | Req'd | Dflt
75  point | The reference point for the plane | vector | yes | -
76  normal | The normal of the plane | vector | yes | -
77  \endverbatim
78 
79 See also
80  - Foam::topoSetSource
81  - Foam::topoSetCellSource
82 
83 SourceFiles
84  clipPlaneToCell.C
85 
86 \*---------------------------------------------------------------------------*/
87 
88 #ifndef Foam_clipPlaneToCell_H
89 #define Foam_clipPlaneToCell_H
90 
91 #include "topoSetCellSource.H"
92 #include "point.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class clipPlaneToCell Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class clipPlaneToCell
104 :
105  public topoSetCellSource
106 {
107  // Private Data
108 
109  //- Add usage string
110  static addToUsageTable usage_;
111 
112  //- Point on the plane
113  const vector point_;
114 
115  //- Normal to the plane
116  const vector normal_;
117 
118 
119  // Private Member Functions
120 
121  void combine(topoSet& set, const bool add) const;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("clipPlaneToCell");
128 
129 
130  // Constructors
131 
132  //- No default construct
133  clipPlaneToCell() = delete;
134 
135  //- Construct from components
137  (
138  const polyMesh& mesh,
139  const point& basePoint,
140  const vector& normal
141  );
142 
143  //- Construct from dictionary
144  clipPlaneToCell(const polyMesh& mesh, const dictionary& dict);
145 
146  //- Construct from stream - a single box.
147  clipPlaneToCell(const polyMesh& mesh, Istream& is);
148 
149 
150  //- Destructor
151  virtual ~clipPlaneToCell() = default;
152 
153 
154  // Member Functions
155 
156  virtual void applyToSet
157  (
158  const topoSetSource::setAction action,
159  topoSet& set
160  ) const;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
clipPlaneToCell()=delete
No default construct.
const polyMesh & mesh() const noexcept
Reference to the mesh.
setAction
Enumeration defining various actions.
Vector< scalar > vector
Definition: vector.H:57
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual ~clipPlaneToCell()=default
Destructor.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:59
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
TypeName("clipPlaneToCell")
Runtime type information.
Namespace for OpenFOAM.