patchEdgeFaceInfo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 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 class polyPatch;
52 class polyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class patchEdgeFaceInfo Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 {
60  // Private data
61 
62  //- Position of nearest wall center
63  point origin_;
64 
65  //- Normal distance (squared) from point to origin
66  scalar distSqr_;
67 
68 
69  // Private Member Functions
70 
71  //- Evaluate distance to point. Update distSqr, origin from whomever
72  // is nearer pt. Return true if w2 is closer to point,
73  // false otherwise.
74  template<class TrackingData>
75  inline bool update
76  (
77  const point&,
78  const patchEdgeFaceInfo& w2,
79  const scalar tol,
80  TrackingData& td
81  );
82 
83  //- Combine current with w2. Update distSqr, origin if w2 has smaller
84  // quantities and returns true.
85  template<class TrackingData>
86  inline bool update
87  (
88  const patchEdgeFaceInfo& w2,
89  const scalar tol,
90  TrackingData& td
91  );
92 
93 
94 public:
95 
96  // Constructors
97 
98  //- Construct null
99  inline patchEdgeFaceInfo();
100 
101  //- Construct from origin, distance
102  inline patchEdgeFaceInfo(const point&, const scalar);
103 
104  //- Construct as copy
105  inline patchEdgeFaceInfo(const patchEdgeFaceInfo&);
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  inline const point& origin() const;
113 
114  inline scalar distSqr() const;
115 
116 
117  // Needed by meshWave
118 
119  //- Check whether origin has been changed at all or
120  // still contains original (invalid) value.
121  template<class TrackingData>
122  inline bool valid(TrackingData& td) const;
123 
124  //- Apply rotation matrix
125  template<class TrackingData>
126  inline void transform
127  (
128  const polyMesh& mesh,
129  const primitivePatch& patch,
130  const tensor& rotTensor,
131  const scalar tol,
132  TrackingData& td
133  );
134 
135  //- Influence of face on edge
136  template<class TrackingData>
137  inline bool updateEdge
138  (
139  const polyMesh& mesh,
140  const primitivePatch& patch,
141  const label edgeI,
142  const label faceI,
143  const patchEdgeFaceInfo& faceInfo,
144  const scalar tol,
145  TrackingData& td
146  );
147 
148  //- New information for edge (from e.g. coupled edge)
149  template<class TrackingData>
150  inline bool updateEdge
151  (
152  const polyMesh& mesh,
153  const primitivePatch& patch,
154  const patchEdgeFaceInfo& edgeInfo,
155  const bool sameOrientation,
156  const scalar tol,
157  TrackingData& td
158  );
159 
160  //- Influence of edge on face.
161  template<class TrackingData>
162  inline bool updateFace
163  (
164  const polyMesh& mesh,
165  const primitivePatch& patch,
166  const label faceI,
167  const label edgeI,
168  const patchEdgeFaceInfo& edgeInfo,
169  const scalar tol,
170  TrackingData& td
171  );
172 
173  //- Same (like operator==)
174  template<class TrackingData>
175  inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const;
176 
177 
178  // Member Operators
179 
180  // Needed for List IO
181  inline bool operator==(const patchEdgeFaceInfo&) const;
182  inline bool operator!=(const patchEdgeFaceInfo&) const;
183 
184 
185  // IOstream Operators
186 
187  friend Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
189 };
190 
191 
192 //- Data associated with patchEdgeFaceInfo type are contiguous
193 template<>
194 inline bool contiguous<patchEdgeFaceInfo>()
195 {
196  return true;
197 }
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #include "patchEdgeFaceInfoI.H"
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
const point & origin() const
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.
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
bool operator!=(const patchEdgeFaceInfo &) const
void transform(const polyMesh &mesh, const primitivePatch &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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
friend Istream & operator>>(Istream &, patchEdgeFaceInfo &)
bool equal(const patchEdgeFaceInfo &, TrackingData &td) const
Same (like operator==)
bool contiguous< patchEdgeFaceInfo >()
Data associated with patchEdgeFaceInfo type are contiguous.
dynamicFvMesh & mesh
friend Ostream & operator<<(Ostream &, const patchEdgeFaceInfo &)
Namespace for OpenFOAM.
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 operator==(const patchEdgeFaceInfo &) const
A list of faces which address into the list of points.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
patchEdgeFaceInfo()
Construct null.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53