pointEdgeStructuredWalk.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::pointEdgeStructuredWalk
29 
30 Description
31  Determines length of string of edges walked to point.
32 
33 SourceFiles
34  pointEdgeStructuredWalkI.H
35  pointEdgeStructuredWalk.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef pointEdgeStructuredWalk_H
40 #define pointEdgeStructuredWalk_H
41 
42 #include "point.H"
43 #include "tensor.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class polyPatch;
52 class polyMesh;
53 class pointEdgeStructuredWalk;
54 
55 Istream& operator>>(Istream&, pointEdgeStructuredWalk&);
56 Ostream& operator<<(Ostream&, const pointEdgeStructuredWalk&);
57 
58 /*---------------------------------------------------------------------------*\
59  Class pointEdgeStructuredWalk Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 {
64  // Private Data
65 
66  //- Starting location
67  point point0_;
68 
69  //- Previous point
70  point previousPoint_;
71 
72  //- Sum of distance
73  scalar dist_;
74 
75  //- Passive data
76  vector data_;
77 
78  //- Index of passive data (optional)
79  label index_;
80 
81 
82  // Private Member Functions
83 
84  //- Evaluate distance to point.
85  template<class TrackingData>
86  inline bool update
87  (
89  const scalar tol,
90  TrackingData& td
91  );
92 
93 public:
94 
95  // Constructors
96 
97  //- Default construct
98  inline pointEdgeStructuredWalk();
99 
100  //- Construct from components
102  (
103  const point& point0,
104  const point& previousPoint,
105  const scalar dist,
106  const vector& data,
107  const label index = -1
108  );
109 
110 
111  // Member Functions
112 
113  // Access
114 
115  //- The distance information
116  scalar dist() const
117  {
118  return dist_;
119  }
120 
121  //- Tracking data
122  const vector& data() const
123  {
124  return data_;
125  }
126 
127  //- Index (if any) associated with data
128  label index() const
129  {
130  return index_;
131  }
132 
133  //- True if starting point is valid (ie, not point::max)
134  inline bool inZone() const;
135 
136 
137  // Needed by MeshWave
138 
139  //- Changed or contains original (invalid) value
140  template<class TrackingData>
141  inline bool valid(TrackingData& td) const;
142 
143  //- Check for identical geometrical data (eg, cyclics checking)
144  template<class TrackingData>
145  inline bool sameGeometry
146  (
148  const scalar tol,
149  TrackingData& td
150  ) const;
151 
152  //- Convert origin to relative vector to leaving point
153  // (= point coordinate)
154  template<class TrackingData>
155  inline void leaveDomain
156  (
157  const polyPatch& patch,
158  const label patchPointi,
159  const point& pos,
160  TrackingData& td
161  );
162 
163  //- Convert relative origin to absolute by adding entering point
164  template<class TrackingData>
165  inline void enterDomain
166  (
167  const polyPatch& patch,
168  const label patchPointi,
169  const point& pos,
170  TrackingData& td
171  );
172 
173  //- Apply rotation matrix to origin
174  template<class TrackingData>
175  inline void transform
176  (
177  const tensor& rotTensor,
178  TrackingData& td
179  );
180 
181  //- Influence of edge on point
182  template<class TrackingData>
183  inline bool updatePoint
184  (
185  const polyMesh& mesh,
186  const label pointi,
187  const label edgeI,
188  const pointEdgeStructuredWalk& edgeInfo,
189  const scalar tol,
190  TrackingData& td
191  );
192 
193  //- Influence of different value on same point.
194  // Merge new and old info.
195  template<class TrackingData>
196  inline bool updatePoint
197  (
198  const polyMesh& mesh,
199  const label pointi,
200  const pointEdgeStructuredWalk& newPointInfo,
201  const scalar tol,
202  TrackingData& td
203  );
204 
205  //- Influence of different value on same point.
206  // No information about current position whatsoever.
207  template<class TrackingData>
208  inline bool updatePoint
209  (
210  const pointEdgeStructuredWalk& newPointInfo,
211  const scalar tol,
212  TrackingData& td
213  );
214 
215  //- Influence of point on edge.
216  template<class TrackingData>
217  inline bool updateEdge
218  (
219  const polyMesh& mesh,
220  const label edgeI,
221  const label pointi,
222  const pointEdgeStructuredWalk& pointInfo,
223  const scalar tol,
224  TrackingData& td
225  );
226 
227  //- Test for equality, with TrackingData
228  template<class TrackingData>
229  inline bool equal
230  (
232  TrackingData&
233  ) const;
234 
235 
236  // Member Operators
237 
238  //- Test for equality
239  inline bool operator==(const pointEdgeStructuredWalk&) const;
240 
241  //- Test for inequality
242  inline bool operator!=(const pointEdgeStructuredWalk&) const;
243 
244 
245  // IOstream Operators
246 
249 };
250 
251 
252 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
253 
254 //- Contiguous data for pointEdgeStructuredWalk
255 template<> struct is_contiguous<pointEdgeStructuredWalk> : std::true_type {};
256 
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 } // End namespace Foam
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #endif
269 
270 // ************************************************************************* //
Foam::pointEdgeStructuredWalk::operator==
bool operator==(const pointEdgeStructuredWalk &) const
Test for equality.
Definition: pointEdgeStructuredWalkI.H:259
Foam::pointEdgeStructuredWalk::updateEdge
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const pointEdgeStructuredWalk &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
Definition: pointEdgeStructuredWalkI.H:227
Foam::Tensor< scalar >
pointEdgeStructuredWalkI.H
Foam::pointEdgeStructuredWalk::enterDomain
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
Definition: pointEdgeStructuredWalkI.H:158
Foam::pointEdgeStructuredWalk
Determines length of string of edges walked to point.
Definition: pointEdgeStructuredWalk.H:61
point.H
Foam::pointEdgeStructuredWalk::transform
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
Definition: pointEdgeStructuredWalkI.H:145
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::pointEdgeStructuredWalk::index
label index() const
Index (if any) associated with data.
Definition: pointEdgeStructuredWalk.H:127
Foam::pointEdgeStructuredWalk::operator!=
bool operator!=(const pointEdgeStructuredWalk &) const
Test for inequality.
Definition: pointEdgeStructuredWalkI.H:268
Foam::pointEdgeStructuredWalk::equal
bool equal(const pointEdgeStructuredWalk &, TrackingData &) const
Test for equality, with TrackingData.
Definition: pointEdgeStructuredWalkI.H:247
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::pointEdgeStructuredWalk::data
const vector & data() const
Tracking data.
Definition: pointEdgeStructuredWalk.H:121
Foam::pointEdgeStructuredWalk::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: pointEdgeStructuredWalkI.H:95
Foam::pointEdgeStructuredWalk::updatePoint
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const pointEdgeStructuredWalk &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
Definition: pointEdgeStructuredWalkI.H:173
w2
#define w2
Definition: blockCreate.C:35
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pointEdgeStructuredWalk::leaveDomain
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
Definition: pointEdgeStructuredWalkI.H:132
Foam::pointEdgeStructuredWalk::inZone
bool inZone() const
True if starting point is valid (ie, not point::max)
Definition: pointEdgeStructuredWalkI.H:88
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
pointEdgeStructuredWalk()
Default construct.
Definition: pointEdgeStructuredWalkI.H:59
Foam::pointEdgeStructuredWalk::operator<<
friend Ostream & operator<<(Ostream &, const pointEdgeStructuredWalk &)
Foam::pointEdgeStructuredWalk::operator>>
friend Istream & operator>>(Istream &, pointEdgeStructuredWalk &)
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::pointEdgeStructuredWalk::dist
scalar dist() const
The distance information.
Definition: pointEdgeStructuredWalk.H:115
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::pointEdgeStructuredWalk::sameGeometry
bool sameGeometry(const pointEdgeStructuredWalk &, const scalar tol, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: pointEdgeStructuredWalkI.H:104
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177