pointEdgeDist.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) 2013-2024 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::pointEdgeDist
26 
27 Description
28  Holds information regarding nearest wall point. Used in PointEdgeWave.
29  (so not standard FaceCellWave)
30  To be used in wall distance calculation.
31 
32 SourceFiles
33  pointEdgeDistI.H
34  pointEdgeDist.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef pointEdgeDist_H
39 #define pointEdgeDist_H
40 
41 #include "pointField.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of classes
49 class polyPatch;
50 class polyMesh;
51 class transformer;
52 
53 
54 // Forward declaration of friend functions and operators
55 
56 class pointEdgeDist;
57 
58 Istream& operator>>(Istream&, pointEdgeDist&);
59 Ostream& operator<<(Ostream&, const pointEdgeDist&);
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class pointEdgeDist Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class pointEdgeDist
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 public:
78 
79  //- Class used to pass data into container
80  class data
81  {
82  public:
84  const scalar maxDistSqr;
85 
86  data(const pointField& p, const scalar maxDist = rootVGreat)
87  :
88  points(p),
89  maxDistSqr(sqr(maxDist))
90  {}
91  };
92 
93 
94 private:
95 
96  // Private Member Functions
97 
98  //- Evaluate distance to point. Update distSqr, origin from whomever
99  // is nearer pt. Return true if w2 is closer to point,
100  // false otherwise.
101  inline bool update
102  (
103  const point&,
104  const pointEdgeDist& w2,
105  const scalar tol,
106  data& td
107  );
108 
109 
110 public:
111 
112  // Constructors
113 
114  //- Construct null
115  inline pointEdgeDist();
116 
117  //- Construct from origin, distance
118  inline pointEdgeDist(const point&, const scalar);
119 
120 
121  // Member Functions
122 
123  // Access
124 
125  inline const point& origin() const;
126 
127  inline scalar distSqr() const;
128 
129 
130  // Needed by PointEdgeWave
131 
132  //- Check whether origin has been changed at all or
133  // still contains original (invalid) value.
134  inline bool valid(data& td) const;
135 
136  //- Transform across an interface
137  inline void transform
138  (
139  const polyPatch& patch,
140  const label patchFacei,
141  const transformer& transform,
142  data& td
143  );
144 
145  //- Influence of edge on point
146  inline bool updatePoint
147  (
148  const polyMesh& mesh,
149  const label pointi,
150  const label edgei,
151  const pointEdgeDist& edgeinfo,
152  const scalar tol,
153  data& td
154  );
155 
156  //- Influence of different value on same point.
157  // Merge new and old info.
158  inline bool updatePoint
159  (
160  const polyMesh& mesh,
161  const label pointi,
162  const pointEdgeDist& newPointInfo,
163  const scalar tol,
164  data& td
165  );
166 
167  //- Influence of point on edge.
168  inline bool updateEdge
169  (
170  const polyMesh& mesh,
171  const label edgei,
172  const label pointi,
173  const pointEdgeDist& pointInfo,
174  const scalar tol,
175  data& td
176  );
177 
178  //- Equivalent to operator== with data
179  inline bool equal
180  (
181  const pointEdgeDist&,
182  data& td
183  ) const;
184 
185 
186  // Member Operators
187 
188  // Needed for List IO
189  inline bool operator==(const pointEdgeDist&) const;
190  inline bool operator!=(const pointEdgeDist&) const;
191 
192 
193  // IOstream Operators
194 
197 };
198 
199 
200 //- Data associated with pointEdgeDist type are contiguous
201 template<>
202 inline bool contiguous<pointEdgeDist>()
203 {
204  return true;
205 }
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #include "pointEdgeDistI.H"
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
#define w2
Definition: blockCreate.C:32
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Class used to pass data into container.
Definition: pointEdgeDist.H:80
const pointField & points
Definition: pointEdgeDist.H:82
data(const pointField &p, const scalar maxDist=rootVGreat)
Definition: pointEdgeDist.H:85
Holds information regarding nearest wall point. Used in PointEdgeWave. (so not standard FaceCellWave)...
Definition: pointEdgeDist.H:66
scalar distSqr() const
friend Istream & operator>>(Istream &, pointEdgeDist &)
pointEdgeDist()
Construct null.
bool equal(const pointEdgeDist &, data &td) const
Equivalent to operator== with data.
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgei, const pointEdgeDist &edgeinfo, const scalar tol, data &td)
Influence of edge on point.
friend Ostream & operator<<(Ostream &, const pointEdgeDist &)
bool operator!=(const pointEdgeDist &) const
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, data &td)
Transform across an interface.
bool updateEdge(const polyMesh &mesh, const label edgei, const label pointi, const pointEdgeDist &pointInfo, const scalar tol, data &td)
Influence of point on edge.
const point & origin() const
bool operator==(const pointEdgeDist &) const
bool valid(data &td) const
Check whether origin has been changed at all or.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Namespace for OpenFOAM.
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
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool contiguous< pointEdgeDist >()
Data associated with pointEdgeDist type are contiguous.
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
volScalarField & p