faceAreaIntersect.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 | Copyright (C) 2011-2013 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 Class
25  Foam::faceAreaIntersect
26 
27 Description
28  Face intersection class
29  - calculates intersection area by sub-dividing face into triangles
30  and cutting
31 
32 SourceFiles
33  faceAreaIntersect.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef faceAreaIntersect_H
38 #define faceAreaIntersect_H
39 
40 #include "pointField.H"
41 #include "FixedList.H"
42 #include "plane.H"
43 #include "face.H"
44 #include "NamedEnum.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class faceAreaIntersect Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 {
57 public:
58 
60 
62  {
64  tmMesh
65  };
66 
68 
69 
70 private:
71 
72  // Private data
73 
74  //- Reference to the points of sideA
75  const pointField& pointsA_;
76 
77  //- Reference to the points of sideB
78  const pointField& pointsB_;
79 
80  //- Flag to reverse B faces
81  const bool reverseB_;
82 
83 
84  // Static data members
85 
86  static scalar tol;
87 
88 
89  // Private Member Functions
90 
91  //- Get triPoints from face
92  inline triPoints getTriPoints
93  (
94  const pointField& points,
95  const face& f,
96  const bool reverse
97  ) const;
98 
99  //- Set triPoints into tri list
100  inline void setTriPoints
101  (
102  const point& a,
103  const point& b,
104  const point& c,
105  label& count,
107  ) const;
108 
109  //- Decompose face into triangle fan
110  inline void triangleFan
111  (
112  const face& f,
113  DynamicList<face>& faces
114  ) const;
115 
116  //- Return point of intersection between plane and triangle edge
117  inline point planeIntersection
118  (
119  const FixedList<scalar, 3>& d,
120  const triPoints& t,
121  const label negI,
122  const label posI
123  ) const;
124 
125  //- Return triangle area
126  inline scalar triArea(const triPoints& t) const;
127 
128 
129  //- Slice triangle with plane and generate new cut sub-triangles
130  void triSliceWithPlane
131  (
132  const triPoints& tri,
133  const plane& p,
135  label& nTris,
136  const scalar len
137  );
138 
139  //- Return area of intersection of triangles src and tgt
140  scalar triangleIntersect
141  (
142  const triPoints& src,
143  const triPoints& tgt,
144  const vector& n
145  );
146 
147 
148 public:
149 
150  // Constructors
151 
152  //- Construct from components
154  (
155  const pointField& pointsA,
156  const pointField& pointsB,
157  const bool reverseB = false
158  );
159 
160 
161  // Public Member Functions
162 
163  //- Fraction of local length scale to use as intersection tolerance
164  inline static scalar& tolerance();
165 
166  //- Return area of intersection of faceA with faceB
167  scalar calc
168  (
169  const face& faceA,
170  const face& faceB,
171  const vector& n,
172  const triangulationMode& triMode
173  );
174 };
175 
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #include "faceAreaIntersectI.H"
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
static scalar & tolerance()
Fraction of local length scale to use as intersection tolerance.
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
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:53
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Definition: plane.H:60
static const NamedEnum< triangulationMode, 2 > triangulationModeNames_
faceAreaIntersect(const pointField &pointsA, const pointField &pointsB, const bool reverseB=false)
Construct from components.
const pointField & points
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
scalar calc(const face &faceA, const face &faceB, const vector &n, const triangulationMode &triMode)
Return area of intersection of faceA with faceB.
void reverse(UList< T > &, const label n)
Definition: UListI.H:322
Face intersection class.
labelList f(nPoints)
FixedList< point, 3 > triPoints
const dimensionedScalar c
Speed of light in a vacuum.
label n
volScalarField & p
Namespace for OpenFOAM.