00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2011 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::pointHitSort 00026 00027 Description 00028 Container for sorting intersections 00029 00030 SourceFiles 00031 00032 \*---------------------------------------------------------------------------*/ 00033 00034 #ifndef pointHitSort_H 00035 #define pointHitSort_H 00036 00037 #include <OpenFOAM/pointHit.H> 00038 #include <OpenFOAM/label.H> 00039 00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00041 00042 namespace Foam 00043 { 00044 00045 // Forward declaration of classes 00046 00047 /*---------------------------------------------------------------------------*\ 00048 Class pointHitSort Declaration 00049 \*---------------------------------------------------------------------------*/ 00050 00051 class pointHitSort 00052 { 00053 // Private data 00054 00055 //- intersection 00056 pointHit inter_; 00057 00058 //- original index 00059 label index_; 00060 00061 public: 00062 00063 // Constructors 00064 00065 //- Construct null 00066 pointHitSort() 00067 : 00068 inter_(false, vector::zero, GREAT, false), 00069 index_(-1) 00070 {} 00071 00072 //- Construct from intersection, index 00073 pointHitSort(const pointHit& inter, const label index) 00074 : 00075 inter_(inter), 00076 index_(index) 00077 {} 00078 00079 00080 // Member Functions 00081 00082 const pointHit& inter() const 00083 { 00084 return inter_; 00085 } 00086 00087 label index() const 00088 { 00089 return index_; 00090 } 00091 00092 // Member Operators 00093 00094 bool operator==(const pointHitSort& rhs) const 00095 { 00096 return inter_.distance() == rhs.inter().distance(); 00097 } 00098 00099 bool operator<(const pointHitSort& rhs) const 00100 { 00101 return inter_.distance() < rhs.inter().distance(); 00102 } 00103 00104 }; 00105 00106 00107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00108 00109 } // End namespace Foam 00110 00111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00112 00113 #endif 00114 00115 // ************************ vim: set sw=4 sts=4 et: ************************ //