boxToFace.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-2017 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::boxToFace
29 
30 Description
31  A \c topoSetFaceSource to select all faces
32  whose face centre inside given bounding box(es).
33 
34  Operands:
35  \table
36  Operand | Type | Location
37  output | faceSet | $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 faceSet;
47  action <action>;
48 
49  // Mandatory entries
50  source boxToFace;
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  \endverbatim
71 
72  where the entries mean:
73  \table
74  Property | Description | Type | Req'd | Dflt
75  name | Name of faceSet | word | yes | -
76  type | Type name: faceSet | word | yes | -
77  action | Action applied on faces - see below | word | yes | -
78  source | Source name: boxToFace | word | yes | -
79  \endtable
80 
81  Options for the \c action entry:
82  \verbatim
83  new | Create a new faceSet from selected cells
84  add | Add selected cells into this faceSet
85  subtract | Remove selected cells from this faceSet
86  \endverbatim
87 
88  Options for the conditional mandatory entries:
89  \verbatim
90  Entry | Description | Type | Req'd | Dflt
91  boxes | Multiple bounding boxes | vectorList | cond'l | -
92  box | A single bounding box | vector | cond'l | -
93  min | Minimum point for a single box | vector | cond'l | -
94  max | Maximum point for a single box | vector | cond'l | -
95  \verbatim
96 
97 Note
98  The order of precedence among the conditional mandatory entries from the
99  highest to the lowest is \c boxes, \c box or a \c min-max pair
100  (compatibility with \c searchableBox).
101 
102 See also
103  - Foam::topoSetSource
104  - Foam::topoSetFaceSource
105 
106 SourceFiles
107  boxToFace.C
108 
109 \*---------------------------------------------------------------------------*/
110 
111 #ifndef boxToFace_H
112 #define boxToFace_H
113 
114 #include "topoSetFaceSource.H"
115 #include "treeBoundBoxList.H"
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 namespace Foam
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class boxToFace Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 class boxToFace
127 :
128  public topoSetFaceSource
129 {
130  // Private Data
131 
132  //- Add usage string
133  static addToUsageTable usage_;
134 
135  //- Bounding box.
136  treeBoundBoxList bbs_;
137 
138 
139  // Private Member Functions
140 
141  void combine(topoSet& set, const bool add) const;
142 
143 
144 public:
145 
146  //- Runtime type information
147  TypeName("boxToFace");
148 
149 
150  // Constructors
151 
152  //- Construct from components, copying bounding boxes
153  boxToFace(const polyMesh& mesh, const treeBoundBoxList& bbs);
154 
155  //- Construct from components, moving bounding boxes
156  boxToFace(const polyMesh& mesh, treeBoundBoxList&& bbs);
157 
158  //- Construct from dictionary
159  boxToFace(const polyMesh& mesh, const dictionary& dict);
160 
161  //- Construct from stream - a single box.
162  boxToFace(const polyMesh& mesh, Istream& is);
163 
164 
165  //- Destructor
166  virtual ~boxToFace() = default;
167 
168 
169  // Member Functions
170 
171  virtual void applyToSet
172  (
173  const topoSetSource::setAction action,
174  topoSet& set
175  ) const;
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
TypeName
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
Foam::topoSetSource::setAction
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:99
Foam::ListListOps::combine
AccessType combine(const UList< T > &lists, AccessOp aop=accessOp< T >())
Combines sub-lists into a single list.
Definition: ListListOps.C:69
dict
dictionary dict
Definition: searchingEngine.H:14
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
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
treeBoundBoxList.H
topoSetFaceSource.H
Foam::treeBoundBoxList
List< treeBoundBox > treeBoundBoxList
List of bounding boxes.
Definition: treeBoundBoxList.H:46