patchEdgeFacePoint.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-2023 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::patchEdgeFacePoint
26 
27 Description
28  Transport of nearest point location for use in PatchEdgeFaceWave.
29 
30 SourceFiles
31  patchEdgeFacePointI.H
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef patchEdgeFacePoint_H
36 #define patchEdgeFacePoint_H
37 
38 #include "point.H"
39 #include "label.H"
40 #include "scalar.H"
41 #include "tensor.H"
42 #include "pTraits.H"
43 #include "primitivePatch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of classes
51 
52 class polyPatch;
53 class polyMesh;
54 
55 
56 // Forward declaration of friend functions and operators
57 
58 class patchEdgeFacePoint;
59 
60 Istream& operator>>(Istream&, patchEdgeFacePoint&);
61 Ostream& operator<<(Ostream&, const patchEdgeFacePoint&);
62 
63 
64 /*---------------------------------------------------------------------------*\
65  Class patchEdgeFacePoint Declaration
66 \*---------------------------------------------------------------------------*/
67 
69 {
70  // Private Data
71 
72  //- Position of nearest wall center
73  point origin_;
74 
75  //- Normal distance (squared) from point to origin
76  scalar distSqr_;
77 
78 
79  // Private Member Functions
80 
81  //- Evaluate distance to point. Update distSqr, origin from whomever
82  // is nearer pt. Return true if w2 is closer to point,
83  // false otherwise.
84  template<class TrackingData>
85  inline bool update
86  (
87  const point&,
88  const patchEdgeFacePoint& w2,
89  const scalar tol,
90  TrackingData& td
91  );
92 
93  //- Combine current with w2. Update distSqr, origin if w2 has smaller
94  // quantities and returns true.
95  template<class TrackingData>
96  inline bool update
97  (
98  const patchEdgeFacePoint& w2,
99  const scalar tol,
100  TrackingData& td
101  );
102 
103 
104 public:
105 
106  // Constructors
107 
108  //- Construct null
109  inline patchEdgeFacePoint();
110 
111  //- Construct from origin, distance
112  inline patchEdgeFacePoint(const point&, const scalar);
113 
114 
115  // Member Functions
116 
117  // Access
118 
119  inline const point& origin() const;
120 
121  inline scalar distSqr() const;
122 
123 
124  // Needed by meshWave
125 
126  //- Check whether origin has been changed at all or
127  // still contains original (invalid) value.
128  template<class TrackingData>
129  inline bool valid(TrackingData& td) const;
130 
131  //- Apply rotation matrix
132  template<class TrackingData>
133  inline void transform
134  (
135  const polyMesh& mesh,
136  const primitivePatch& patch,
137  const tensor& rotTensor,
138  const scalar tol,
139  TrackingData& td
140  );
141 
142  //- Influence of face on edge
143  template<class TrackingData>
144  inline bool updateEdge
145  (
146  const polyMesh& mesh,
147  const primitivePatch& patch,
148  const label edgei,
149  const label facei,
150  const patchEdgeFacePoint& faceInfo,
151  const scalar tol,
152  TrackingData& td
153  );
154 
155  //- New information for edge (from e.g. coupled edge)
156  template<class TrackingData>
157  inline bool updateEdge
158  (
159  const polyMesh& mesh,
160  const primitivePatch& patch,
161  const patchEdgeFacePoint& edgeInfo,
162  const bool sameOrientation,
163  const scalar tol,
164  TrackingData& td
165  );
166 
167  //- Influence of edge on face.
168  template<class TrackingData>
169  inline bool updateFace
170  (
171  const polyMesh& mesh,
172  const primitivePatch& patch,
173  const label facei,
174  const label edgei,
175  const patchEdgeFacePoint& edgeInfo,
176  const scalar tol,
177  TrackingData& td
178  );
179 
180  //- Same (like operator==)
181  template<class TrackingData>
182  inline bool equal
183  (
184  const patchEdgeFacePoint&,
185  TrackingData& td
186  ) const;
187 
188 
189  // Member Operators
190 
191  // Needed for List IO
192  inline bool operator==(const patchEdgeFacePoint&) const;
193  inline bool operator!=(const patchEdgeFacePoint&) const;
194 
195 
196  // IOstream Operators
197 
198  inline friend Ostream& operator<<(Ostream&, const patchEdgeFacePoint&);
199  inline friend Istream& operator>>(Istream&, patchEdgeFacePoint&);
200 };
201 
202 
203 //- Data associated with patchEdgeFacePoint type are contiguous
204 template<>
205 inline bool contiguous<patchEdgeFacePoint>()
206 {
207  return true;
208 }
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #include "patchEdgeFacePointI.H"
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
#define w2
Definition: blockCreate.C:32
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Transport of nearest point location for use in PatchEdgeFaceWave.
bool operator!=(const patchEdgeFacePoint &) const
friend Istream & operator>>(Istream &, patchEdgeFacePoint &)
patchEdgeFacePoint()
Construct null.
bool operator==(const patchEdgeFacePoint &) const
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
bool equal(const patchEdgeFacePoint &, TrackingData &td) const
Same (like operator==)
bool updateFace(const polyMesh &mesh, const primitivePatch &patch, const label facei, const label edgei, const patchEdgeFacePoint &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on face.
const point & origin() const
friend Ostream & operator<<(Ostream &, const patchEdgeFacePoint &)
bool updateEdge(const polyMesh &mesh, const primitivePatch &patch, const label edgei, const label facei, const patchEdgeFacePoint &faceInfo, const scalar tol, TrackingData &td)
Influence of face on edge.
void transform(const polyMesh &mesh, const primitivePatch &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Namespace for OpenFOAM.
bool contiguous< patchEdgeFacePoint >()
Data associated with patchEdgeFacePoint type are contiguous.
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
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)