FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

surfaceLocation.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::surfaceLocation
00026 
00027 Description
00028     Contains information about location on a triSurface:
00029 
00030     - pointIndexHit:
00031         - location
00032         - bool: hit/miss
00033         - index (of triangle/point/edge)
00034     - elementType():
00035         - what index above relates to. In triangle::proxType
00036     - triangle():
00037         - last known triangle
00038 
00039 SourceFiles
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef surfaceLocation_H
00044 #define surfaceLocation_H
00045 
00046 #include <meshTools/pointIndexHit.H>
00047 #include <OpenFOAM/triPointRef.H>
00048 #include <OpenFOAM/InfoProxy.H>
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 // Forward declaration of classes
00056 class triSurface;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class surfaceLocation Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class surfaceLocation
00063 :
00064     public pointIndexHit
00065 {
00066     // Private data
00067 
00068         triPointRef::proxType elementType_;
00069 
00070         label triangle_;
00071 
00072 public:
00073 
00074 
00075     // Constructors
00076 
00077         //- Construct null
00078         surfaceLocation()
00079         :
00080             pointIndexHit(),
00081             elementType_(triPointRef::NONE),
00082             triangle_(-1)
00083         {}
00084 
00085         //- Construct from components
00086         surfaceLocation
00087         (   
00088             const pointIndexHit& pih,
00089             const triPointRef::proxType elementType,
00090             const label triangle
00091         )
00092         :
00093             pointIndexHit(pih),
00094             elementType_(elementType),
00095             triangle_(triangle)
00096         {}
00097 
00098         //- Construct from Istream
00099         surfaceLocation(Istream& is)
00100         :
00101             pointIndexHit(is),
00102             elementType_(triPointRef::proxType(readLabel(is))),
00103             triangle_(readLabel(is))
00104         {}
00105 
00106 
00107     // Member Functions
00108 
00109         triPointRef::proxType& elementType()
00110         {
00111             return elementType_;
00112         }
00113         
00114         triPointRef::proxType elementType() const
00115         {
00116             return elementType_;
00117         }
00118 
00119         label& triangle()
00120         {
00121             return triangle_;
00122         }
00123         
00124         label triangle() const
00125         {
00126             return triangle_;
00127         }
00128 
00129         //- Normal. Approximate for points.
00130         vector normal(const triSurface& s) const;
00131 
00132         //- Return info proxy.
00133         //  Used to print token information to a stream
00134         InfoProxy<surfaceLocation> info() const
00135         {
00136             return *this;
00137         }
00138 
00139         //- Write info to os
00140         void write(Ostream& os, const triSurface& s) const;
00141 
00142 
00143     // IOstream Operators
00144 
00145         friend Istream& operator>>(Istream& is, surfaceLocation& sl);
00146 
00147         friend Ostream& operator<<(Ostream& os, const surfaceLocation& sl);
00148 
00149         friend Ostream& operator<<
00150         (
00151             Ostream&,
00152             const InfoProxy<surfaceLocation>& 
00153         );
00154 };
00155 
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 } // End namespace Foam
00160 
00161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00162 
00163 #endif
00164 
00165 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines