ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / OpenFOAM / meshes / primitiveShapes / objectHit / pointHitSort.H
blobb6b44dd7741a7423406dff6544ef055061e1e12f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Class
25     Foam::pointHitSort
27 Description
28     Container for sorting intersections
30 SourceFiles
32 \*---------------------------------------------------------------------------*/
34 #ifndef pointHitSort_H
35 #define pointHitSort_H
37 #include "pointHit.H"
38 #include "label.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 namespace Foam
45 // Forward declaration of classes
47 /*---------------------------------------------------------------------------*\
48                            Class pointHitSort Declaration
49 \*---------------------------------------------------------------------------*/
51 class pointHitSort
53     // Private data
55         //- intersection
56         pointHit inter_;
58         //- original index
59         label index_;
61 public:
63     // Constructors
65         //- Construct null
66         pointHitSort()
67         :
68             inter_(false, vector::zero, GREAT, false),
69             index_(-1)
70         {}
72         //- Construct from intersection, index
73         pointHitSort(const pointHit& inter, const label index)
74         :
75             inter_(inter),
76             index_(index)
77         {}
80     // Member Functions
82         const pointHit& inter() const
83         {
84             return inter_;
85         }
87         label index() const
88         {
89             return index_;
90         }
92     // Member Operators
94         bool operator==(const pointHitSort& rhs) const
95         {
96             return inter_.distance() == rhs.inter().distance();
97         }
99         bool operator<(const pointHitSort& rhs) const
100         {
101             return inter_.distance() < rhs.inter().distance();
102         }
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 } // End namespace Foam
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 #endif
115 // ************************************************************************* //