pointHitSort.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-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::pointHitSort
28 
29 Description
30  Container for sorting intersections
31 
32 SourceFiles
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef pointHitSort_H
37 #define pointHitSort_H
38 
39 #include "pointHit.H"
40 #include "label.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 
49 /*---------------------------------------------------------------------------*\
50  Class pointHitSort Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class pointHitSort
54 {
55  // Private data
56 
57  //- intersection
58  pointHit inter_;
59 
60  //- Original index
61  label index_;
62 
63 public:
64 
65  // Constructors
66 
67  //- Construct null
68  pointHitSort()
69  :
70  inter_(false, Zero, GREAT, false),
71  index_(-1)
72  {}
73 
74  //- Construct from intersection, index
75  pointHitSort(const pointHit& inter, const label index)
76  :
77  inter_(inter),
78  index_(index)
79  {}
80 
81 
82  // Member Functions
83 
84  const pointHit& inter() const
85  {
86  return inter_;
87  }
88 
89  label index() const
90  {
91  return index_;
92  }
93 
94  // Member Operators
95 
96  bool operator==(const pointHitSort& rhs) const
97  {
98  return inter_.distance() == rhs.inter().distance();
99  }
100 
101  bool operator<(const pointHitSort& rhs) const
102  {
103  return inter_.distance() < rhs.inter().distance();
104  }
105 
106 };
107 
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 } // End namespace Foam
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 #endif
116 
117 // ************************************************************************* //
Foam::pointHitSort
Container for sorting intersections.
Definition: pointHitSort.H:52
Foam::PointHit< point >
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::pointHitSort::operator==
bool operator==(const pointHitSort &rhs) const
Definition: pointHitSort.H:95
Foam::pointHitSort::operator<
bool operator<(const pointHitSort &rhs) const
Definition: pointHitSort.H:100
pointHit.H
Foam::pointHitSort::index
label index() const
Definition: pointHitSort.H:88
Foam::PointHit::distance
scalar distance() const
Return distance to hit.
Definition: PointHit.H:143
Foam::pointHitSort::pointHitSort
pointHitSort()
Construct null.
Definition: pointHitSort.H:67
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
label.H
Foam::pointHitSort::inter
const pointHit & inter() const
Definition: pointHitSort.H:83
Foam::pointHitSort::pointHitSort
pointHitSort(const pointHit &inter, const label index)
Construct from intersection, index.
Definition: pointHitSort.H:74