-
Notifications
You must be signed in to change notification settings - Fork 0
/
Comparisons.cpp
119 lines (92 loc) · 2.96 KB
/
Comparisons.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
* @file Comparisons.cpp
* @author Dan R. Lipsa
* @date 25 March 2010
*
* Implementation comparison functors
*/
#include "Body.h"
#include "Comparisons.h"
#include "Vertex.h"
#include "Edge.h"
#include "Face.h"
#include "Foam.h"
#include "OrientedFace.h"
#include "AdjacentOrientedFace.h"
// ======================================================================
// VertexPtrLessThan
bool VertexPtrLessThan::operator () (
const boost::shared_ptr<const Vertex>& first,
const boost::shared_ptr<const Vertex>& second) const
{
return *first < *second;
}
// ======================================================================
// EdgeLessThan
bool EdgeLessThan::operator () (
const boost::shared_ptr<const Edge>& first,
const boost::shared_ptr<const Edge>& second) const
{
return *first < *second;
}
// ======================================================================
// FaceLessThan
bool FaceLessThan::operator () (
const boost::shared_ptr<const Face>& first,
const boost::shared_ptr<const Face>& second) const
{
return *first < *second;
}
// ======================================================================
// VertexPtrLessThanAlong
bool VertexPtrLessThanAlong::operator() (
const boost::shared_ptr<Vertex>& first,
const boost::shared_ptr<Vertex>& second) const
{
return operator() (first->GetVector (), second->GetVector ());
}
double VertexPtrLessThanAlong::operator() (
const boost::shared_ptr<Vertex>& x) const
{
return operator() (x->GetVector ());
}
// ======================================================================
// OrientedFaceIndexLessThan
bool OrientedFaceIndexLessThan::operator () (
const AdjacentOrientedFace& first, const AdjacentOrientedFace& second) const
{
boost::shared_ptr<OrientedFace> firstOf = first.GetOrientedFace ();
boost::shared_ptr<OrientedFace> secondOf = second.GetOrientedFace ();
return firstOf->GetId () < secondOf->GetId ();
}
bool BodyLessThan (const boost::shared_ptr<Body>& first,
const boost::shared_ptr<Body>& second)
{
return *first < *second;
}
bool BodyLessThanId (const boost::shared_ptr<Body>& first,
size_t secondBodyId)
{
return *first < secondBodyId;
}
// ======================================================================
// BBObjectLessThanAlong
template <typename BBObject>
bool BBObjectLessThanAlong<BBObject>::operator() (
const BBObject& first, const BBObject& second)
{
return
(m_getAABox (first).*m_corner) ()[m_axis] <
(m_getAABox (second).*m_corner) ()[m_axis];
}
template <typename BBObject>
double BBObjectLessThanAlong<BBObject>::operator() (const BBObject& x)
{
return (m_getAABox (x).*m_corner) ()[m_axis];
}
//======================================================================
// Template instantiations
// =====================================================================
// BBObjectLessThanAlong
template class BBObjectLessThanAlong<Body>;
template class BBObjectLessThanAlong<Foam>;