wedgePolyPatch.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) 2011-2024 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::wedgePolyPatch
26 
27 Description
28  Wedge front and back plane patch.
29 
30 SourceFiles
31  wedgePolyPatch.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef wedgePolyPatch_H
36 #define wedgePolyPatch_H
37 
38 #include "polyPatch.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class wedgePolyPatch Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class wedgePolyPatch
50 :
51  public polyPatch
52 {
53  // Private Data
54 
55  //- Axis of the wedge
56  vector axis_;
57 
58  //- Centre normal between the wedge boundaries
59  vector centreNormal_;
60 
61  //- Normal to the patch
62  vector n_;
63 
64  //- Cosine of the wedge angle
65  scalar cosAngle_;
66 
67  //- Face transformation tensor
68  tensor faceT_;
69 
70  //- Neighbour-cell transformation tensor
71  tensor cellT_;
72 
73  //- Index of the opposite wedge patch
74  mutable label oppositePatchIndex_;
75 
76 
77  // Private Member Functions
78 
79  //- Return whether the given face is a (non-degenerate) quad
80  bool isQuadFace(const label) const;
81 
82  //- Return whether the given face is part of a wedge patch
83  bool isWedgeFace(const label) const;
84 
85  //- Return the wedge face opposite the given wedge face
86  label oppositeWedgeFace(const label) const;
87 
88 
89 protected:
90 
91  // Protected Member Functions
92 
93  //- Calculate the patch geometry
94  virtual void calcGeometry(PstreamBuffers&);
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("wedge");
101 
102 
103  // Constructors
104 
105  //- Construct from components
107  (
108  const word& name,
109  const label size,
110  const label start,
111  const label index,
112  const polyBoundaryMesh& bm,
113  const word& patchType
114  );
115 
116  //- Construct from dictionary
118  (
119  const word& name,
120  const dictionary& dict,
121  const label index,
122  const polyBoundaryMesh& bm,
123  const word& patchType
124  );
125 
126  //- Construct as copy, resetting the boundary mesh
128 
129  //- Construct given the original patch and resetting the
130  // face list and boundary mesh information
132  (
133  const wedgePolyPatch& pp,
134  const polyBoundaryMesh& bm,
135  const label index,
136  const label newSize,
137  const label newStart
138  );
139 
140  //- Construct and return a clone, resetting the boundary mesh
141  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
142  {
143  return autoPtr<polyPatch>(new wedgePolyPatch(*this, bm));
144  }
145 
146  //- Construct and return a clone, resetting the face list
147  // and boundary mesh
148  virtual autoPtr<polyPatch> clone
149  (
150  const polyBoundaryMesh& bm,
151  const label index,
152  const label newSize,
153  const label newStart
154  ) const
155  {
156  return autoPtr<polyPatch>
157  (
158  new wedgePolyPatch(*this, bm, index, newSize, newStart)
159  );
160  }
161 
162 
163  // Member Functions
164 
165  // Access
166 
167  //- Return axis of the wedge
168  const vector& axis() const
169  {
170  return axis_;
171  }
172 
173  //- Return plane normal between the wedge boundaries
174  const vector& centreNormal() const
175  {
176  return centreNormal_;
177  }
178 
179  //- Return the normal to the patch
180  const vector& n() const
181  {
182  return n_;
183  }
184 
185  //- Return the cosine of the wedge angle
186  scalar cosAngle() const
187  {
188  return cosAngle_;
189  }
190 
191  //- Return face transformation tensor
192  const tensor& faceT() const
193  {
194  return faceT_;
195  }
196 
197  //- Return neighbour-cell transformation tensor
198  const tensor& cellT() const
199  {
200  return cellT_;
201  }
202 
203  //- Return the index of the opposite wedge patch
204  label oppositePatchIndex() const;
205 
206  //- Return a reference to the opposite wedge patch
207  const wedgePolyPatch& oppositePatch() const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
autoPtr< PrimitivePatch< SubList< face >, const pointField & > > clone() const
Construct and return a clone.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
label size() const
Return the number of elements in the UList.
Definition: UListI.H:311
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
label index() const
Return the index of this patch in the boundaryMesh.
const word & name() const
Return name.
Foam::polyBoundaryMesh.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:280
Wedge front and back plane patch.
const vector & centreNormal() const
Return plane normal between the wedge boundaries.
scalar cosAngle() const
Return the cosine of the wedge angle.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const wedgePolyPatch & oppositePatch() const
Return a reference to the opposite wedge patch.
const tensor & cellT() const
Return neighbour-cell transformation tensor.
wedgePolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
const vector & n() const
Return the normal to the patch.
label oppositePatchIndex() const
Return the index of the opposite wedge patch.
TypeName("wedge")
Runtime type information.
const vector & axis() const
Return axis of the wedge.
const tensor & faceT() const
Return face transformation tensor.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict