patchEdgeFaceInfo.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-2020 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::patchEdgeFaceInfo
26 
27 Description
28 
29 SourceFiles
30  patchEdgeFaceInfoI.H
31  patchEdgeFaceInfo.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef patchEdgeFaceInfo_H
36 #define patchEdgeFaceInfo_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 patchEdgeFaceInfo;
59 
60 Istream& operator>>(Istream&, patchEdgeFaceInfo&);
61 Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
62 
63 
64 /*---------------------------------------------------------------------------*\
65  Class patchEdgeFaceInfo 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 patchEdgeFaceInfo& 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 patchEdgeFaceInfo& w2,
99  const scalar tol,
100  TrackingData& td
101  );
102 
103 
104 public:
105 
106  // Constructors
107 
108  //- Construct null
109  inline patchEdgeFaceInfo();
110 
111  //- Construct from origin, distance
112  inline patchEdgeFaceInfo(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 patchEdgeFaceInfo& 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 patchEdgeFaceInfo& 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 patchEdgeFaceInfo& edgeInfo,
176  const scalar tol,
177  TrackingData& td
178  );
179 
180  //- Same (like operator==)
181  template<class TrackingData>
182  inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const;
183 
184 
185  // Member Operators
186 
187  // Needed for List IO
188  inline bool operator==(const patchEdgeFaceInfo&) const;
189  inline bool operator!=(const patchEdgeFaceInfo&) const;
190 
191 
192  // IOstream Operators
193 
194  friend Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
196 };
197 
198 
199 //- Data associated with patchEdgeFaceInfo type are contiguous
200 template<>
201 inline bool contiguous<patchEdgeFaceInfo>()
202 {
203  return true;
204 }
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #include "patchEdgeFaceInfoI.H"
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
bool operator==(const patchEdgeFaceInfo &) const
patchEdgeFaceInfo()
Construct null.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
#define w2
Definition: blockCreate.C:32
bool equal(const patchEdgeFaceInfo &, TrackingData &td) const
Same (like operator==)
bool updateFace(const polyMesh &mesh, const primitivePatch &patch, const label facei, const label edgeI, const patchEdgeFaceInfo &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on face.
fvMesh & mesh
bool contiguous< patchEdgeFaceInfo >()
Data associated with patchEdgeFaceInfo type are contiguous.
A list of faces which address into the list of points.
const point & origin() const
Istream & operator>>(Istream &, directionInfo &)
bool updateEdge(const polyMesh &mesh, const primitivePatch &patch, const label edgeI, const label facei, const patchEdgeFaceInfo &faceInfo, const scalar tol, TrackingData &td)
Influence of face on edge.
friend Ostream & operator<<(Ostream &, const patchEdgeFaceInfo &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
bool operator!=(const patchEdgeFaceInfo &) const
friend Istream & operator>>(Istream &, patchEdgeFaceInfo &)
Ostream & operator<<(Ostream &, const ensightPart &)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
Namespace for OpenFOAM.
void transform(const polyMesh &mesh, const primitivePatch &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.