rotatedBoxToFace.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::rotatedBoxToFace
26 
27 Description
28  A topoSetSource to select faces based on cell centres inside a rotated
29  and/or skewed box.
30 
31  The box can be defined with an origin and three vectors; i, j, and k. The
32  origin is one corner of the box, and the vectors are the edges connected to
33  that corner.
34 
35  For example, the following defines a box rotated 45 degrees around the
36  z-axis, with width and depth of 0.2, height of 200, and with a bottom left
37  corner at (0.4 0.4 -100):
38 
39  \verbatim
40  origin (0.4 0.4 -100);
41  i (0.141421 0.141421 0);
42  j (-0.141421 0.141421 0);
43  k (0 0 200);
44  \endverbatim
45 
46  Alternatively, the box can be defined using a non-rotated box and details
47  of how it should be rotated. This syntax is triggered by the presence of
48  the keyword "box". A standard bounding box is supplied, along with a centre
49  of rotation and two vectors, n1 and n2. The rotation is taken to be that
50  which transforms n1 onto n2.
51 
52  The above example can be equivalently specified in this alternative form as
53  follows:
54 
55  \verbatim
56  box (0.4 0.4 -100) (0.6 0.6 100);
57  centre (0.4 0.4 0);
58  n1 (1 0 0);
59  n2 (1 1 0);
60  \endverbatim
61 
62 SourceFiles
63  rotatedBoxToFace.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef rotatedBoxToFace_H
68 #define rotatedBoxToFace_H
69 
70 #include "topoSetSource.H"
71 #include "treeBoundBox.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 
78 /*---------------------------------------------------------------------------*\
79  Class rotatedBoxToFace Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 class rotatedBoxToFace
83 :
84  public topoSetSource
85 {
86  // Private Data
87 
88  //- Skewed box origin
89  vector origin_;
90 
91  //- Skewed box edge vector
92  vector i_;
93 
94  //- Skewed box edge vector
95  vector j_;
96 
97  //- Skewed box edge vector
98  vector k_;
99 
100 
101  // Private Member Functions
102 
103  void combine(topoSet& set, const bool add) const;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("rotatedBoxToFace");
110 
111  // Constructors
112 
113  //- Construct from components
115  (
116  const polyMesh& mesh,
117  const vector& origin,
118  const vector& i,
119  const vector& j,
120  const vector& k
121  );
122 
123  //- Construct from dictionary
124  rotatedBoxToFace(const polyMesh& mesh, const dictionary& dict);
125 
126 
127  //- Destructor
128  virtual ~rotatedBoxToFace();
129 
130 
131  // Member Functions
133  virtual sourceType setType() const
134  {
135  return FACESETSOURCE;
136  }
137 
138  virtual void applyToSet
139  (
140  const topoSetSource::setAction action,
141  topoSet&
142  ) const;
143 
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
rotatedBoxToFace(const polyMesh &mesh, const vector &origin, const vector &i, const vector &j, const vector &k)
Construct from components.
label k
Boltzmann constant.
virtual sourceType setType() const
virtual ~rotatedBoxToFace()
Destructor.
Base class of a source for a topoSet.
Definition: topoSetSource.H:63
const polyMesh & mesh() const
A topoSetSource to select faces based on cell centres inside a rotated and/or skewed box...
setAction
Enumeration defining the valid actions.
Definition: topoSetSource.H:82
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:61
TypeName("rotatedBoxToFace")
Runtime type information.
sourceType
Enumeration defining the types of sources.
Definition: topoSetSource.H:70
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
Namespace for OpenFOAM.