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