Add namespace around all files

This commit is contained in:
Patrick Niklaus
2016-01-05 16:51:13 +01:00
parent efc9007cbf
commit 6b18e4f7e9
194 changed files with 2648 additions and 1245 deletions
+18 -10
View File
@@ -9,6 +9,11 @@
#include <iostream>
#include <random>
namespace osrm
{
namespace benchmarks
{
// Choosen by a fair W20 dice roll (this value is completely arbitrary)
constexpr unsigned RANDOM_SEED = 13;
constexpr int32_t WORLD_MIN_LAT = -90 * COORDINATE_PRECISION;
@@ -16,22 +21,22 @@ constexpr int32_t WORLD_MAX_LAT = 90 * COORDINATE_PRECISION;
constexpr int32_t WORLD_MIN_LON = -180 * COORDINATE_PRECISION;
constexpr int32_t WORLD_MAX_LON = 180 * COORDINATE_PRECISION;
using RTreeLeaf = EdgeBasedNode;
using FixedPointCoordinateListPtr = std::shared_ptr<std::vector<FixedPointCoordinate>>;
using BenchStaticRTree = StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, false>::vector, false>;
using BenchQuery = GeospatialQuery<BenchStaticRTree>;
using RTreeLeaf = extractor::EdgeBasedNode;
using FixedPointCoordinateListPtr = std::shared_ptr<std::vector<util::FixedPointCoordinate>>;
using BenchStaticRTree = util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, false>::vector, false>;
using BenchQuery = engine::GeospatialQuery<BenchStaticRTree>;
FixedPointCoordinateListPtr loadCoordinates(const boost::filesystem::path &nodes_file)
{
boost::filesystem::ifstream nodes_input_stream(nodes_file, std::ios::binary);
QueryNode current_node;
extractor::QueryNode current_node;
unsigned coordinate_count = 0;
nodes_input_stream.read((char *)&coordinate_count, sizeof(unsigned));
auto coords = std::make_shared<std::vector<FixedPointCoordinate>>(coordinate_count);
for (unsigned i = 0; i < coordinate_count; ++i)
{
nodes_input_stream.read((char *)&current_node, sizeof(QueryNode));
nodes_input_stream.read((char *)&current_node, sizeof(extractor::QueryNode));
coords->at(i) = FixedPointCoordinate(current_node.lat, current_node.lon);
BOOST_ASSERT((std::abs(coords->at(i).lat) >> 30) == 0);
BOOST_ASSERT((std::abs(coords->at(i).lon) >> 30) == 0);
@@ -51,6 +56,7 @@ void benchmarkQuery(const std::vector<FixedPointCoordinate> &queries,
for (const auto &q : queries)
{
auto result = query(q);
(void) result;
}
TIMER_STOP(query);
@@ -102,6 +108,8 @@ void benchmark(BenchStaticRTree &rtree, BenchQuery &geo_query, unsigned num_quer
return geo_query.NearestPhantomNodes(q, 10);
});
}
}
}
int main(int argc, char **argv)
{
@@ -116,12 +124,12 @@ int main(int argc, char **argv)
const char *file_path = argv[2];
const char *nodes_path = argv[3];
auto coords = loadCoordinates(nodes_path);
auto coords = osrm::benchmarks::loadCoordinates(nodes_path);
BenchStaticRTree rtree(ram_path, file_path, coords);
BenchQuery query(rtree, coords);
osrm::benchmarks::BenchStaticRTree rtree(ram_path, file_path, coords);
osrm::benchmarks::BenchQuery query(rtree, coords);
benchmark(rtree, query, 10000);
osrm::benchmarks::benchmark(rtree, query, 10000);
return 0;
}