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-2026 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(const data& td) const;
135 
136  //- Check whether origin and distSqr have been set
137  inline bool set(const data& td) const;
138 
139  //- Transform across an interface
140  inline void transform
141  (
142  const polyPatch& patch,
143  const label patchFacei,
144  const transformer& transform,
145  data& td
146  );
147 
148  //- Influence of edge on point
149  inline bool updatePoint
150  (
151  const polyMesh& mesh,
152  const label pointi,
153  const label edgei,
154  const pointEdgeDist& edgeinfo,
155  const scalar tol,
156  data& td
157  );
158 
159  //- Influence of different value on same point.
160  // Merge new and old info.
161  inline bool updatePoint
162  (
163  const polyMesh& mesh,
164  const label pointi,
165  const pointEdgeDist& newPointInfo,
166  const scalar tol,
167  data& td
168  );
169 
170  //- Influence of point on edge.
171  inline bool updateEdge
172  (
173  const polyMesh& mesh,
174  const label edgei,
175  const label pointi,
176  const pointEdgeDist& pointInfo,
177  const scalar tol,
178  data& td
179  );
180 
181  //- Equivalent to operator== with data
182  inline bool equal
183  (
184  const pointEdgeDist&,
185  data& td
186  ) const;
187 
188 
189  // Member Operators
190 
191  // Needed for List IO
192  inline bool operator==(const pointEdgeDist&) const;
193  inline bool operator!=(const pointEdgeDist&) const;
194 
195 
196  // IOstream Operators
197 
200 };
201 
202 
203 //- Data associated with pointEdgeDist type are contiguous
204 template<>
205 inline bool contiguous<pointEdgeDist>()
206 {
207  return true;
208 }
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #include "pointEdgeDistI.H"
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
#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
bool valid(const data &td) const
Check whether origin has been changed at all or.
scalar distSqr() const
bool set(const data &td) const
Check whether origin and distSqr have been set.
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
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:71
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
Istream & operator>>(Istream &, pointEdgeDist &)
Definition: pointEdgeDist.C:41
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
bool contiguous< pointEdgeDist >()
Data associated with pointEdgeDist type are contiguous.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
volScalarField & p