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-2018 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  //- Construct as copy
115  inline patchEdgeFaceInfo(const patchEdgeFaceInfo&);
116 
117 
118  // Member Functions
119 
120  // Access
121 
122  inline const point& origin() const;
123 
124  inline scalar distSqr() const;
125 
126 
127  // Needed by meshWave
128 
129  //- Check whether origin has been changed at all or
130  // still contains original (invalid) value.
131  template<class TrackingData>
132  inline bool valid(TrackingData& td) const;
133 
134  //- Apply rotation matrix
135  template<class TrackingData>
136  inline void transform
137  (
138  const polyMesh& mesh,
139  const primitivePatch& patch,
140  const tensor& rotTensor,
141  const scalar tol,
142  TrackingData& td
143  );
144 
145  //- Influence of face on edge
146  template<class TrackingData>
147  inline bool updateEdge
148  (
149  const polyMesh& mesh,
150  const primitivePatch& patch,
151  const label edgeI,
152  const label facei,
153  const patchEdgeFaceInfo& faceInfo,
154  const scalar tol,
155  TrackingData& td
156  );
157 
158  //- New information for edge (from e.g. coupled edge)
159  template<class TrackingData>
160  inline bool updateEdge
161  (
162  const polyMesh& mesh,
163  const primitivePatch& patch,
164  const patchEdgeFaceInfo& edgeInfo,
165  const bool sameOrientation,
166  const scalar tol,
167  TrackingData& td
168  );
169 
170  //- Influence of edge on face.
171  template<class TrackingData>
172  inline bool updateFace
173  (
174  const polyMesh& mesh,
175  const primitivePatch& patch,
176  const label facei,
177  const label edgeI,
178  const patchEdgeFaceInfo& edgeInfo,
179  const scalar tol,
180  TrackingData& td
181  );
182 
183  //- Same (like operator==)
184  template<class TrackingData>
185  inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const;
186 
187 
188  // Member Operators
189 
190  // Needed for List IO
191  inline bool operator==(const patchEdgeFaceInfo&) const;
192  inline bool operator!=(const patchEdgeFaceInfo&) const;
193 
194 
195  // IOstream Operators
196 
197  friend Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
199 };
200 
201 
202 //- Data associated with patchEdgeFaceInfo type are contiguous
203 template<>
204 inline bool contiguous<patchEdgeFaceInfo>()
205 {
206  return true;
207 }
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #include "patchEdgeFaceInfoI.H"
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
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
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.
bool contiguous< patchEdgeFaceInfo >()
Data associated with patchEdgeFaceInfo type are contiguous.
A list of faces which address into the list of points.
dynamicFvMesh & mesh
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:53
bool operator!=(const patchEdgeFaceInfo &) const
friend Istream & operator>>(Istream &, patchEdgeFaceInfo &)
Ostream & operator<<(Ostream &, const ensightPart &)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.
void transform(const polyMesh &mesh, const primitivePatch &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.