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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::patchEdgeFaceInfo
29 
30 Description
31 
32 SourceFiles
33  patchEdgeFaceInfoI.H
34  patchEdgeFaceInfo.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef patchEdgeFaceInfo_H
39 #define patchEdgeFaceInfo_H
40 
41 #include "point.H"
42 #include "label.H"
43 #include "scalar.H"
44 #include "tensor.H"
45 #include "pTraits.H"
46 #include "primitivePatch.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class polyPatch;
55 class polyMesh;
56 class patchEdgeFaceInfo;
57 
58 Istream& operator>>(Istream&, patchEdgeFaceInfo&);
59 Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
60 
61 /*---------------------------------------------------------------------------*\
62  Class patchEdgeFaceInfo Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67  // Private Data
68 
69  //- Position of nearest wall center
70  point origin_;
71 
72  //- Normal distance (squared) from point to origin
73  scalar distSqr_;
74 
75 
76  // Private Member Functions
77 
78  //- Evaluate distance to point.
79  // Update distSqr, origin from whomever is nearer pt.
80  // \return true if w2 is closer to point, false otherwise.
81  template<class TrackingData>
82  inline bool update
83  (
84  const point&,
85  const patchEdgeFaceInfo& w2,
86  const scalar tol,
87  TrackingData& td
88  );
89 
90  //- Combine current with w2. Update distSqr, origin if w2 has smaller
91  // quantities and returns true.
92  template<class TrackingData>
93  inline bool update
94  (
95  const patchEdgeFaceInfo& w2,
96  const scalar tol,
97  TrackingData& td
98  );
99 
100 
101 public:
102 
103  // Constructors
104 
105  //- Default construct
106  inline patchEdgeFaceInfo();
107 
108  //- Construct from origin, distance squared
109  inline patchEdgeFaceInfo(const point& origin, const scalar distSqr);
110 
111 
112  // Member Functions
113 
114  // Access
115 
116  const point& origin() const
117  {
118  return origin_;
119  }
120 
121  scalar distSqr() const
122  {
123  return distSqr_;
124  }
125 
126 
127  // Needed by MeshWave
128 
129  //- Changed or contains original (invalid) value
130  template<class TrackingData>
131  inline bool valid(TrackingData& td) const;
132 
133  //- Apply rotation matrix
134  template<class TrackingData>
135  inline void transform
136  (
137  const polyMesh& mesh,
138  const primitivePatch& patch,
139  const tensor& rotTensor,
140  const scalar tol,
141  TrackingData& td
142  );
143 
144  //- Influence of face on edge
145  template<class TrackingData>
146  inline bool updateEdge
147  (
148  const polyMesh& mesh,
149  const primitivePatch& patch,
150  const label edgeI,
151  const label facei,
152  const patchEdgeFaceInfo& faceInfo,
153  const scalar tol,
154  TrackingData& td
155  );
156 
157  //- New information for edge (from e.g. coupled edge)
158  template<class TrackingData>
159  inline bool updateEdge
160  (
161  const polyMesh& mesh,
162  const primitivePatch& patch,
163  const patchEdgeFaceInfo& edgeInfo,
164  const bool sameOrientation,
165  const scalar tol,
166  TrackingData& td
167  );
168 
169  //- Influence of edge on face.
170  template<class TrackingData>
171  inline bool updateFace
172  (
173  const polyMesh& mesh,
174  const primitivePatch& patch,
175  const label facei,
176  const label edgeI,
177  const patchEdgeFaceInfo& edgeInfo,
178  const scalar tol,
179  TrackingData& td
180  );
181 
182  //- Test for equality, with TrackingData
183  template<class TrackingData>
184  inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const;
185 
186 
187  // Member Operators
188 
189  //- Test for equality
190  inline bool operator==(const patchEdgeFaceInfo&) const;
191 
192  //- Test for inequality
193  inline bool operator!=(const patchEdgeFaceInfo&) const;
194 
195 
196  // IOstream Operators
197 
198  friend Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
204 
205 //- Contiguous data for patchEdgeFaceInfo
206 template<> struct is_contiguous<patchEdgeFaceInfo> : std::true_type {};
207 
208 //- Contiguous scalar data for patchEdgeFaceInfo
209 template<> struct is_contiguous_scalar<patchEdgeFaceInfo> : std::true_type {};
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #include "patchEdgeFaceInfoI.H"
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::patchEdgeFaceInfo::origin
const point & origin() const
Definition: patchEdgeFaceInfo.H:115
update
mesh update()
point.H
Foam::patchEdgeFaceInfo::patchEdgeFaceInfo
patchEdgeFaceInfo()
Default construct.
Definition: patchEdgeFaceInfoI.H:123
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::patchEdgeFaceInfo::operator<<
friend Ostream & operator<<(Ostream &, const patchEdgeFaceInfo &)
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::patchEdgeFaceInfo::distSqr
scalar distSqr() const
Definition: patchEdgeFaceInfo.H:120
Foam::patchEdgeFaceInfo::operator!=
bool operator!=(const patchEdgeFaceInfo &) const
Test for inequality.
Definition: patchEdgeFaceInfoI.H:242
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::patchEdgeFaceInfo::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: patchEdgeFaceInfoI.H:143
Foam::patchEdgeFaceInfo::updateEdge
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.
Definition: patchEdgeFaceInfoI.H:165
Foam::patchEdgeFaceInfo::transform
void transform(const polyMesh &mesh, const primitivePatch &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.
Definition: patchEdgeFaceInfoI.H:151
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
patchEdgeFaceInfoI.H
scalar.H
w2
#define w2
Definition: blockCreate.C:35
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
pTraits.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchEdgeFaceInfo::operator>>
friend Istream & operator>>(Istream &, patchEdgeFaceInfo &)
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
Foam::patchEdgeFaceInfo::operator==
bool operator==(const patchEdgeFaceInfo &) const
Test for equality.
Definition: patchEdgeFaceInfoI.H:233
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::patchEdgeFaceInfo::updateFace
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.
Definition: patchEdgeFaceInfoI.H:205
Foam::Vector< scalar >
label.H
Foam::patchEdgeFaceInfo::equal
bool equal(const patchEdgeFaceInfo &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: patchEdgeFaceInfoI.H:221
Foam::patchEdgeFaceInfo
Definition: patchEdgeFaceInfo.H:64
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
primitivePatch.H
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79