LayerInfoDataI.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) 2011-2023 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 "LayerInfoData.H"
27 #include "polyMesh.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 :
34  layerInfo(),
35  data_()
36 {}
37 
38 
39 template<class Type>
41 (
42  const label faceLayer,
43  const label direction,
44  const Type& data
45 )
46 :
47  layerInfo(faceLayer, direction),
48  data_(data)
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
53 
54 template<class Type>
55 inline const Type& Foam::LayerInfoData<Type>::data() const
56 {
57  return data_;
58 }
59 
60 
61 template<class Type>
62 template<class TrackingData>
64 (
65  const polyPatch& patch,
66  const label patchFacei,
67  const transformer& transform,
68  TrackingData& td
69 )
70 {
71  if (transform.transformsPosition())
72  {
74  << "Cannot have a transform within a set of mesh layers"
75  << exit(FatalError);
76  }
77 }
78 
79 
80 template<class Type>
81 template<class TrackingData>
83 (
84  const polyMesh& mesh,
85  const label thisCelli,
86  const label nbrFacei,
87  const LayerInfoData<Type>& nbrInfo,
88  const scalar tol,
89  TrackingData& td
90 )
91 {
92  if (layerInfo::updateCell(mesh, thisCelli, nbrFacei, nbrInfo, tol, td))
93  {
94  data_ = nbrInfo.data_;
95  return true;
96  }
97  else
98  {
99  return false;
100  }
101 }
102 
103 
104 template<class Type>
105 template<class TrackingData>
107 (
108  const polyMesh& mesh,
109  const label thisFacei,
110  const label nbrCelli,
111  const LayerInfoData<Type>& nbrInfo,
112  const scalar tol,
113  TrackingData& td
114 )
115 {
116  if (layerInfo::updateFace(mesh, thisFacei, nbrCelli, nbrInfo, tol, td))
117  {
118  data_ = nbrInfo.data_;
119  return true;
120  }
121  else
122  {
123  return false;
124  }
125 }
126 
127 
128 template<class Type>
129 template<class TrackingData>
131 (
132  const polyMesh& mesh,
133  const label thisFacei,
134  const LayerInfoData<Type>& nbrInfo,
135  const scalar tol,
136  TrackingData& td
137 )
138 {
139  if (layerInfo::updateFace(mesh, thisFacei, nbrInfo, tol, td))
140  {
141  data_ = nbrInfo.data_;
142  return true;
143  }
144  else
145  {
146  return false;
147  }
148 }
149 
150 
151 template<class Type>
152 template<class TrackingData>
154 (
155  const LayerInfoData<Type>& rhs,
156  TrackingData& td
157 ) const
158 {
159  return operator==(rhs);
160 }
161 
162 
163 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
164 
165 template<class Type>
167 (
168  const Foam::LayerInfoData<Type>& rhs
169 ) const
170 {
171  return layerInfo::operator==(rhs) && data_ == rhs.data_;
172 }
173 
174 
175 template<class Type>
177 (
178  const Foam::LayerInfoData<Type>& rhs
179 ) const
180 {
181  return !(*this == rhs);
182 }
183 
184 
185 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
186 
187 template<class Type>
188 Foam::Ostream& Foam::operator<<
189 (
190  Ostream& os,
191  const LayerInfoData<Type>& l
192 )
193 {
194  return os << static_cast<const layerInfo&>(l) << token::SPACE << l.data_;
195 }
196 
197 
198 template<class Type>
199 Foam::Istream& Foam::operator>>(Istream& is, LayerInfoData<Type>& l)
200 {
201  return is >> static_cast<layerInfo&>(l) >> l.data_;
202 }
203 
204 
205 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
Class to be used with FaceCellWave which enumerates layers of cells and transports data through those...
Definition: LayerInfoData.H:66
bool updateCell(const polyMesh &, const label thisCelli, const label nbrFacei, const LayerInfoData< Type > &nbrInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
LayerInfoData()
Construct null.
bool updateFace(const polyMesh &, const label thisFacei, const label nbrCelli, const LayerInfoData< Type > &nbrInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool equal(const LayerInfoData< Type > &, TrackingData &td) const
Test equality.
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
const Type & data() const
Return the data.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Class to be used with FaceCellWave which enumerates layers of cells.
Definition: layerInfo.H:60
bool operator==(const layerInfo &) const
Definition: layerInfoI.H:218
bool updateCell(const polyMesh &, const label thisCelli, const label nbrFacei, const layerInfo &nbrInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: layerInfoI.H:120
bool updateFace(const polyMesh &, const label thisFacei, const label nbrCelli, const layerInfo &nbrInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: layerInfoI.H:150
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Istream & operator>>(Istream &, pistonPointEdgeData &)
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:504
error FatalError
uint8_t direction
Definition: direction.H:45