PointIntegrateData.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) 2018-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::PointIntegrateData
28 
29 Description
30  Integrate along selected edges using PointEdgeWave.
31 
32 SourceFiles
33  PointIntegrateDataI.H
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef PointIntegrateData_H
38 #define PointIntegrateData_H
39 
40 #include "UList.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward Declarations
48 template<class DataType> class PointIntegrateData;
49 
50 template<class DataType>
51 Ostream& operator<<(Ostream&, const PointIntegrateData<DataType>&);
52 template<class DataType>
54 
55 /*---------------------------------------------------------------------------*\
56  Class PointIntegrateData declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class DataType>
61 {
62  // Private Data
63 
64  //- Valid flag
65  bool valid_;
66 
67  //- Integrated data
68  DataType data_;
69 
70 
71 public:
72 
73  //- Class used to pass extra data
74  class trackingData
75  {
76  public:
77 
79 
80  trackingData(UList<DataType>& edgeData)
81  :
82  edgeData_(edgeData)
83  {}
84  };
85 
86 
87  // Constructors
88 
89  //- Default construct
90  inline PointIntegrateData();
91 
92  //- Construct from data
93  inline PointIntegrateData(const DataType& data);
94 
95 
96  // Member Functions
97 
98  // Access
99 
100  const DataType& data() const
101  {
102  return data_;
103  };
104  DataType& data()
105  {
106  return data_;
107  };
108 
110  // Needed by PointEdgeWave
111 
112  //- Changed or contains original (invalid) value
113  template<class TrackingData>
114  inline bool valid(TrackingData& td) const;
115 
116  //- Check for identical geometrical data (eg, cyclics checking)
117  template<class TrackingData>
118  inline bool sameGeometry
119  (
121  const scalar tol,
122  TrackingData& td
123  ) const;
124 
125  //- Convert origin to relative vector to leaving point
126  //- (= point coordinate)
127  template<class TrackingData>
128  inline void leaveDomain
129  (
130  const polyPatch& patch,
131  const label patchPointi,
132  const point& pos,
133  TrackingData& td
134  );
135 
136  //- Convert relative origin to absolute by adding entering point
137  template<class TrackingData>
138  inline void enterDomain
139  (
140  const polyPatch& patch,
141  const label patchPointi,
142  const point& pos,
143  TrackingData& td
144  );
145 
146  //- Apply rotation matrix to the data
147  template<class TrackingData>
148  inline void transform
149  (
150  const tensor& rotTensor,
151  TrackingData& td
152  );
153 
154  //- Influence of edge on point
155  template<class TrackingData>
156  inline bool updatePoint
157  (
158  const polyMesh& mesh,
159  const label pointI,
160  const label edgeI,
161  const PointIntegrateData<DataType>& edgeInfo,
162  const scalar tol,
163  TrackingData& td
164  );
165 
166  //- Influence of different value on same point.
167  // Merge new and old info.
168  template<class TrackingData>
169  inline bool updatePoint
170  (
171  const polyMesh& mesh,
172  const label pointI,
173  const PointIntegrateData<DataType>& newPointInfo,
174  const scalar tol,
175  TrackingData& td
176  );
177 
178  //- Influence of different value on same point.
179  // No information about current position whatsoever.
180  template<class TrackingData>
181  inline bool updatePoint
182  (
183  const PointIntegrateData<DataType>& newPointInfo,
184  const scalar tol,
185  TrackingData& td
186  );
187 
188  //- Influence of point on edge.
189  template<class TrackingData>
190  inline bool updateEdge
191  (
192  const polyMesh& mesh,
193  const label edgeI,
194  const label pointI,
195  const PointIntegrateData<DataType>& pointInfo,
196  const scalar tol,
197  TrackingData& td
198  );
199 
200  //- Test for equality, with TrackingData
201  template<class TrackingData>
202  inline bool equal
203  (
205  TrackingData& td
206  ) const;
207 
208 
209  // Member Operators
210 
211  //- Test for equality
212  inline bool operator==(const PointIntegrateData<DataType>&) const;
213 
214  //- Test for inequality
215  inline bool operator!=(const PointIntegrateData<DataType>&) const;
216 
217 
218  // IOstream Operators
219 
220  friend Ostream& operator<< <DataType>
221  (
222  Ostream&,
224  );
225  friend Istream& operator>> <DataType>
226  (
227  Istream&,
229  );
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
234 
235 //- Data are contiguous if the data type is contiguous
236 template<class DataType>
237 struct is_contiguous<PointIntegrateData<DataType>>
238 :
239  is_contiguous<DataType>
240 {};
241 
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 } // End namespace Foam
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #include "PointIntegrateDataI.H"
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #endif
254 
255 // ************************************************************************* //
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to the data.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const DataType & data() const
bool operator==(const PointIntegrateData< DataType > &) const
Test for equality.
bool updatePoint(const polyMesh &mesh, const label pointI, const label edgeI, const PointIntegrateData< DataType > &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
Class used to pass extra data.
bool sameGeometry(const PointIntegrateData< DataType > &, const scalar tol, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
dimensionedScalar pos(const dimensionedScalar &ds)
dynamicFvMesh & mesh
Integrate along selected edges using PointEdgeWave.
Istream & operator>>(Istream &, directionInfo &)
trackingData(UList< DataType > &edgeData)
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointI, const PointIntegrateData< DataType > &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
PointIntegrateData()
Default construct.
bool operator!=(const PointIntegrateData< DataType > &) const
Test for inequality.
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:70
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point (= point coordinate)
const std::string patch
OpenFOAM patch number as a std::string.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
Tensor of scalars, i.e. Tensor<scalar>.
bool equal(const PointIntegrateData< DataType > &, TrackingData &td) const
Test for equality, with TrackingData.
Namespace for OpenFOAM.