SparseLibrary  Version 1.6.0
HilbertTripletCompare.hpp
1 /*
2  * Copyright (c) 2007-2014, A. N. Yzelman, Utrecht University 2007-2011;
3  * KU Leuven 2011-2014.
4  * R. H. Bisseling, Utrecht University 2007-2014.
5  *
6  * This file is part of the Sparse Library.
7  *
8  * This library was developed under supervision of Prof. dr. Rob H. Bisseling at
9  * Utrecht University, from 2007 until 2011. From 2011-2014, development continued
10  * at KU Leuven, where Prof. dr. Dirk Roose contributed significantly to the ideas
11  * behind the newer parts of the library code.
12  *
13  * The Sparse Library is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by the
15  * Free Software Foundation, either version 3 of the License, or (at your
16  * option) any later version.
17  *
18  * The Sparse Library is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or 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 along
24  * with the Sparse Library. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 
28 /*
29  * File created by:
30  * A. N. Yzelman, Dept. of Mathematics, Utrecht University, 2007.
31  */
32 
33 
34 #include "HilbertTriplet.hpp"
35 
36 #ifndef _H_HILBERTTRIPLETCOMPARE
37 #define _H_HILBERTTRIPLETCOMPARE
38 
40 template< typename T >
42 
43  public:
44 
53  const unsigned long int ihilbert1 = i.getMostSignificantHilbertBits();
54  const unsigned long int jhilbert1 = j.getMostSignificantHilbertBits();
55  if( ihilbert1 < jhilbert1 ) return true;
56  if( ihilbert1 > jhilbert1 ) return false;
57  const unsigned long int ihilbert2 = i.getLeastSignificantHilbertBits();
58  const unsigned long int jhilbert2 = j.getLeastSignificantHilbertBits();
59  if( ihilbert2 < jhilbert2 ) return true;
60  return false;
61  }
62 };
63 
64 #endif
65 
Hilbert-coordinate-aware triplet.
Definition: HilbertTriplet.hpp:46
size_t getLeastSignificantHilbertBits()
Definition: HilbertTriplet.hpp:107
Class-comparator of HilbertTriplet.
Definition: HilbertTripletCompare.hpp:41
size_t getMostSignificantHilbertBits()
Definition: HilbertTriplet.hpp:102
bool operator()(HilbertTriplet< T > i, HilbertTriplet< T > j)
Compares two Hilbert triplets.
Definition: HilbertTripletCompare.hpp:52