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 | Copyright (C) 2011-2016 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::pointEdgeStructuredWalk
26 
27 Description
28  Determines length of string of edges walked to point.
29 
30 SourceFiles
31  pointEdgeStructuredWalkI.H
32  pointEdgeStructuredWalk.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef pointEdgeStructuredWalk_H
37 #define pointEdgeStructuredWalk_H
38 
39 #include "point.H"
40 #include "tensor.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class polyPatch;
49 class polyMesh;
50 
51 
52 // Forward declaration of friend functions and operators
53 
54 class pointEdgeStructuredWalk;
55 
56 Istream& operator>>(Istream&, pointEdgeStructuredWalk&);
57 Ostream& operator<<(Ostream&, const pointEdgeStructuredWalk&);
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class pointEdgeStructuredWalk Declaration
62 \*---------------------------------------------------------------------------*/
63 
65 {
66  // Private data
67 
68  //- Starting location
69  point point0_;
70 
71  //- Previous point
72  point previousPoint_;
73 
74  //- Sum of distance
75  scalar dist_;
76 
77  //- Passive data
78  vector data_;
79 
80  // Private Member Functions
81 
82  //- Evaluate distance to point.
83  template<class TrackingData>
84  inline bool update
85  (
86  const pointEdgeStructuredWalk& w2,
87  const scalar tol,
88  TrackingData& td
89  );
90 
91 public:
92 
93  // Constructors
94 
95  //- Construct null
96  inline pointEdgeStructuredWalk();
97 
98  //- Construct from components
100  (
101  const point&,
102  const point&,
103  const scalar,
104  const vector&
105  );
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  inline bool inZone() const;
113 
114  inline scalar dist() const;
115 
116  inline const vector& data() const;
117 
118 
119  // Needed by meshWave
120 
121  //- Check whether origin has been changed at all or
122  // still contains original (invalid) value.
123  template<class TrackingData>
124  inline bool valid(TrackingData& td) const;
125 
126  //- Check for identical geometrical data. Used for cyclics checking.
127  template<class TrackingData>
128  inline bool sameGeometry
129  (
131  const scalar tol,
132  TrackingData& td
133  ) const;
134 
135  //- Convert origin to relative vector to leaving point
136  // (= point coordinate)
137  template<class TrackingData>
138  inline void leaveDomain
139  (
140  const polyPatch& patch,
141  const label patchPointi,
142  const point& pos,
143  TrackingData& td
144  );
145 
146  //- Convert relative origin to absolute by adding entering point
147  template<class TrackingData>
148  inline void enterDomain
149  (
150  const polyPatch& patch,
151  const label patchPointi,
152  const point& pos,
153  TrackingData& td
154  );
155 
156  //- Apply rotation matrix to origin
157  template<class TrackingData>
158  inline void transform
159  (
160  const tensor& rotTensor,
161  TrackingData& td
162  );
163 
164  //- Influence of edge on point
165  template<class TrackingData>
166  inline bool updatePoint
167  (
168  const polyMesh& mesh,
169  const label pointi,
170  const label edgeI,
171  const pointEdgeStructuredWalk& edgeInfo,
172  const scalar tol,
173  TrackingData& td
174  );
175 
176  //- Influence of different value on same point.
177  // Merge new and old info.
178  template<class TrackingData>
179  inline bool updatePoint
180  (
181  const polyMesh& mesh,
182  const label pointi,
183  const pointEdgeStructuredWalk& newPointInfo,
184  const scalar tol,
185  TrackingData& td
186  );
187 
188  //- Influence of different value on same point.
189  // No information about current position whatsoever.
190  template<class TrackingData>
191  inline bool updatePoint
192  (
193  const pointEdgeStructuredWalk& newPointInfo,
194  const scalar tol,
195  TrackingData& td
196  );
197 
198  //- Influence of point on edge.
199  template<class TrackingData>
200  inline bool updateEdge
201  (
202  const polyMesh& mesh,
203  const label edgeI,
204  const label pointi,
205  const pointEdgeStructuredWalk& pointInfo,
206  const scalar tol,
207  TrackingData& td
208  );
209 
210  //- Same (like operator==)
211  template<class TrackingData>
212  inline bool equal(const pointEdgeStructuredWalk&, TrackingData&)
213  const;
214 
215 
216  // Member Operators
217 
218  //Note: Used to determine whether to call update.
219  inline bool operator==(const pointEdgeStructuredWalk&) const;
220  inline bool operator!=(const pointEdgeStructuredWalk&) const;
221 
222 
223  // IOstream Operators
224 
227 };
228 
229 
230 //- Data associated with pointEdgeStructuredWalk type are contiguous
231 template<>
233 {
234  return true;
235 }
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 #endif
249 
250 // ************************************************************************* //
bool operator!=(const pointEdgeStructuredWalk &) const
bool sameGeometry(const pointEdgeStructuredWalk &, const scalar tol, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
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 updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const pointEdgeStructuredWalk &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
friend Ostream & operator<<(Ostream &, const pointEdgeStructuredWalk &)
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
bool contiguous< pointEdgeStructuredWalk >()
Data associated with pointEdgeStructuredWalk type are contiguous.
dimensionedScalar pos(const dimensionedScalar &ds)
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
dynamicFvMesh & mesh
Determines length of string of edges walked to point.
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
Istream & operator>>(Istream &, directionInfo &)
friend Istream & operator>>(Istream &, pointEdgeStructuredWalk &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
bool equal(const pointEdgeStructuredWalk &, TrackingData &) const
Same (like operator==)
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const pointEdgeStructuredWalk &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
bool operator==(const pointEdgeStructuredWalk &) const
Ostream & operator<<(Ostream &, const ensightPart &)
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:66
Namespace for OpenFOAM.