minDataI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2014-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "polyMesh.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 :
32  data_(labelMax)
33 {}
34 
35 
37 :
38  data_(data)
39 {}
40 
41 
42 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 
44 template<class TrackingData>
45 inline bool Foam::minData::valid(TrackingData& td) const
46 {
47  return data_ != labelMax;
48 }
49 
50 
51 template<class TrackingData>
53 (
54  const polyMesh&,
55  const minData&,
56  const scalar,
57  TrackingData&
58 ) const
59 {
60  return true;
61 }
62 
63 
64 template<class TrackingData>
66 (
67  const polyMesh&,
68  const polyPatch& patch,
69  const label patchFacei,
70  const point& faceCentre,
71  TrackingData&
72 )
73 {}
74 
75 
76 template<class TrackingData>
77 inline void Foam::minData::transform
78 (
79  const polyMesh&,
80  const tensor& rotTensor,
81  TrackingData&
82 )
83 {}
84 
85 
86 template<class TrackingData>
88 (
89  const polyMesh&,
90  const polyPatch& patch,
91  const label patchFacei,
92  const point& faceCentre,
93  TrackingData&
94 )
95 {}
96 
97 
98 template<class TrackingData>
99 inline bool Foam::minData::updateCell
100 (
101  const polyMesh&,
102  const label thisCelli,
103  const label neighbourFacei,
104  const minData& neighbourInfo,
105  const scalar tol,
106  TrackingData&
107 )
108 {
109  if (neighbourInfo.data_ < data_)
110  {
111  operator=(neighbourInfo);
112  return true;
113  }
114  else
115  {
116  return false;
117  }
118 }
119 
120 
121 template<class TrackingData>
122 inline bool Foam::minData::updateFace
123 (
124  const polyMesh& mesh,
125  const label thisFacei,
126  const label neighbourCelli,
127  const minData& neighbourInfo,
128  const scalar tol,
129  TrackingData&
130 )
131 {
132  // From cell to its faces.
133 
134  if (neighbourInfo.data_ < data_)
135  {
136  operator=(neighbourInfo);
137  return true;
138  }
139  else
140  {
141  return false;
142  }
143 }
144 
145 
146 template<class TrackingData>
147 inline bool Foam::minData::updateFace
148 (
149  const polyMesh&,
150  const label thisFacei,
151  const minData& neighbourInfo,
152  const scalar tol,
153  TrackingData&
154 )
155 {
156  // From face to face (e.g. coupled faces)
157  if (neighbourInfo.data_ < data_)
158  {
159  operator=(neighbourInfo);
160  return true;
161  }
162  else
163  {
164  return false;
165  }
166 }
167 
168 
169 template<class TrackingData>
170 inline bool Foam::minData::equal
171 (
172  const minData& rhs,
173  TrackingData& td
174 ) const
175 {
176  return operator==(rhs);
177 }
178 
179 
180 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
181 
182 inline bool Foam::minData::operator==
183 (
184  const Foam::minData& rhs
185 ) const
186 {
187  return data() == rhs.data();
188 }
189 
190 
191 inline bool Foam::minData::operator!=
192 (
193  const Foam::minData& rhs
194 ) const
195 {
196  return !(*this == rhs);
197 }
198 
199 
200 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
201 
202 Foam::Ostream& Foam::operator<<
203 (
204  Foam::Ostream& os,
205  const Foam::minData& wDist
206 )
207 {
208  return os << wDist.data_;
209 }
210 
211 
212 Foam::Istream& Foam::operator>>
213 (
214  Foam::Istream& is,
215  Foam::minData& wDist
216 )
217 {
218  return is >> wDist.data_;
219 }
220 
221 
222 // ************************************************************************* //
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: minDataI.H:88
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:59
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: minDataI.H:78
bool sameGeometry(const polyMesh &, const minData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: minDataI.H:53
bool operator==(const minData &) const
Definition: minDataI.H:183
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:123
static const label labelMax
Definition: label.H:62
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Database for solution and other reduced data.
Definition: data.H:51
minData()
Construct null.
Definition: minDataI.H:30
label data() const
Definition: minData.H:84
bool equal(const minData &, TrackingData &td) const
Same (like operator==)
Definition: minDataI.H:171
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: minDataI.H:45
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:66
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:100
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:66
For use with FaceCellWave. Transports minimum passive data.
Definition: minData.H:61