Loading...
Searching...
No Matches
faceAreaIntersectI.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-2017 OpenFOAM Foundation
9 Copyright (C) 2015-2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30
32(
33 const face& f,
35)
36{
37 if (f.size() > 2)
38 {
39 const label v0 = 0;
40
41 face indices(3);
42
43 for (label i = 1; i < f.size() - 1; ++i)
44 {
45 indices[0] = f[v0];
46 indices[1] = f[i];
47 indices[2] = f[i + 1];
48 faces.append(indices);
49 }
50 }
51}
52
53
54inline void Foam::faceAreaIntersect::setTriPoints
55(
56 const point& a,
57 const point& b,
58 const point& c,
59 label& count,
61) const
62{
63 triPoints& tp = tris[count++];
64 tp[0] = a;
65 tp[1] = b;
66 tp[2] = c;
67}
68
69
70inline Foam::triPoints Foam::faceAreaIntersect::getTriPoints
71(
72 const pointField& points,
73 const face& f,
74 const bool reverse
75) const
76{
77 triPoints result;
78
79 if (reverse)
80 {
81 result[2] = points[f[0]];
82 result[1] = points[f[1]];
83 result[0] = points[f[2]];
84 }
85 else
86 {
87 result[0] = points[f[0]];
88 result[1] = points[f[1]];
89 result[2] = points[f[2]];
90 }
91
92 return result;
93}
94
95
96inline Foam::point Foam::faceAreaIntersect::planeIntersection
97(
98 const FixedList<scalar, 3>& d,
99 const triPoints& t,
100 const label negI,
101 const label posI
102) const
103{
104 scalar dp = d[posI];
105 scalar dn = d[negI];
106 return (dp*t[negI] - dn*t[posI])/(-dn + dp);
107}
108
109
110// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
113{
114 return tol;
115}
116
117
119{
120 return cacheTriangulation_;
121}
122
123
124// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
void append(const T &val)
Copy append an element to the end of this list.
A 1D vector of objects of type <T> with a fixed length <N>.
Definition FixedList.H:73
static void triangleFan(const face &f, DynamicList< face > &faces)
Decompose face into triangle fan.
bool cacheTriangulation() const
Const access to the cacheTriangulation flag.
static scalar & tolerance()
Fraction of local length scale to use as intersection tolerance.
A face is a list of labels corresponding to mesh vertices.
Definition face.H:71
Triangle point storage. Default constructable (triangle is not).
Definition triangle.H:77
const pointField & points
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
Definition UListI.H:539
vector point
Point is a vector.
Definition point.H:37
vectorField pointField
pointField is a vectorField.
labelList f(nPoints)
volScalarField & b