PointEdgeLayerInfoDataI.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) 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 "PointEdgeLayerInfoData.H"
27 #include "polyMesh.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 :
35  data_()
36 {}
37 
38 
39 template<class Type>
41 (
42  const label pointLayer,
43  const Type& data
44 )
45 :
46  pointEdgeLayerInfo(pointLayer),
47  data_(data)
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 
53 template<class Type>
54 inline const Type& Foam::PointEdgeLayerInfoData<Type>::data() const
55 {
56  return data_;
57 }
58 
59 
60 template<class Type>
61 template<class TrackingData>
63 (
64  const polyPatch& patch,
65  const label patchFacei,
66  const transformer& transform,
67  TrackingData& td
68 )
69 {
70  if (transform.transformsPosition())
71  {
73  << "Cannot have a transform within a set of mesh layers"
74  << exit(FatalError);
75  }
76 }
77 
78 
79 template<class Type>
80 template<class TrackingData>
82 (
83  const polyMesh& mesh,
84  const label pointi,
85  const label edgei,
86  const PointEdgeLayerInfoData<Type>& edgeInfo,
87  const scalar tol,
88  TrackingData& td
89 )
90 {
91  if (pointEdgeLayerInfo::updatePoint(mesh, pointi, edgei, edgeInfo, tol, td))
92  {
93  data_ = edgeInfo.data_;
94  return true;
95  }
96  else
97  {
98  return false;
99  }
100 }
101 
102 
103 template<class Type>
104 template<class TrackingData>
106 (
107  const polyMesh& mesh,
108  const label pointi,
109  const PointEdgeLayerInfoData<Type>& newPointInfo,
110  const scalar tol,
111  TrackingData& td
112 )
113 {
114  if (pointEdgeLayerInfo::updatePoint(mesh, pointi, newPointInfo, tol, td))
115  {
116  data_ = newPointInfo.data_;
117  return true;
118  }
119  else
120  {
121  return false;
122  }
123 }
124 
125 
126 template<class Type>
127 template<class TrackingData>
129 (
130  const PointEdgeLayerInfoData<Type>& newPointInfo,
131  const scalar tol,
132  TrackingData& td
133 )
134 {
135  if (pointEdgeLayerInfo::updatePoint(newPointInfo, tol, td))
136  {
137  data_ = newPointInfo.data_;
138  return true;
139  }
140  else
141  {
142  return false;
143  }
144 }
145 
146 
147 template<class Type>
148 template<class TrackingData>
150 (
151  const polyMesh& mesh,
152  const label edgei,
153  const label pointi,
154  const PointEdgeLayerInfoData<Type>& pointInfo,
155  const scalar tol,
156  TrackingData& td
157 )
158 {
159  if (pointEdgeLayerInfo::updateEdge(mesh, edgei, pointi, pointInfo, tol, td))
160  {
161  data_ = pointInfo.data_;
162  return true;
163  }
164  else
165  {
166  return false;
167  }
168 }
169 
170 
171 template<class Type>
172 template<class TrackingData>
174 (
175  const PointEdgeLayerInfoData<Type>& rhs,
176  TrackingData& td
177 ) const
178 {
179  return operator==(rhs);
180 }
181 
182 
183 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
184 
185 template<class Type>
187 (
189 ) const
190 {
191  return pointEdgeLayerInfo::operator==(rhs) && data_ == rhs.data_;
192 }
193 
194 
195 template<class Type>
197 (
199 ) const
200 {
201  return !(*this == rhs);
202 }
203 
204 
205 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
206 
207 template<class Type>
208 Foam::Ostream& Foam::operator<<
209 (
210  Ostream& os,
212 )
213 {
214  return
215  os
216  << static_cast<const pointEdgeLayerInfo&>(l)
217  << token::SPACE
218  << l.data_;
219 }
220 
221 
222 template<class Type>
223 Foam::Istream& Foam::operator>>(Istream& is, PointEdgeLayerInfoData<Type>& l)
224 {
225  return is >> static_cast<pointEdgeLayerInfo&>(l) >> l.data_;
226 }
227 
228 
229 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Class to be used with PointEdgeWave which enumerates layers of points.
bool equal(const PointEdgeLayerInfoData< Type > &, TrackingData &td) const
Same (like operator==)
bool updateEdge(const polyMesh &mesh, const label edgei, const label pointi, const PointEdgeLayerInfoData< Type > &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgei, const PointEdgeLayerInfoData< Type > &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
const Type & data() const
Return the data.
void transform(const polyPatch &patch, const label patchPointi, const transformer &transform, TrackingData &td)
Transform across an interface.
Database for solution and other reduced data.
Definition: data.H:54
Class to be used with PointEdgeWave which enumerates layers of points.
bool updateEdge(const polyMesh &mesh, const label edgei, const label pointi, const pointEdgeLayerInfo &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
bool operator==(const pointEdgeLayerInfo &) const
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgei, const pointEdgeLayerInfo &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
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:306
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 &, directionInfo &)
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:483
error FatalError