OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

intersection.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::intersection
00027 
00028 Description
00029     Foam::intersection
00030 
00031 SourceFiles
00032    intersection.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef intersection_H
00037 #define intersection_H
00038 
00039 #include "scalar.H"
00040 #include "NamedEnum.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                         Class intersection Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class intersection
00052 {
00053 private:
00054 
00055     // Static data
00056 
00057         //- Relative tolerance for point in a plane.
00058         //  The tolerance is relative to the object size.
00059         //  Used to determine if a half-ray from a point in plane of triangle
00060         // intersects the triangle or not.
00061         static scalar planarTol_;
00062 
00063 public:
00064 
00065     enum direction
00066     {
00067         VECTOR,
00068         CONTACT_SPHERE
00069     };
00070 
00071     enum algorithm
00072     {
00073         FULL_RAY,        // Intersecting with full ray
00074         HALF_RAY,        // Intersecting with half ray
00075         VISIBLE          // Intersecting with the visible side
00076     };
00077 
00078     // Static member functions
00079 
00080         //- Direction names
00081         static const NamedEnum<direction, 2> directionNames_;
00082 
00083         //- Projection algorithm names
00084         static const NamedEnum<algorithm, 3> algorithmNames_;
00085 
00086         //- Return planar tolerance
00087         static scalar planarTol()
00088         {
00089             return planarTol_;
00090         }
00091 
00092         //- Set the planar tolerance, returning the previous value
00093         static scalar setPlanarTol(const scalar t)
00094         {
00095             if (t < -VSMALL)
00096             {
00097                 FatalErrorIn
00098                 (
00099                     "scalar intersection::setPlanarTol(const scalar t)"
00100                 )   << "Negative planar tolerance.  This is not allowed."
00101                     << abort(FatalError);
00102             }
00103 
00104             scalar oldTol = planarTol_;
00105             planarTol_ = t;
00106 
00107             return oldTol;
00108         }
00109 };
00110 
00111 
00112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00113 
00114 } // End namespace Foam
00115 
00116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00117 
00118 #endif
00119 
00120 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd