boxToPoint.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-2015 OpenFOAM Foundation
9  Copyright (C) 2018-2021 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::boxToPoint
29 
30 Description
31  A \c topoSetPointSource to select all points based
32  on whether they are inside given bounding box(es).
33 
34  Operands:
35  \table
36  Operand | Type | Location
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 boxToPoint;
51 
52  // Conditional mandatory entries
53  // Select either of the below
54 
55  // Option-1
56  boxes
57  (
58  (<minX> <minY> <minZ>) (<maxX> <maxY> <maxZ>) // box-1
59  (<minX> <minY> <minZ>) (<maxX> <maxY> <maxZ>) // box-2
60  ...
61  );
62 
63  // Option-2
64  box (<minX> <minY> <minZ>) (<maxX> <maxY> <maxZ>);
65 
66  // Option-3
67  min (<minX> <minY> <minZ>);
68  max (<maxX> <maxY> <maxZ>);
69 
70  // Option-4
71  min (<minX> <minY> <minZ>);
72  span (<sizeX> <sizeY> <sizeZ>);
73  }
74  \endverbatim
75 
76  where the entries mean:
77  \table
78  Property | Description | Type | Req'd | Dflt
79  name | Name of pointSet | word | yes | -
80  type | Type name: pointSet | word | yes | -
81  action | Action applied on points - see below | word | yes | -
82  source | Source name: boxToPoint | word | yes | -
83  \endtable
84 
85  Options for the \c action entry:
86  \verbatim
87  new | Create a new pointSet from selected points
88  add | Add selected points into this pointSet
89  subtract | Remove selected points from this pointSet
90  \endverbatim
91 
92  Options for the conditional mandatory entries:
93  \verbatim
94  Entry | Description | Type | Req'd | Dflt
95  boxes | Multiple bounding boxes | vectorList | cond'l | -
96  box | A single bounding box | vectors | cond'l | -
97  min | Minimum point (single box) | vector | cond'l | -
98  max | Maximum point (single box) | vector | cond'l | -
99  span | Box width (single box) | vector | cond'l | -
100  \endverbatim
101 
102 Note
103  The order of precedence among the conditional mandatory entries from the
104  highest to the lowest is \c boxes, \c box, \c min-max or \c min-span pair
105  (compatibility with \c searchableBox).
106 
107 See also
108  - Foam::topoSetSource
109  - Foam::topoSetPointSource
110 
111 SourceFiles
112  boxToPoint.C
113 
114 \*---------------------------------------------------------------------------*/
115 
116 #ifndef boxToPoint_H
117 #define boxToPoint_H
118 
119 #include "topoSetPointSource.H"
120 #include "treeBoundBoxList.H"
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 namespace Foam
125 {
126 
127 /*---------------------------------------------------------------------------*\
128  Class boxToPoint Declaration
129 \*---------------------------------------------------------------------------*/
130 
131 class boxToPoint
132 :
133  public topoSetPointSource
134 {
135  // Private Data
136 
137  //- Add usage string
138  static addToUsageTable usage_;
139 
140  //- Bounding boxes
141  treeBoundBoxList bbs_;
142 
143 
144  // Private Member Functions
145 
146  void combine(topoSet& set, const bool add) const;
147 
148 
149 public:
150 
151  //- Runtime type information
152  TypeName("boxToPoint");
153 
154 
155  // Constructors
156 
157  //- Construct from components, copying bounding boxes
158  boxToPoint(const polyMesh& mesh, const treeBoundBoxList& bbs);
159 
160  //- Construct from components, moving bounding boxes
161  boxToPoint(const polyMesh& mesh, treeBoundBoxList&& bbs);
162 
163  //- Construct from dictionary
164  boxToPoint(const polyMesh& mesh, const dictionary& dict);
165 
166  //- Construct from stream - a single box.
167  boxToPoint(const polyMesh& mesh, Istream& is);
168 
169 
170  //- Destructor
171  virtual ~boxToPoint() = default;
172 
173 
174  // Member Functions
175 
176  virtual void applyToSet
177  (
178  const topoSetSource::setAction action,
179  topoSet& set
180  ) const;
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::boxToPoint::~boxToPoint
virtual ~boxToPoint()=default
Destructor.
Foam::combine
Definition: FaceCellWave.C:57
Foam::topoSetSource::addToUsageTable
Class with constructor to add usage string to table.
Definition: topoSetSource.H:129
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:100
Foam::boxToPoint::boxToPoint
boxToPoint(const polyMesh &mesh, const treeBoundBoxList &bbs)
Construct from components, copying bounding boxes.
Definition: boxToPoint.C:110
Foam::boxToPoint::applyToSet
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const
Apply specified action to the topoSet.
Definition: boxToPoint.C:166
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
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
treeBoundBoxList.H
topoSetPointSource.H
Foam::List< treeBoundBox >
Foam::topoSetSource::mesh
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: topoSetSource.H:342
Foam::boxToPoint
A topoSetPointSource to select all points based on whether they are inside given bounding box(es).
Definition: boxToPoint.H:168
Foam::boxToPoint::TypeName
TypeName("boxToPoint")
Runtime type information.
Foam::treeBoundBoxList
List< treeBoundBox > treeBoundBoxList
List of bounding boxes.
Definition: treeBoundBoxList.H:46