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 Foam_PointData_H
41 #define Foam_PointData_H
42 
43 #include "pointEdgePoint.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 template<class DataType> class PointData;
52 
53 template<class DataType>
54 Ostream& operator<<(Ostream&, const PointData<DataType>&);
55 template<class DataType>
56 Istream& operator>>(Istream&, PointData<DataType>&);
57 
58 /*---------------------------------------------------------------------------*\
59  Class PointData Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class DataType>
63 class PointData
64 :
65  public pointEdgePoint
66 {
67  // Private Data
68 
69  //- Additional transported data
70  DataType data_;
71 
72 
73 public:
74 
75  // Constructors
76 
77  //- Default construct
78  PointData() = default;
79 
80  //- Construct from origin, distance and data
81  inline PointData
82  (
83  const point& origin,
84  const scalar distSqr,
85  const DataType& data
86  );
87 
88 
89  // Member Functions
90 
91  // Access
92 
93  const DataType& data() const noexcept { return data_; }
94 
95  DataType& data() noexcept { return data_; }
96 
97 
98  // Member Operators
99 
100  //- Test for equality
101  inline bool operator==(const PointData<DataType>&) const;
102 
103  //- Test for inequality
104  inline bool operator!=(const PointData<DataType>&) const;
105 
106 
107  // IOstream Operators
108 
109  friend Ostream& operator<< <DataType>
110  (
111  Ostream&,
112  const PointData<DataType>&
113  );
114  friend Istream& operator>> <DataType>
115  (
116  Istream&,
118  );
119 
120 
121  // Wave Methods
122 
123  // Needed by MeshWave
124 
125  //- Apply rotation matrix to the data
126  template<class TrackingData>
127  inline void transform
128  (
129  const tensor& rotTensor,
130  TrackingData& td
131  );
132 
133  //- Influence of edge on point
134  template<class TrackingData>
135  inline bool updatePoint
136  (
137  const polyMesh& mesh,
138  const label pointI,
139  const label edgeI,
140  const PointData<DataType>& edgeInfo,
141  const scalar tol,
142  TrackingData& td
143  );
144 
145  //- Influence of different value on same point.
146  // Merge new and old info.
147  template<class TrackingData>
148  inline bool updatePoint
149  (
150  const polyMesh& mesh,
151  const label pointI,
152  const PointData<DataType>& newPointInfo,
153  const scalar tol,
154  TrackingData& td
155  );
156 
157  //- Influence of different value on same point.
158  // No information about current position whatsoever.
159  template<class TrackingData>
160  inline bool updatePoint
161  (
162  const PointData<DataType>& newPointInfo,
163  const scalar tol,
164  TrackingData& td
165  );
166 
167  //- Influence of point on edge.
168  template<class TrackingData>
169  inline bool updateEdge
170  (
171  const polyMesh& mesh,
172  const label edgeI,
173  const label pointI,
174  const PointData<DataType>& pointInfo,
175  const scalar tol,
176  TrackingData& td
177  );
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
182 
183 //- Data are contiguous if data type is contiguous
184 template<class DataType>
185 struct is_contiguous<PointData<DataType>> : is_contiguous<DataType> {};
186 
187 //- Contiguous scalar only when data type is also scalar
188 template<class DataType>
189 struct is_contiguous_scalar<PointData<DataType>>
190 :
191  is_contiguous_scalar<DataType>
192 {};
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
211 // ************************************************************************* //
Variant of pointEdgePoint with some transported additional data. Templated on the transported data ty...
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:58
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool operator!=(const PointData< DataType > &) const
Test for inequality.
Definition: PointDataI.H:190
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:144
const DataType & data() const noexcept
Definition: PointData.H:94
const point & origin() const noexcept
dynamicFvMesh & mesh
Istream & operator>>(Istream &, directionInfo &)
bool operator==(const PointData< DataType > &) const
Test for equality.
Definition: PointDataI.H:180
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
vector point
Point is a vector.
Definition: point.H:37
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:70
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Tensor of scalars, i.e. Tensor<scalar>.
scalar distSqr() const noexcept
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to the data.
Definition: PointDataI.H:45
Namespace for OpenFOAM.
PointData()=default
Default construct.