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-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::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  //- Default construct
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 
91  // Member Functions
92 
93  // Access
94 
95  const DataType& data() const
96  {
97  return data_;
98  }
99  DataType& data()
100  {
101  return data_;
102  }
103 
104 
105  // Needed by MeshWave
106 
107  //- Apply rotation matrix to the data
108  template<class TrackingData>
109  inline void transform
110  (
111  const tensor& rotTensor,
112  TrackingData& td
113  );
114 
115  //- Influence of edge on point
116  template<class TrackingData>
117  inline bool updatePoint
118  (
119  const polyMesh& mesh,
120  const label pointI,
121  const label edgeI,
122  const PointData<DataType>& edgeInfo,
123  const scalar tol,
124  TrackingData& td
125  );
126 
127  //- Influence of different value on same point.
128  // Merge new and old info.
129  template<class TrackingData>
130  inline bool updatePoint
131  (
132  const polyMesh& mesh,
133  const label pointI,
134  const PointData<DataType>& newPointInfo,
135  const scalar tol,
136  TrackingData& td
137  );
138 
139  //- Influence of different value on same point.
140  // No information about current position whatsoever.
141  template<class TrackingData>
142  inline bool updatePoint
143  (
144  const PointData<DataType>& newPointInfo,
145  const scalar tol,
146  TrackingData& td
147  );
148 
149  //- Influence of point on edge.
150  template<class TrackingData>
151  inline bool updateEdge
152  (
153  const polyMesh& mesh,
154  const label edgeI,
155  const label pointI,
156  const PointData<DataType>& pointInfo,
157  const scalar tol,
158  TrackingData& td
159  );
160 
161 
162  // Member Operators
163 
164  //- Test for equality
165  inline bool operator==(const PointData<DataType>&) const;
166 
167  //- Test for inequality
168  inline bool operator!=(const PointData<DataType>&) const;
169 
170 
171  // IOstream Operators
172 
173  friend Ostream& operator<< <DataType>
174  (
175  Ostream&,
176  const PointData<DataType>&
177  );
178  friend Istream& operator>> <DataType>
179  (
180  Istream&,
181  PointData<DataType>&
182  );
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
187 
188 //- Data are contiguous if data type is contiguous
189 template<class DataType>
190 struct is_contiguous<PointData<DataType>> : is_contiguous<DataType> {};
191 
192 //- Contiguous scalar only when data type is also scalar
193 template<class DataType>
194 struct is_contiguous_scalar<PointData<DataType>>
195 :
196  is_contiguous_scalar<DataType>
197 {};
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #include "PointDataI.H"
207 
208 #ifdef NoRepository
209 # include "PointData.C"
210 #endif
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
Foam::Tensor< scalar >
PointData.C
Foam::PointData::PointData
PointData()
Default construct.
Definition: PointDataI.H:35
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::PointData::data
DataType & data()
Definition: PointData.H:98
Foam::PointData::data
const DataType & data() const
Definition: PointData.H:94
Foam::PointData
Variant of pointEdgePoint with some transported additional data. Templated on the transported data ty...
Definition: medialAxisMeshMover.H:60
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
pointEdgePoint.H
Foam::PointData::operator==
bool operator==(const PointData< DataType > &) const
Test for equality.
Definition: PointDataI.H:194
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
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:158
Foam::PointData::operator!=
bool operator!=(const PointData< DataType > &) const
Test for inequality.
Definition: PointDataI.H:204
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:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
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:72
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:61
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75