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 -------------------------------------------------------------------------------
11 License
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,
34  DynamicList<face>& faces
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 
54 inline 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 
70 inline 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 
96 inline 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 
126 {
127  return triangles_;
128 }
129 
130 
132 {
133  return triangles_;
134 }
135 
136 
137 // ************************************************************************* //
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:68
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:107
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
bool cacheTriangulation() const
Const access to the cacheTriangulation flag.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
const pointField & points
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:51
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Triangle point storage. Default constructable (triangle is not)
Definition: triangle.H:74
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
Definition: UListI.H:520
void append(const T &val)
Copy append an element to the end of this list.
Definition: DynamicList.H:584
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static void triangleFan(const face &f, DynamicList< face > &faces)
Decompose face into triangle fan.
labelList f(nPoints)
const DynamicList< triPoints > triangles() const
Const access to the triangulation.
const dimensionedScalar c
Speed of light in a vacuum.