intersection.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-2015 OpenFOAM Foundation
9  Copyright (C) 2017 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 Class
28  Foam::intersection
29 
30 Description
31  Foam::intersection
32 
33 SourceFiles
34  intersection.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef intersection_H
39 #define intersection_H
40 
41 #include "scalar.H"
42 #include "Enum.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class intersection Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class intersection
54 {
55 private:
56 
57  // Static data
58 
59  //- Relative tolerance for point in a plane.
60  // The tolerance is relative to the object size.
61  // Used to determine if a half-ray from a point in plane of triangle
62  // intersects the triangle or not.
63  static scalar planarTol_;
64 
65 public:
66 
67  enum direction
68  {
71  };
72 
73  enum algorithm
74  {
75  FULL_RAY, // Intersecting with full ray
76  HALF_RAY, // Intersecting with half ray
77  VISIBLE // Intersecting with the visible side
78  };
79 
80  // Static Member Functions
81 
82  //- Direction names
83  static const Enum<direction> directionNames_;
84 
85  //- Projection algorithm names
86  static const Enum<algorithm> algorithmNames_;
87 
88  //- Return planar tolerance
89  static scalar planarTol()
90  {
91  return planarTol_;
92  }
93 
94  //- Set the planar tolerance, returning the previous value
95  static scalar setPlanarTol(const scalar t)
96  {
97  if (t < -VSMALL)
98  {
100  << abort(FatalError);
101  }
102 
103  scalar oldTol = planarTol_;
104  planarTol_ = t;
105 
106  return oldTol;
107  }
108 };
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace Foam
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 #endif
118 
119 // ************************************************************************* //
Foam::intersection::direction
direction
Definition: intersection.H:66
Foam::Enum< direction >
Foam::intersection::HALF_RAY
Definition: intersection.H:75
Foam::intersection::VISIBLE
Definition: intersection.H:76
Foam::intersection::setPlanarTol
static scalar setPlanarTol(const scalar t)
Set the planar tolerance, returning the previous value.
Definition: intersection.H:94
Foam::intersection::FULL_RAY
Definition: intersection.H:74
Foam::intersection::planarTol
static scalar planarTol()
Return planar tolerance.
Definition: intersection.H:88
Foam::intersection::algorithmNames_
static const Enum< algorithm > algorithmNames_
Projection algorithm names.
Definition: intersection.H:85
Foam::intersection::CONTACT_SPHERE
Definition: intersection.H:69
Foam::intersection::algorithm
algorithm
Definition: intersection.H:72
Foam::FatalError
error FatalError
scalar.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::intersection::VECTOR
Definition: intersection.H:68
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::intersection::directionNames_
static const Enum< direction > directionNames_
Direction names.
Definition: intersection.H:82
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::intersection
Foam::intersection.
Definition: intersection.H:52
Enum.H