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-2026 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  );
114 
115  //- Construct from dictionary
117  (
118  const word& name,
119  const dictionary& dict,
120  const label index,
121  const polyBoundaryMesh& bm
122  );
123 
124  //- Construct as copy, resetting the boundary mesh
126 
127  //- Construct given the original patch and resetting the
128  // face list and boundary mesh information
130  (
131  const wedgePolyPatch& pp,
132  const polyBoundaryMesh& bm,
133  const label index,
134  const label newSize,
135  const label newStart
136  );
137 
138  //- Construct and return a clone, resetting the boundary mesh
139  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
140  {
141  return autoPtr<polyPatch>(new wedgePolyPatch(*this, bm));
142  }
143 
144  //- Construct and return a clone, resetting the face list
145  // and boundary mesh
146  virtual autoPtr<polyPatch> clone
147  (
148  const polyBoundaryMesh& bm,
149  const label index,
150  const label newSize,
151  const label newStart
152  ) const
153  {
154  return autoPtr<polyPatch>
155  (
156  new wedgePolyPatch(*this, bm, index, newSize, newStart)
157  );
158  }
159 
160 
161  // Member Functions
162 
163  //- Return true as this patch is a constraint type
164  virtual bool constraint() const
165  {
166  return true;
167  }
168 
169  // Access
170 
171  //- Return axis of the wedge
172  const vector& axis() const
173  {
174  return axis_;
175  }
176 
177  //- Return plane normal between the wedge boundaries
178  const vector& centreNormal() const
179  {
180  return centreNormal_;
181  }
182 
183  //- Return the normal to the patch
184  const vector& n() const
185  {
186  return n_;
187  }
188 
189  //- Return the cosine of the wedge angle
190  scalar cosAngle() const
191  {
192  return cosAngle_;
193  }
194 
195  //- Return face transformation tensor
196  const tensor& faceT() const
197  {
198  return faceT_;
199  }
200 
201  //- Return neighbour-cell transformation tensor
202  const tensor& cellT() const
203  {
204  return cellT_;
205  }
206 
207  //- Return the index of the opposite wedge patch
208  label oppositePatchIndex() const;
209 
210  //- Return a reference to the opposite wedge patch
211  const wedgePolyPatch& oppositePatch() const;
212 };
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
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:71
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:277
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.
virtual bool constraint() const
Return true as this patch is a constraint type.
const wedgePolyPatch & oppositePatch() const
Return a reference to the opposite wedge patch.
const tensor & cellT() const
Return neighbour-cell transformation tensor.
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.
wedgePolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Construct from components.
A class for handling words, derived from string.
Definition: word.H:63
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