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 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 /*---------------------------------------------------------------------------*\
63  Class patchEdgeFaceInfo Declaration
64 \*---------------------------------------------------------------------------*/
65 
67 {
68  // Private data
69 
70  //- Position of nearest wall center
71  point origin_;
72 
73  //- Normal distance (squared) from point to origin
74  scalar distSqr_;
75 
76 
77  // Private Member Functions
78 
79  //- Evaluate distance to point. Update distSqr, origin from whomever
80  // is nearer pt. Return true if w2 is closer to point,
81  // false otherwise.
82  template<class TrackingData>
83  inline bool update
84  (
85  const point&,
86  const patchEdgeFaceInfo& w2,
87  const scalar tol,
88  TrackingData& td
89  );
90 
91  //- Combine current with w2. Update distSqr, origin if w2 has smaller
92  // quantities and returns true.
93  template<class TrackingData>
94  inline bool update
95  (
96  const patchEdgeFaceInfo& w2,
97  const scalar tol,
98  TrackingData& td
99  );
100 
101 
102 public:
103 
104  // Constructors
105 
106  //- Construct null
107  inline patchEdgeFaceInfo();
108 
109  //- Construct from origin, distance
110  inline patchEdgeFaceInfo(const point&, const scalar);
111 
112  //- Construct as copy
113  inline patchEdgeFaceInfo(const patchEdgeFaceInfo&);
114 
115 
116  // Member Functions
117 
118  // Access
119 
120  inline const point& origin() const;
121 
122  inline scalar distSqr() const;
123 
124 
125  // Needed by meshWave
126 
127  //- Check whether origin has been changed at all or
128  // still contains original (invalid) value.
129  template<class TrackingData>
130  inline bool valid(TrackingData& td) const;
131 
132  //- Apply rotation matrix
133  template<class TrackingData>
134  inline void transform
135  (
136  const polyMesh& mesh,
137  const primitivePatch& patch,
138  const tensor& rotTensor,
139  const scalar tol,
140  TrackingData& td
141  );
142 
143  //- Influence of face on edge
144  template<class TrackingData>
145  inline bool updateEdge
146  (
147  const polyMesh& mesh,
148  const primitivePatch& patch,
149  const label edgeI,
150  const label facei,
151  const patchEdgeFaceInfo& faceInfo,
152  const scalar tol,
153  TrackingData& td
154  );
155 
156  //- New information for edge (from e.g. coupled edge)
157  template<class TrackingData>
158  inline bool updateEdge
159  (
160  const polyMesh& mesh,
161  const primitivePatch& patch,
162  const patchEdgeFaceInfo& edgeInfo,
163  const bool sameOrientation,
164  const scalar tol,
165  TrackingData& td
166  );
167 
168  //- Influence of edge on face.
169  template<class TrackingData>
170  inline bool updateFace
171  (
172  const polyMesh& mesh,
173  const primitivePatch& patch,
174  const label facei,
175  const label edgeI,
176  const patchEdgeFaceInfo& edgeInfo,
177  const scalar tol,
178  TrackingData& td
179  );
180 
181  //- Same (like operator==)
182  template<class TrackingData>
183  inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const;
184 
185 
186  // Member Operators
187 
188  // Needed for List IO
189  inline bool operator==(const patchEdgeFaceInfo&) const;
190  inline bool operator!=(const patchEdgeFaceInfo&) const;
191 
192 
193  // IOstream Operators
194 
195  friend Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
201 
202 //- Contiguous data for patchEdgeFaceInfo
203 template<> struct is_contiguous<patchEdgeFaceInfo> : std::true_type {};
204 
205 //- Contiguous scalar data for patchEdgeFaceInfo
206 template<> struct is_contiguous_scalar<patchEdgeFaceInfo> : std::true_type {};
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #include "patchEdgeFaceInfoI.H"
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
Foam::Tensor< scalar >
update
mesh update()
point.H
Foam::patchEdgeFaceInfo::patchEdgeFaceInfo
patchEdgeFaceInfo()
Construct null.
Definition: patchEdgeFaceInfoI.H:123
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
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::operator!=
bool operator!=(const patchEdgeFaceInfo &) const
Definition: patchEdgeFaceInfoI.H:262
Foam::patchEdgeFaceInfo::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: patchEdgeFaceInfoI.H:165
Foam::label
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:62
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:187
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:173
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
Definition: patchEdgeFaceInfoI.H:253
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:225
Foam::Vector< scalar >
label.H
Foam::patchEdgeFaceInfo::equal
bool equal(const patchEdgeFaceInfo &, TrackingData &td) const
Same (like operator==)
Definition: patchEdgeFaceInfoI.H:241
Foam::patchEdgeFaceInfo
Definition: patchEdgeFaceInfo.H:65
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
primitivePatch.H
Foam::patchEdgeFaceInfo::distSqr
scalar distSqr() const
Definition: patchEdgeFaceInfoI.H:158
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
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:90
Foam::patchEdgeFaceInfo::origin
const point & origin() const
Definition: patchEdgeFaceInfoI.H:152