Make HilbertCode a free standing function

This commit is contained in:
Daniel J. Hofmann
2016-01-25 15:32:41 +01:00
committed by Patrick Niklaus
parent 7a115e93c0
commit 38e8a90f4e
3 changed files with 18 additions and 27 deletions
+2 -12
View File
@@ -10,18 +10,8 @@ namespace osrm
namespace util
{
// computes a 64 bit value that corresponds to the hilbert space filling curve
class HilbertCode
{
public:
std::uint64_t operator()(const FixedPointCoordinate current_coordinate) const;
HilbertCode() {}
HilbertCode(const HilbertCode &) = delete;
private:
inline std::uint64_t BitInterleaving(const std::uint32_t a, const std::uint32_t b) const;
inline void TransposeCoordinate(std::uint32_t *x) const;
};
// Computes a 64 bit value that corresponds to the hilbert space filling curve
std::uint64_t hilbertCode(const FixedPointCoordinate coordinate);
}
}
+2 -4
View File
@@ -119,12 +119,10 @@ class StaticRTree
{
std::vector<WrappedInputElement> input_wrapper_vector(m_element_count);
HilbertCode get_hilbert_number;
// generate auxiliary vector of hilbert-values
tbb::parallel_for(
tbb::blocked_range<uint64_t>(0, m_element_count),
[&input_data_vector, &input_wrapper_vector, &get_hilbert_number, &coordinate_list](
[&input_data_vector, &input_wrapper_vector, &coordinate_list](
const tbb::blocked_range<uint64_t> &range)
{
for (uint64_t element_counter = range.begin(), end = range.end();
@@ -145,7 +143,7 @@ class StaticRTree
COORDINATE_PRECISION *
mercator::latToY(current_centroid.lat / COORDINATE_PRECISION);
current_wrapper.m_hilbert_value = get_hilbert_number(current_centroid);
current_wrapper.m_hilbert_value = hilbertCode(current_centroid);
}
});