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 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  PointData() = default;
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 noexcept { return data_; }
96 
97  DataType& data() noexcept { return data_; }
98 
99 
100  // Member Operators
101 
102  //- Test for equality
103  inline bool operator==(const PointData<DataType>&) const;
104 
105  //- Test for inequality
106  inline bool operator!=(const PointData<DataType>&) const;
107 
108 
109  // IOstream Operators
110 
111  friend Ostream& operator<< <DataType>
112  (
113  Ostream&,
114  const PointData<DataType>&
115  );
116  friend Istream& operator>> <DataType>
117  (
118  Istream&,
120  );
121 
122 
123  // Wave Methods
124 
125  // Needed by MeshWave
126 
127  //- Apply rotation matrix to the data
128  template<class TrackingData>
129  inline void transform
130  (
131  const tensor& rotTensor,
132  TrackingData& td
133  );
134 
135  //- Influence of edge on point
136  template<class TrackingData>
137  inline bool updatePoint
138  (
139  const polyMesh& mesh,
140  const label pointI,
141  const label edgeI,
142  const PointData<DataType>& edgeInfo,
143  const scalar tol,
144  TrackingData& td
145  );
146 
147  //- Influence of different value on same point.
148  // Merge new and old info.
149  template<class TrackingData>
150  inline bool updatePoint
151  (
152  const polyMesh& mesh,
153  const label pointI,
154  const PointData<DataType>& newPointInfo,
155  const scalar tol,
156  TrackingData& td
157  );
158 
159  //- Influence of different value on same point.
160  // No information about current position whatsoever.
161  template<class TrackingData>
162  inline bool updatePoint
163  (
164  const PointData<DataType>& newPointInfo,
165  const scalar tol,
166  TrackingData& td
167  );
168 
169  //- Influence of point on edge.
170  template<class TrackingData>
171  inline bool updateEdge
172  (
173  const polyMesh& mesh,
174  const label edgeI,
175  const label pointI,
176  const PointData<DataType>& pointInfo,
177  const scalar tol,
178  TrackingData& td
179  );
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
184 
185 //- Data are contiguous if data type is contiguous
186 template<class DataType>
187 struct is_contiguous<PointData<DataType>> : is_contiguous<DataType> {};
188 
189 //- Contiguous scalar only when data type is also scalar
190 template<class DataType>
191 struct is_contiguous_scalar<PointData<DataType>>
192 :
193  is_contiguous_scalar<DataType>
194 {};
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #include "PointDataI.H"
204 
205 #ifdef NoRepository
206 # include "PointData.C"
207 #endif
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
213 // ************************************************************************* //
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:96
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:55
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:71
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
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.