wallPoints.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) 2018-2020,2022 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::wallPoints
28 
29 Description
30  For use with FaceCellWave. Determines topological distance to starting faces
31 
32 SourceFiles
33  wallPointsI.H
34  wallPoints.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef wallPoints_H
39 #define wallPoints_H
40 
41 #include "point.H"
42 #include "tensor.H"
43 #include "DynamicList.H"
44 #include "labelList.H"
45 #include "scalarList.H"
46 #include "bitSet.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class polyPatch;
55 class polyMesh;
56 class wallPoints;
57 Istream& operator>>(Istream&, wallPoints&);
58 Ostream& operator<<(Ostream&, const wallPoints&);
59 
60 /*---------------------------------------------------------------------------*\
61  Class wallPoints Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class wallPoints
65 {
66 public:
67 
68  //- Class used to pass additional data in
69  class trackData
70  {
71  public:
72 
73  //- Per face whether the face should not be walked through
74  const bitSet& isBlockedFace_;
75 
76  //- Per surface, per region the blockSize
78 
79  trackData
80  (
81  const bitSet& isBlockedFace,
82  const List<scalarList>& regionToBlockSize
83  )
84  :
85  isBlockedFace_(isBlockedFace),
86  regionToBlockSize_(regionToBlockSize)
87  {}
88  };
89 
90 
91 protected:
92 
93  // Protected Data
94 
95  //- Starting points
97 
98  //- Distance (squared) from cellcenter to origin
100 
101  //- Originating surface,region and topological region
103 
104  //- Originating normal
105  //DynamicList<vector> normal_;
106 
107 
108  // Protected Member Functions
110  //- Evaluate distance to point.
111  // Update distSqr, origin from whomever is nearer pt.
112  // \return true if w2 is closer to point, false otherwise.
113  template<class TrackingData>
114  inline bool update
115  (
116  const point& pt,
117  const label index1,
118  const wallPoints& w2,
119  const label index2,
120 
121  const scalar tol,
122  TrackingData& td
123  );
124 
125 
126 public:
127 
128  // Constructors
129 
130  //- Default construct
131  inline wallPoints();
132 
133  //- Construct from count
134  inline wallPoints
135  (
136  const UList<point>& origin,
137  const UList<scalar>& distSqr,
139  //const UList<vector>& normal
140  );
141 
142 
143  // Member Functions
144 
145  // Access
146 
147  const List<point>& origin() const
148  {
149  return origin_;
150  }
151  const List<scalar>& distSqr() const
152  {
153  return distSqr_;
154  }
155 
156  const List<FixedList<label, 3>>& surface() const
157  {
158  return surface_;
159  }
160 
161  //const List<vector>& normal() const
162  //{
163  // return normal_;
164  //}
165 
166 
167  // Needed by FaceCellWave
169  //- Changed or contains original (invalid) value
170  template<class TrackingData>
171  inline bool valid(TrackingData& td) const;
172 
173  //- Check for identical geometrical data (eg, cyclics checking)
174  template<class TrackingData>
175  inline bool sameGeometry
176  (
177  const polyMesh&,
178  const wallPoints&,
179  const scalar,
180  TrackingData& td
181  ) const;
182 
183  //- Convert any absolute coordinates into relative to (patch)face
184  // centre
185  template<class TrackingData>
186  inline void leaveDomain
187  (
188  const polyMesh&,
189  const polyPatch&,
190  const label patchFacei,
191  const point& faceCentre,
192  TrackingData& td
193  );
194 
195  //- Reverse of leaveDomain
196  template<class TrackingData>
197  inline void enterDomain
198  (
199  const polyMesh&,
200  const polyPatch&,
201  const label patchFacei,
202  const point& faceCentre,
203  TrackingData& td
204  );
205 
206  //- Apply rotation matrix to any coordinates
207  template<class TrackingData>
208  inline void transform
209  (
210  const polyMesh&,
211  const tensor&,
212  TrackingData& td
213  );
214 
215  //- Influence of neighbouring face.
216  template<class TrackingData>
217  inline bool updateCell
218  (
219  const polyMesh&,
220  const label thisCelli,
221  const label neighbourFacei,
222  const wallPoints& neighbourInfo,
223  const scalar tol,
224  TrackingData& td
225  );
226 
227  //- Influence of neighbouring cell.
228  template<class TrackingData>
229  inline bool updateFace
230  (
231  const polyMesh&,
232  const label thisFacei,
233  const label neighbourCelli,
234  const wallPoints& neighbourInfo,
235  const scalar tol,
236  TrackingData& td
237  );
238 
239  //- Influence of different value on same face.
240  template<class TrackingData>
241  inline bool updateFace
242  (
243  const polyMesh&,
244  const label thisFacei,
245  const wallPoints& neighbourInfo,
246  const scalar tol,
247  TrackingData& td
248  );
249 
250  //- Test for equality, with TrackingData
251  template<class TrackingData>
252  inline bool equal(const wallPoints&, TrackingData&) const;
253 
254 
255  // Member Operators
256 
257  //- Test for equality
258  inline bool operator==(const wallPoints&) const;
259 
260  //- Test for inequality
261  inline bool operator!=(const wallPoints&) const;
262 
263 
264  // IOstream Operators
265 
266  friend Ostream& operator<<(Ostream&, const wallPoints&);
267  friend Istream& operator>>(Istream&, wallPoints&);
268 };
269 
270 
271 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272 
273 } // End namespace Foam
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 #include "wallPointsI.H"
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 #endif
282 
283 // ************************************************************************* //
trackData(const bitSet &isBlockedFace, const List< scalarList > &regionToBlockSize)
Definition: wallPoints.H:81
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const wallPoints &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: wallPointsI.H:256
bool update(const point &pt, const label index1, const wallPoints &w2, const label index2, const scalar tol, TrackingData &td)
Originating normal.
Definition: wallPointsI.H:28
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: wallPointsI.H:110
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const wallPoints &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: wallPointsI.H:186
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Class used to pass additional data in.
Definition: wallPoints.H:66
const bitSet & isBlockedFace_
Per face whether the face should not be walked through.
Definition: wallPoints.H:73
#define w2
Definition: blockCreate.C:28
const List< scalarList > & regionToBlockSize_
Per surface, per region the blockSize.
Definition: wallPoints.H:78
const List< scalar > & distSqr() const
Definition: wallPoints.H:168
const List< point > & origin() const
Definition: wallPoints.H:164
friend Ostream & operator<<(Ostream &, const wallPoints &)
bool equal(const wallPoints &, TrackingData &) const
Test for equality, with TrackingData.
Definition: wallPointsI.H:392
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: wallPointsI.H:133
Istream & operator>>(Istream &, directionInfo &)
bool sameGeometry(const polyMesh &, const wallPoints &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: wallPointsI.H:119
DynamicList< FixedList< label, 3 > > surface_
Originating surface,region and topological region.
Definition: wallPoints.H:109
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
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...
wallPoints()
Default construct.
Definition: wallPointsI.H:83
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: wallPointsI.H:151
For use with FaceCellWave. Determines topological distance to starting faces.
Definition: wallPoints.H:59
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:59
friend Istream & operator>>(Istream &, wallPoints &)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
DynamicList< scalar > distSqr_
Distance (squared) from cellcenter to origin.
Definition: wallPoints.H:104
DynamicList< point > origin_
Starting points.
Definition: wallPoints.H:99
bool operator==(const wallPoints &) const
Test for equality.
Definition: wallPointsI.H:404
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
const List< FixedList< label, 3 > > & surface() const
Definition: wallPoints.H:173
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: wallPointsI.H:167
bool operator!=(const wallPoints &) const
Test for inequality.
Definition: wallPointsI.H:417
Tensor of scalars, i.e. Tensor<scalar>.
Namespace for OpenFOAM.