wallPointAddressing.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) 2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::wallPointAddressing
28 
29 Description
30  Holds information (coordinate and origin) regarding nearest wall point.
31 
32  Is like wallPoint but transfer extra (passive) data.
33  Used e.g. in wall distance calculation with wall reflection vectors.
34 
35 SourceFiles
36  wallPointAddressingI.H
37  wallPointAddressing.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef wallPointAddressing_H
42 #define wallPointAddressing_H
43 
44 #include "wallPoint.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class globalIndexAndTransform;
53 class wallPointAddressing;
54 
55 Ostream& operator<<(Ostream&, const wallPointAddressing&);
56 Istream& operator>>(Istream&, wallPointAddressing&);
57 
58 
59 /*---------------------------------------------------------------------------*\
60  Class wallPointAddressing Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 :
65  public wallPoint
66 {
67  // Private Data
68 
69  //- Data at nearest wall center
70  labelPair data_;
71 
72 
73  // Private Member Functions
74 
75  //- Initialise data so it uses the nulltransformindex
76  inline void setNull(const globalIndexAndTransform& gt);
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 wallPointAddressing& w2,
86  const scalar tol,
87  TrackingData& td
88  );
89 
90 
91 public:
92 
93  // Constructors
94 
95  //- Default construct
96  inline wallPointAddressing();
97 
98  //- Construct from origin, transforms, distance
99  inline wallPointAddressing
100  (
101  const point& origin,
102  const labelPair& data,
103  const scalar distSqr
104  );
105 
106 
107  // Member Functions
108 
109  // Access
110 
111  const labelPair& data() const
112  {
113  return data_;
114  }
115  labelPair& data()
116  {
117  return data_;
118  }
119 
120 
121  // Needed by MeshWave
122 
123  //- Convert any absolute coordinates into relative to (patch)face
124  //- centre
125  template<class TrackingData>
126  inline void leaveDomain
127  (
128  const polyMesh&,
129  const polyPatch&,
130  const label patchFacei,
131  const point& faceCentre,
132  TrackingData& td
133  );
134 
135  //- Influence of neighbouring face.
136  // Calls update(...) with cellCentre of celli
137  template<class TrackingData>
138  inline bool updateCell
139  (
140  const polyMesh& mesh,
141  const label thisCelli,
142  const label neighbourFacei,
143  const wallPointAddressing& neighbourWallInfo,
144  const scalar tol,
145  TrackingData& td
146  );
147 
148  //- Influence of neighbouring cell.
149  // Calls update(...) with faceCentre of facei
150  template<class TrackingData>
151  inline bool updateFace
152  (
153  const polyMesh& mesh,
154  const label thisFacei,
155  const label neighbourCelli,
156  const wallPointAddressing& neighbourWallInfo,
157  const scalar tol,
158  TrackingData& td
159  );
160 
161  //- Influence of different value on same face.
162  // Merge new and old info.
163  // Calls update(...) with faceCentre of facei
164  template<class TrackingData>
165  inline bool updateFace
166  (
167  const polyMesh& mesh,
168  const label thisFacei,
169  const wallPointAddressing& neighbourWallInfo,
170  const scalar tol,
171  TrackingData& td
172  );
173 
174 
175  // IOstream Operators
176 
177  friend Ostream& operator<<(Ostream&, const wallPointAddressing&);
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
183 
184 //- Data are contiguous if data type is contiguous
185 template<>
187 : is_contiguous<wallPoint>
188 {};
189 
190 template<>
191 struct is_contiguous_scalar<wallPointAddressing>
192 : is_contiguous_scalar<wallPoint>
193 {};
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #include "wallPointAddressingI.H"
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
bool updateFace(const polyMesh &mesh, const label thisFacei, const label neighbourCelli, const wallPointAddressing &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
scalar distSqr() const
Definition: wallPoint.H:122
#define w2
Definition: blockCreate.C:28
bool updateCell(const polyMesh &mesh, const label thisCelli, const label neighbourFacei, const wallPointAddressing &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
const labelPair & data() const
dynamicFvMesh & mesh
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face centre.
Istream & operator>>(Istream &, directionInfo &)
const point & origin() const
Definition: wallPoint.H:113
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...
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition: wallPoint.H:61
friend Istream & operator>>(Istream &, wallPointAddressing &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
Holds information (coordinate and origin) regarding nearest wall point.
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:70
wallPointAddressing()
Default construct.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
friend Ostream & operator<<(Ostream &, const wallPointAddressing &)
Namespace for OpenFOAM.
Determination and storage of the possible independent transforms introduced by coupledPolyPatches, as well as all of the possible permutations of these transforms generated by the presence of multiple coupledPolyPatches, i.e. more than one cyclic boundary. Note that any given point can be on maximum 3 transforms only (and these transforms have to be perpendicular)