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 | Copyright (C) 2011-2015 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::PointData
26 
27 Description
28  Variant of pointEdgePoint with some transported additional data. Templated
29  on the transported data type.
30 
31 SourceFiles
32  PointDataI.H
33  PointData.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef PointData_H
38 #define PointData_H
39 
40 #include "pointEdgePoint.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class Istream;
49 class Ostream;
50 template<class DataType>
51 class PointData;
52 
53 // Forward declaration of friend functions and operators
54 template<class DataType>
55 Ostream& operator<<(Ostream&, const PointData<DataType>&);
56 template<class DataType>
57 Istream& operator>>(Istream&, PointData<DataType>&);
58 
59 /*---------------------------------------------------------------------------*\
60  Class PointData Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class DataType>
64 class PointData
65 :
66  public pointEdgePoint
67 {
68 private:
69 
70  // Private data
71 
72  //- Additional transported data
73  DataType data_;
74 
75 
76 public:
77 
78  // Constructors
79 
80  //- Construct null
81  inline PointData();
82 
83  //- Construct from origin, distance and data
84  inline PointData
85  (
86  const point& origin,
87  const scalar distSqr,
88  const DataType& data
89  );
90 
91  //- Construct as copy
92  inline PointData(const PointData&);
93 
94 
95  // Member Functions
96 
97  // Access
98 
99  //- Const access the data
100  inline const DataType& data() const;
101 
102 
103  // Needed by meshWave
104 
105  //- Apply rotation matrix to the data
106  template<class TrackingData>
107  inline void transform
108  (
109  const tensor& rotTensor,
110  TrackingData& td
111  );
112 
113  //- Influence of edge on point
114  template<class TrackingData>
115  inline bool updatePoint
116  (
117  const polyMesh& mesh,
118  const label pointI,
119  const label edgeI,
120  const PointData<DataType>& edgeInfo,
121  const scalar tol,
122  TrackingData& td
123  );
124 
125  //- Influence of different value on same point.
126  // Merge new and old info.
127  template<class TrackingData>
128  inline bool updatePoint
129  (
130  const polyMesh& mesh,
131  const label pointI,
132  const PointData<DataType>& newPointInfo,
133  const scalar tol,
134  TrackingData& td
135  );
136 
137  //- Influence of different value on same point.
138  // No information about current position whatsoever.
139  template<class TrackingData>
140  inline bool updatePoint
141  (
142  const PointData<DataType>& newPointInfo,
143  const scalar tol,
144  TrackingData& td
145  );
146 
147  //- Influence of point on edge.
148  template<class TrackingData>
149  inline bool updateEdge
150  (
151  const polyMesh& mesh,
152  const label edgeI,
153  const label pointI,
154  const PointData<DataType>& pointInfo,
155  const scalar tol,
156  TrackingData& td
157  );
158 
159  // Member Operators
160 
161  inline bool operator==(const PointData<DataType>&) const;
162  inline bool operator!=(const PointData<DataType>&) const;
163 
164 
165  // IOstream Operators
166 
167  friend Ostream& operator<< <DataType>
168  (
169  Ostream&,
170  const PointData<DataType>&
171  );
172  friend Istream& operator>> <DataType>
173  (
174  Istream&,
176  );
177 };
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 //- Data associated with PointData types is contiguous
182 
183 template<>
184 inline bool contiguous<PointData<scalar> >()
185 {
186  return true;
187 }
188 
189 template<>
190 inline bool contiguous<PointData<vector> >()
191 {
192  return true;
193 }
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #include "PointDataI.H"
202 
203 #ifdef NoRepository
204 # include "PointData.C"
205 #endif
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::PointData::data
const DataType & data() const
Const access the data.
Definition: PointDataI.H:62
PointData.C
Foam::PointData::PointData
PointData()
Construct null.
Definition: PointDataI.H:32
Foam::PointData::data_
DataType data_
Additional transported data.
Definition: PointData.H:72
Foam::PointData
Variant of pointEdgePoint with some transported additional data. Templated on the transported data ty...
Definition: medialAxisMeshMover.H:57
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
pointEdgePoint.H
Foam::PointData::operator==
bool operator==(const PointData< DataType > &) const
Definition: PointDataI.H:214
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:59
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
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:176
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam::PointData::operator!=
bool operator!=(const PointData< DataType > &) const
Definition: PointDataI.H:225
PointDataI.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::PointData::transform
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to the data.
Definition: PointDataI.H:71
Foam::Vector< scalar >
Foam::operator>>
Istream & operator>>(Istream &, edgeMesh &)
Definition: edgeMeshIO.C:141
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
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:84
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52