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