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-2022 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>
65 inline void Foam::minData::transform
66 (
67  const polyPatch& patch,
68  const label patchFacei,
69  const transformer& transform,
70  TrackingData& td
71 )
72 {}
73 
74 
75 template<class TrackingData>
76 inline bool Foam::minData::updateCell
77 (
78  const polyMesh&,
79  const label thisCelli,
80  const label neighbourFacei,
81  const minData& neighbourInfo,
82  const scalar tol,
83  TrackingData&
84 )
85 {
86  if (neighbourInfo.data_ < data_)
87  {
88  operator=(neighbourInfo);
89  return true;
90  }
91  else
92  {
93  return false;
94  }
95 }
96 
97 
98 template<class TrackingData>
99 inline bool Foam::minData::updateFace
100 (
101  const polyMesh& mesh,
102  const label thisFacei,
103  const label neighbourCelli,
104  const minData& neighbourInfo,
105  const scalar tol,
106  TrackingData&
107 )
108 {
109  // From cell to its faces.
110 
111  if (neighbourInfo.data_ < data_)
112  {
113  operator=(neighbourInfo);
114  return true;
115  }
116  else
117  {
118  return false;
119  }
120 }
121 
122 
123 template<class TrackingData>
124 inline bool Foam::minData::updateFace
125 (
126  const polyMesh&,
127  const label thisFacei,
128  const minData& neighbourInfo,
129  const scalar tol,
130  TrackingData&
131 )
132 {
133  // From face to face (e.g. coupled faces)
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::equal
148 (
149  const minData& rhs,
150  TrackingData& td
151 ) const
152 {
153  return operator==(rhs);
154 }
155 
156 
157 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
158 
159 inline bool Foam::minData::operator==
160 (
161  const Foam::minData& rhs
162 ) const
163 {
164  return data() == rhs.data();
165 }
166 
167 
168 inline bool Foam::minData::operator!=
169 (
170  const Foam::minData& rhs
171 ) const
172 {
173  return !(*this == rhs);
174 }
175 
176 
177 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
178 
179 Foam::Ostream& Foam::operator<<
180 (
181  Foam::Ostream& os,
182  const Foam::minData& wDist
183 )
184 {
185  return os << wDist.data_;
186 }
187 
188 
189 Foam::Istream& Foam::operator>>
190 (
191  Foam::Istream& is,
192  Foam::minData& wDist
193 )
194 {
195  return is >> wDist.data_;
196 }
197 
198 
199 // ************************************************************************* //
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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:160
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:100
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:86
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Definition: minDataI.H:66
bool equal(const minData &, TrackingData &td) const
Same (like operator==)
Definition: minDataI.H:148
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:76
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:77
For use with FaceCellWave. Transports minimum passive data.
Definition: minData.H:63