OpenFOAM: API Guide
v1912
The open source CFD toolbox
wallPointDataI.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) 2011-2016 OpenFOAM Foundation
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM.
12
13
OpenFOAM is free software: you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26
\*---------------------------------------------------------------------------*/
27
28
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29
30
namespace
Foam
31
{
32
33
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34
35
// Update this with w2 if w2 nearer to pt.
36
template
<
class
Type>
37
template
<
class
TrackingData>
38
inline
bool
wallPointData<Type>::update
39
(
40
const
point
& pt,
41
const
wallPointData<Type>&
w2
,
42
const
scalar tol,
43
TrackingData& td
44
)
45
{
46
scalar dist2 =
magSqr
(pt -
w2
.origin());
47
48
if
(valid(td))
49
{
50
scalar
diff
= distSqr() - dist2;
51
52
if
(
diff
< 0)
53
{
54
// already nearer to pt
55
return
false
;
56
}
57
58
if
((
diff
< SMALL) || ((distSqr() > SMALL) && (
diff
/distSqr() < tol)))
59
{
60
// don't propagate small changes
61
return
false
;
62
}
63
}
64
65
// Either *this is not yet valid or w2 is closer
66
{
67
// current not yet set so use any value
68
distSqr() = dist2;
69
origin() =
w2
.origin();
70
data_ =
w2
.data();
71
72
return
true
;
73
}
74
}
75
76
77
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
78
79
// Null constructor
80
template
<
class
Type>
81
inline
wallPointData<Type>::wallPointData
()
82
:
83
wallPoint
(),
84
data_()
85
{}
86
87
88
// Construct from components
89
template
<
class
Type>
90
inline
wallPointData<Type>::wallPointData
91
(
92
const
point
& origin,
93
const
Type&
data
,
94
const
scalar distSqr
95
)
96
:
97
wallPoint
(origin, distSqr),
98
data_(
data
)
99
{}
100
101
102
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103
104
template
<
class
Type>
105
inline
const
Type&
wallPointData<Type>::data
()
const
106
{
107
return
data_;
108
}
109
110
111
template
<
class
Type>
112
inline
Type&
wallPointData<Type>::data
()
113
{
114
return
data_;
115
}
116
117
118
// Update this with w2 if w2 nearer to pt.
119
template
<
class
Type>
120
template
<
class
TrackingData>
121
inline
bool
wallPointData<Type>::updateCell
122
(
123
const
polyMesh
&
mesh
,
124
const
label
thisCelli,
125
const
label
,
126
const
wallPointData<Type>
& neighbourWallInfo,
127
const
scalar tol,
128
TrackingData& td
129
)
130
{
131
const
vectorField
& cellCentres =
mesh
.primitiveMesh::cellCentres();
132
133
return
update
134
(
135
cellCentres[thisCelli],
136
neighbourWallInfo,
137
tol,
138
td
139
);
140
}
141
142
143
// Update this with w2 if w2 nearer to pt.
144
template
<
class
Type>
145
template
<
class
TrackingData>
146
inline
bool
wallPointData<Type>::updateFace
147
(
148
const
polyMesh
&
mesh
,
149
const
label
thisFacei,
150
const
label
,
151
const
wallPointData<Type>
& neighbourWallInfo,
152
const
scalar tol,
153
TrackingData& td
154
)
155
{
156
const
vectorField
& faceCentres =
mesh
.faceCentres();
157
158
return
update
159
(
160
faceCentres[thisFacei],
161
neighbourWallInfo,
162
tol,
163
td
164
);
165
}
166
167
168
// Update this with w2 if w2 nearer to pt.
169
template
<
class
Type>
170
template
<
class
TrackingData>
171
inline
bool
wallPointData<Type>::updateFace
172
(
173
const
polyMesh
&
mesh
,
174
const
label
thisFacei,
175
const
wallPointData<Type>
& neighbourWallInfo,
176
const
scalar tol,
177
TrackingData& td
178
)
179
{
180
const
vectorField
& faceCentres =
mesh
.faceCentres();
181
182
return
update
183
(
184
faceCentres[thisFacei],
185
neighbourWallInfo,
186
tol,
187
td
188
);
189
}
190
191
192
// ************************************************************************* //
193
194
}
// End namespace Foam
195
196
// ************************************************************************* //
Foam::wallPoint
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition:
wallPoint.H:65
update
mesh update()
Foam::wallPointData::wallPointData
wallPointData()
Construct null.
Definition:
wallPointDataI.H:81
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition:
polyMesh.H:77
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::diff
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
Definition:
triad.C:378
Foam::label
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:62
Foam::Field< vector >
w2
#define w2
Definition:
blockCreate.C:35
mesh
dynamicFvMesh & mesh
Definition:
createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:33
Foam::Vector< scalar >
Foam::wallPointData
Holds information (coordinate and normal) regarding nearest wall point.
Definition:
wallPointData.H:52
Foam::point
vector point
Point is a vector.
Definition:
point.H:43
Foam::data
Database for solution data, solver performance and other reduced data.
Definition:
data.H:54
src
meshTools
cellDist
wallPoint
wallPointDataI.H
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.