PointData.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-2015 OpenFOAM Foundation
9  Copyright (C) 2019 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::PointData
29 
30 Description
31  Variant of pointEdgePoint with some transported additional data. Templated
32  on the transported data type.
33 
34 SourceFiles
35  PointDataI.H
36  PointData.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef PointData_H
41 #define PointData_H
42 
43 #include "pointEdgePoint.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class Istream;
52 class Ostream;
53 template<class DataType> class PointData;
54 
55 template<class DataType>
56 Ostream& operator<<(Ostream&, const PointData<DataType>&);
57 template<class DataType>
58 Istream& operator>>(Istream&, PointData<DataType>&);
59 
60 /*---------------------------------------------------------------------------*\
61  Class PointData Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class DataType>
65 class PointData
66 :
67  public pointEdgePoint
68 {
69  // Private data
70 
71  //- Additional transported data
72  DataType data_;
73 
74 
75 public:
76 
77  // Constructors
78 
79  //- Construct null
80  inline PointData();
81 
82  //- Construct from origin, distance and data
83  inline PointData
84  (
85  const point& origin,
86  const scalar distSqr,
87  const DataType& data
88  );
89 
90  //- Construct as copy
91  inline PointData(const PointData&);
92 
93 
94  // Member Functions
95 
96  // Access
97 
98  //- Const access the data
99  inline const DataType& data() const;
100 
101 
102  // Needed by meshWave
103 
104  //- Apply rotation matrix to the data
105  template<class TrackingData>
106  inline void transform
107  (
108  const tensor& rotTensor,
109  TrackingData& td
110  );
111 
112  //- Influence of edge on point
113  template<class TrackingData>
114  inline bool updatePoint
115  (
116  const polyMesh& mesh,
117  const label pointI,
118  const label edgeI,
119  const PointData<DataType>& edgeInfo,
120  const scalar tol,
121  TrackingData& td
122  );
123 
124  //- Influence of different value on same point.
125  // Merge new and old info.
126  template<class TrackingData>
127  inline bool updatePoint
128  (
129  const polyMesh& mesh,
130  const label pointI,
131  const PointData<DataType>& newPointInfo,
132  const scalar tol,
133  TrackingData& td
134  );
135 
136  //- Influence of different value on same point.
137  // No information about current position whatsoever.
138  template<class TrackingData>
139  inline bool updatePoint
140  (
141  const PointData<DataType>& newPointInfo,
142  const scalar tol,
143  TrackingData& td
144  );
145 
146  //- Influence of point on edge.
147  template<class TrackingData>
148  inline bool updateEdge
149  (
150  const polyMesh& mesh,
151  const label edgeI,
152  const label pointI,
153  const PointData<DataType>& pointInfo,
154  const scalar tol,
155  TrackingData& td
156  );
157 
158  // Member Operators
159 
160  inline bool operator==(const PointData<DataType>&) const;
161  inline bool operator!=(const PointData<DataType>&) const;
162 
163 
164  // IOstream Operators
165 
166  friend Ostream& operator<< <DataType>
167  (
168  Ostream&,
169  const PointData<DataType>&
170  );
171  friend Istream& operator>> <DataType>
172  (
173  Istream&,
174  PointData<DataType>&
175  );
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
180 
181 //- Data are contiguous if data type is contiguous
182 template<class DataType>
183 struct is_contiguous<PointData<DataType>> : is_contiguous<DataType> {};
184 
185 //- Contiguous scalar only when data type is also scalar
186 template<class DataType>
187 struct is_contiguous_scalar<PointData<DataType>>
188 :
189  is_contiguous_scalar<DataType>
190 {};
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #include "PointDataI.H"
200 
201 #ifdef NoRepository
202 # include "PointData.C"
203 #endif
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Foam::PointData::data
const DataType & data() const
Const access the data.
Definition: PointDataI.H:65
PointData.C
Foam::PointData::PointData
PointData()
Construct null.
Definition: PointDataI.H:35
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars.
Definition: tensor.H:53
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::PointData
Variant of pointEdgePoint with some transported additional data. Templated on the transported data ty...
Definition: medialAxisMeshMover.H:60
pointEdgePoint.H
Foam::PointData::operator==
bool operator==(const PointData< DataType > &) const
Definition: PointDataI.H:209
Foam::label
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:62
Foam::PointData::updateEdge
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointI, const PointData< DataType > &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
Definition: PointDataI.H:173
Foam::PointData::operator!=
bool operator!=(const PointData< DataType > &) const
Definition: PointDataI.H:220
PointDataI.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
Foam::PointData::transform
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to the data.
Definition: PointDataI.H:74
Foam::PointData::updatePoint
bool updatePoint(const polyMesh &mesh, const label pointI, const label edgeI, const PointData< DataType > &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
Definition: PointDataI.H:87
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75