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-2019 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward Declarations
46 class Istream;
47 class Ostream;
48 template<class DataType> class PointIntegrateData;
49 
50 template<class DataType>
52 template<class DataType>
54 
55 /*---------------------------------------------------------------------------*\
56  Class PointIntegrateData declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class DataType>
61 {
62 private:
63 
64  // Private data
65 
66  //- Valid flag
67  bool valid_;
68 
69  //- Integrated data
70  DataType data_;
71 
72 
73 public:
74 
75  //- Class used to pass extra data
76  class trackingData
77  {
78  public:
79 
81 
82  trackingData(UList<DataType>& edgeData)
83  :
84  edgeData_(edgeData)
85  {}
86  };
87 
88 
89  // Constructors
90 
91  //- Construct null
92  inline PointIntegrateData();
93 
94  //- Construct from data
95  inline PointIntegrateData(const DataType& data);
96 
97 
98  // Member Functions
99 
100  // Access
101 
102  //- Const access the data
103  inline const DataType& data() const
104  {
105  return data_;
106  };
107 
108 
109  // Needed by PointEdgeWave
110 
111  //- Check whether original (invalid) value.
112  template<class TrackingData>
113  inline bool valid(TrackingData& td) const;
114 
115  //- Check for identical geometrical data. Used for cyclics checking.
116  template<class TrackingData>
117  inline bool sameGeometry
118  (
120  const scalar tol,
121  TrackingData& td
122  ) const;
123 
124  //- Convert origin to relative vector to leaving point
125  // (= point coordinate)
126  template<class TrackingData>
127  inline void leaveDomain
128  (
129  const polyPatch& patch,
130  const label patchPointi,
131  const point& pos,
132  TrackingData& td
133  );
134 
135  //- Convert relative origin to absolute by adding entering point
136  template<class TrackingData>
137  inline void enterDomain
138  (
139  const polyPatch& patch,
140  const label patchPointi,
141  const point& pos,
142  TrackingData& td
143  );
144 
145  //- Apply rotation matrix to the data
146  template<class TrackingData>
147  inline void transform
148  (
149  const tensor& rotTensor,
150  TrackingData& td
151  );
152 
153  //- Influence of edge on point
154  template<class TrackingData>
155  inline bool updatePoint
156  (
157  const polyMesh& mesh,
158  const label pointI,
159  const label edgeI,
160  const PointIntegrateData<DataType>& edgeInfo,
161  const scalar tol,
162  TrackingData& td
163  );
164 
165  //- Influence of different value on same point.
166  // Merge new and old info.
167  template<class TrackingData>
168  inline bool updatePoint
169  (
170  const polyMesh& mesh,
171  const label pointI,
172  const PointIntegrateData<DataType>& newPointInfo,
173  const scalar tol,
174  TrackingData& td
175  );
176 
177  //- Influence of different value on same point.
178  // No information about current position whatsoever.
179  template<class TrackingData>
180  inline bool updatePoint
181  (
182  const PointIntegrateData<DataType>& newPointInfo,
183  const scalar tol,
184  TrackingData& td
185  );
186 
187  //- Influence of point on edge.
188  template<class TrackingData>
189  inline bool updateEdge
190  (
191  const polyMesh& mesh,
192  const label edgeI,
193  const label pointI,
194  const PointIntegrateData<DataType>& pointInfo,
195  const scalar tol,
196  TrackingData& td
197  );
198 
199  //- Same (like operator==)
200  template<class TrackingData>
201  inline bool equal
202  (
204  TrackingData& td
205  ) const;
206 
207 
208  // Member Operators
209 
210  // Needed for List IO
211  inline bool operator==(const PointIntegrateData<DataType>&) const;
212  inline bool operator!=(const PointIntegrateData<DataType>&) const;
213 
214 
215  // IOstream Operators
216 
217  friend Ostream& operator<< <DataType>
218  (
219  Ostream&,
221  );
222  friend Istream& operator>> <DataType>
223  (
224  Istream&,
226  );
227 };
228 
229 
230 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
231 
232 //- Data are contiguous if the data type is contiguous
233 template<class DataType>
234 struct is_contiguous<PointIntegrateData<DataType>>
235 :
236  is_contiguous<DataType>
237 {};
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace Foam
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #include "PointIntegrateDataI.H"
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
Foam::PointIntegrateData
Integrate along selected edges using PointEdgeWave.
Definition: PointIntegrateData.H:47
Foam::Tensor< scalar >
Foam::PointIntegrateData::data
const DataType & data() const
Const access the data.
Definition: PointIntegrateData.H:102
Foam::PointIntegrateData::valid
bool valid(TrackingData &td) const
Check whether original (invalid) value.
Definition: PointIntegrateDataI.H:55
Foam::PointIntegrateData::enterDomain
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
Definition: PointIntegrateDataI.H:89
Foam::PointIntegrateData::PointIntegrateData
PointIntegrateData()
Construct null.
Definition: PointIntegrateDataI.H:34
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::PointIntegrateData::trackingData::trackingData
trackingData(UList< DataType > &edgeData)
Definition: PointIntegrateData.H:81
Foam::PointIntegrateData::operator==
bool operator==(const PointIntegrateData< DataType > &) const
Definition: PointIntegrateDataI.H:248
Foam::PointIntegrateData::sameGeometry
bool sameGeometry(const PointIntegrateData< DataType > &, const scalar tol, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: PointIntegrateDataI.H:64
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
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:62
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
PointIntegrateDataI.H
Foam::PointIntegrateData::operator!=
bool operator!=(const PointIntegrateData< DataType > &) const
Definition: PointIntegrateDataI.H:259
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::PointIntegrateData::updateEdge
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.
Definition: PointIntegrateDataI.H:191
Foam::PointIntegrateData::transform
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to the data.
Definition: PointIntegrateDataI.H:101
Foam::PointIntegrateData::trackingData::edgeData_
UList< DataType > & edgeData_
Definition: PointIntegrateData.H:79
Foam::PointIntegrateData::equal
bool equal(const PointIntegrateData< DataType > &, TrackingData &td) const
Same (like operator==)
Definition: PointIntegrateDataI.H:222
Foam::PointIntegrateData::updatePoint
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.
Definition: PointIntegrateDataI.H:113
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::UList< DataType >
Foam::PointIntegrateData::leaveDomain
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
Definition: PointIntegrateDataI.H:77
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::PointIntegrateData::trackingData
Class used to pass extra data.
Definition: PointIntegrateData.H:75
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:54
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177