minDataI.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) 2014-2016 OpenFOAM Foundation
9  Copyright (C) 2015-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 \*---------------------------------------------------------------------------*/
28 
29 #include "polyMesh.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 :
35  data_(labelMax)
36 {}
37 
38 
39 inline Foam::minData::minData(const label data)
40 :
41  data_(data)
42 {}
43 
44 
45 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
46 
47 template<class TrackingData>
48 inline bool Foam::minData::valid(TrackingData& td) const
49 {
50  return data_ != labelMax;
51 }
52 
53 
54 template<class TrackingData>
56 (
57  const polyMesh&,
58  const minData&,
59  const scalar,
60  TrackingData&
61 ) const
62 {
63  return true;
64 }
65 
66 
67 template<class TrackingData>
69 (
70  const polyMesh&,
71  const polyPatch& patch,
72  const label patchFacei,
73  const point& faceCentre,
74  TrackingData&
75 )
76 {}
77 
78 
79 template<class TrackingData>
80 inline void Foam::minData::transform
81 (
82  const polyMesh&,
83  const tensor& rotTensor,
84  TrackingData&
85 )
86 {}
87 
88 
89 template<class TrackingData>
91 (
92  const polyMesh&,
93  const polyPatch& patch,
94  const label patchFacei,
95  const point& faceCentre,
96  TrackingData&
97 )
98 {}
99 
100 
101 template<class TrackingData>
102 inline bool Foam::minData::updateCell
103 (
104  const polyMesh&,
105  const label thisCelli,
106  const label neighbourFacei,
107  const minData& neighbourInfo,
108  const scalar tol,
109  TrackingData&
110 )
111 {
112  if (neighbourInfo.data_ < data_)
113  {
114  operator=(neighbourInfo);
115  return true;
116  }
117 
118  return false;
119 }
120 
121 
122 template<class TrackingData>
123 inline bool Foam::minData::updateFace
124 (
125  const polyMesh& mesh,
126  const label thisFacei,
127  const label neighbourCelli,
128  const minData& neighbourInfo,
129  const scalar tol,
130  TrackingData&
131 )
132 {
133  // From cell to its faces.
134  if (neighbourInfo.data_ < data_)
135  {
136  operator=(neighbourInfo);
137  return true;
138  }
139 
140  return false;
141 }
142 
143 
144 template<class TrackingData>
145 inline bool Foam::minData::updateFace
146 (
147  const polyMesh&,
148  const label thisFacei,
149  const minData& neighbourInfo,
150  const scalar tol,
151  TrackingData&
152 )
153 {
154  // From face to face (e.g. coupled faces)
155  if (neighbourInfo.data_ < data_)
156  {
157  operator=(neighbourInfo);
158  return true;
159  }
160 
161  return false;
162 }
163 
164 
165 template<class TrackingData>
166 inline bool Foam::minData::equal
167 (
168  const minData& rhs,
169  TrackingData& td
170 ) const
171 {
172  return operator==(rhs);
173 }
174 
175 
176 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
177 
178 inline bool Foam::minData::operator==
179 (
180  const minData& rhs
181 ) const
182 {
183  return data_ == rhs.data_;
184 }
185 
186 
187 inline bool Foam::minData::operator!=
188 (
189  const minData& rhs
190 ) const
191 {
192  return !(*this == rhs);
193 }
194 
195 
196 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
197 
198 inline Foam::Ostream& Foam::operator<<
199 (
200  Ostream& os,
201  const minData& rhs
202 )
203 {
204  return os << rhs.data_;
205 }
206 
207 
208 inline Foam::Istream& Foam::operator>>
209 (
210  Istream& is,
211  minData& rhs
212 )
213 {
214  return is >> rhs.data_;
215 }
216 
217 
218 // ************************************************************************* //
Foam::minData::equal
bool equal(const minData &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: minDataI.H:167
Foam::Tensor< scalar >
Foam::minData
For use with FaceCellWave. Transports minimum passive data.
Definition: minData.H:60
Foam::labelMax
constexpr label labelMax
Definition: label.H:61
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::minData::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: minDataI.H:48
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::minData::minData
minData()
Default construct.
Definition: minDataI.H:33
Foam::minData::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const minData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: minDataI.H:103
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::minData::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const minData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: minDataI.H:124
Foam::minData::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: minDataI.H:81
Foam::minData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: minDataI.H:91
Foam::minData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: minDataI.H:69
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::minData::sameGeometry
bool sameGeometry(const polyMesh &, const minData &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: minDataI.H:56
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55