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 "label.H"
42 #include "scalar.H"
43 #include "point.H"
44 #include "tensor.H"
45 #include "primitivePatch.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class polyPatch;
54 class polyMesh;
55 class patchEdgeFaceInfo;
56 
57 Istream& operator>>(Istream&, patchEdgeFaceInfo&);
58 Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
59 
60 /*---------------------------------------------------------------------------*\
61  Class patchEdgeFaceInfo Declaration
62 \*---------------------------------------------------------------------------*/
63 
65 {
66  // Private Data
67 
68  //- Position of nearest wall center
69  point origin_;
70 
71  //- Normal distance (squared) from point to origin
72  scalar distSqr_;
73 
74 
75  // Private Member Functions
76 
77  //- Evaluate distance to point.
78  // Update distSqr, origin from whomever is nearer pt.
79  // \return true if w2 is closer to point, false otherwise.
80  template<class TrackingData>
81  inline bool update
82  (
83  const point&,
84  const patchEdgeFaceInfo& w2,
85  const scalar tol,
86  TrackingData& td
87  );
88 
89  //- Combine current with w2. Update distSqr, origin if w2 has smaller
90  // quantities and returns true.
91  template<class TrackingData>
92  inline bool update
93  (
94  const patchEdgeFaceInfo& w2,
95  const scalar tol,
96  TrackingData& td
97  );
98 
99 
100 public:
101 
102  // Constructors
103 
104  //- Default construct
105  inline patchEdgeFaceInfo();
106 
107  //- Construct from origin, distance squared
108  inline patchEdgeFaceInfo(const point& origin, const scalar distSqr);
109 
110 
111  // Member Functions
112 
113  // Access
114 
115  const point& origin() const
116  {
117  return origin_;
118  }
119 
120  scalar distSqr() const
121  {
122  return distSqr_;
123  }
125 
126  // Needed by MeshWave
127 
128  //- Changed or 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  //- Test for equality, with TrackingData
182  template<class TrackingData>
183  inline bool equal(const patchEdgeFaceInfo&, TrackingData& td) const;
184 
185 
186  // Member Operators
187 
188  //- Test for equality
189  inline bool operator==(const patchEdgeFaceInfo&) const;
190 
191  //- Test for inequality
192  inline bool operator!=(const patchEdgeFaceInfo&) const;
193 
194 
195  // IOstream Operators
196 
197  friend Ostream& operator<<(Ostream&, const patchEdgeFaceInfo&);
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
203 
204 //- Contiguous data for patchEdgeFaceInfo
205 template<> struct is_contiguous<patchEdgeFaceInfo> : std::true_type {};
206 
207 //- Contiguous scalar data for patchEdgeFaceInfo
208 template<> struct is_contiguous_scalar<patchEdgeFaceInfo> : std::true_type {};
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #include "patchEdgeFaceInfoI.H"
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
bool operator==(const patchEdgeFaceInfo &) const
Test for equality.
patchEdgeFaceInfo()
Default construct.
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:28
bool equal(const patchEdgeFaceInfo &, TrackingData &td) const
Test for equality, with TrackingData.
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.
A list of faces which address into the list of points.
dynamicFvMesh & mesh
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:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
bool operator!=(const patchEdgeFaceInfo &) const
Test for inequality.
mesh update()
const point & origin() const
friend Istream & operator>>(Istream &, patchEdgeFaceInfo &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:70
const std::string patch
OpenFOAM patch number as a std::string.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Tensor of scalars, i.e. Tensor<scalar>.
Namespace for OpenFOAM.
void transform(const polyMesh &mesh, const primitivePatch &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.