From b3ec9c93232f627cf7113ee07e0733463a5289a4 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Fri, 9 May 2014 16:48:58 +0200 Subject: [PATCH] reformat --- DataStructures/StaticRTree.h | 20 +++-------- Server/DataStructures/InternalDataFacade.h | 2 +- Server/DataStructures/SharedDataFacade.h | 6 ++-- prepare.cpp | 41 ++++++++++++---------- 4 files changed, 32 insertions(+), 37 deletions(-) diff --git a/DataStructures/StaticRTree.h b/DataStructures/StaticRTree.h index 5889b1ed9..f30d53289 100644 --- a/DataStructures/StaticRTree.h +++ b/DataStructures/StaticRTree.h @@ -72,9 +72,7 @@ class StaticRTree public: struct RectangleInt2D { - RectangleInt2D() : min_lon(INT_MAX), max_lon(INT_MIN), min_lat(INT_MAX), max_lat(INT_MIN) - { - } + RectangleInt2D() : min_lon(INT_MAX), max_lon(INT_MIN), min_lat(INT_MAX), max_lat(INT_MIN) {} int32_t min_lon, max_lon; int32_t min_lat, max_lat; @@ -207,9 +205,7 @@ class StaticRTree struct TreeNode { - TreeNode() : child_count(0), child_is_on_disk(false) - { - } + TreeNode() : child_count(0), child_is_on_disk(false) {} RectangleT minimum_bounding_rectangle; uint32_t child_count : 31; bool child_is_on_disk : 1; @@ -224,9 +220,7 @@ class StaticRTree { } - WrappedInputElement() : m_array_index(UINT_MAX), m_hilbert_value(0) - { - } + WrappedInputElement() : m_array_index(UINT_MAX), m_hilbert_value(0) {} uint32_t m_array_index; uint64_t m_hilbert_value; @@ -239,9 +233,7 @@ class StaticRTree struct LeafNode { - LeafNode() : object_count(0) - { - } + LeafNode() : object_count(0) {} uint32_t object_count; std::array objects; }; @@ -252,9 +244,7 @@ class StaticRTree : node_id(n_id), min_dist(dist) { } - QueryCandidate() : node_id(UINT_MAX), min_dist(std::numeric_limits::max()) - { - } + QueryCandidate() : node_id(UINT_MAX), min_dist(std::numeric_limits::max()) {} uint32_t node_id; double min_dist; inline bool operator<(const QueryCandidate &other) const diff --git a/Server/DataStructures/InternalDataFacade.h b/Server/DataStructures/InternalDataFacade.h index 45175808e..b12609823 100644 --- a/Server/DataStructures/InternalDataFacade.h +++ b/Server/DataStructures/InternalDataFacade.h @@ -71,7 +71,7 @@ template class InternalDataFacade : public BaseDataFacade::vector m_geometry_indices; ShM::vector m_geometry_list; - std::shared_ptr::vector, false>> + std::shared_ptr::vector, false>> m_static_rtree; void LoadTimestamp(const boost::filesystem::path ×tamp_path) diff --git a/Server/DataStructures/SharedDataFacade.h b/Server/DataStructures/SharedDataFacade.h index aa26a2503..2f0bbaf1a 100644 --- a/Server/DataStructures/SharedDataFacade.h +++ b/Server/DataStructures/SharedDataFacade.h @@ -97,9 +97,9 @@ template class SharedDataFacade : public BaseDataFacadeempty(), "coordinates must be loaded before r-tree"); RTreeNode *tree_ptr = (RTreeNode *)(shared_memory + data_layout->GetRSearchTreeOffset()); - m_static_rtree = std::make_shared< - StaticRTree::vector, true>>( - tree_ptr, data_layout->r_search_tree_size, file_index_path, m_coordinate_list); + m_static_rtree = + std::make_shared::vector, true>>( + tree_ptr, data_layout->r_search_tree_size, file_index_path, m_coordinate_list); } void LoadGraph() diff --git a/prepare.cpp b/prepare.cpp index f4dc1889d..3b10f5385 100644 --- a/prepare.cpp +++ b/prepare.cpp @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) restriction_stream.read((char *)&number_of_usable_restrictions, sizeof(unsigned)); restriction_list.resize(number_of_usable_restrictions); restriction_stream.read((char *)&(restriction_list[0]), - number_of_usable_restrictions * sizeof(TurnRestriction)); + number_of_usable_restrictions * sizeof(TurnRestriction)); restriction_stream.close(); boost::filesystem::ifstream in; @@ -253,12 +253,13 @@ int main(int argc, char *argv[]) speed_profile.has_turn_penalty_function = lua_function_exists(lua_state, "turn_function"); std::vector edge_list; - NodeID number_of_node_based_nodes = readBinaryOSRMGraphFromStream(in, - edge_list, - barrier_node_list, - traffic_light_list, - &internal_to_external_node_map, - restriction_list); + NodeID number_of_node_based_nodes = + readBinaryOSRMGraphFromStream(in, + edge_list, + barrier_node_list, + traffic_light_list, + &internal_to_external_node_map, + restriction_list); in.close(); if (edge_list.empty()) @@ -276,9 +277,11 @@ int main(int argc, char *argv[]) */ SimpleLogger().Write() << "Generating edge-expanded graph representation"; - std::shared_ptr node_based_graph = NodeBasedDynamicGraphFromImportEdges(number_of_node_based_nodes, edge_list); - std::unique_ptr restriction_map = std::unique_ptr(new RestrictionMap(node_based_graph, restriction_list)); - EdgeBasedGraphFactory * edge_based_graph_factor = + std::shared_ptr node_based_graph = + NodeBasedDynamicGraphFromImportEdges(number_of_node_based_nodes, edge_list); + std::unique_ptr restriction_map = + std::unique_ptr(new RestrictionMap(node_based_graph, restriction_list)); + EdgeBasedGraphFactory *edge_based_graph_factor = new EdgeBasedGraphFactory(node_based_graph, std::move(restriction_map), barrier_node_list, @@ -335,7 +338,7 @@ int main(int argc, char *argv[]) const unsigned size_of_mapping = internal_to_external_node_map.size(); node_stream.write((char *)&size_of_mapping, sizeof(unsigned)); node_stream.write((char *)&(internal_to_external_node_map[0]), - size_of_mapping * sizeof(NodeInfo)); + size_of_mapping * sizeof(NodeInfo)); node_stream.close(); internal_to_external_node_map.clear(); internal_to_external_node_map.shrink_to_fit(); @@ -378,7 +381,8 @@ int main(int argc, char *argv[]) max_used_node_id = std::max(max_used_node_id, edge.source); max_used_node_id = std::max(max_used_node_id, edge.target); } - SimpleLogger().Write(logDEBUG) << "input graph has " << number_of_edge_based_nodes << " nodes"; + SimpleLogger().Write(logDEBUG) << "input graph has " << number_of_edge_based_nodes + << " nodes"; SimpleLogger().Write(logDEBUG) << "contracted graph has " << max_used_node_id << " nodes"; max_used_node_id += 1; @@ -398,7 +402,7 @@ int main(int argc, char *argv[]) ++edge; } node_array[node].firstEdge = position; //=edge - position += edge - lastEdge; // remove + position += edge - lastEdge; // remove } for (unsigned sentinel_counter = max_used_node_id; sentinel_counter != node_array.size(); @@ -436,10 +440,10 @@ int main(int argc, char *argv[]) BOOST_ASSERT(current_edge.target < max_used_node_id); if (current_edge.data.distance <= 0) { - SimpleLogger().Write(logWARNING) << "Edge: " << edge - << ",source: " << contracted_edge_list[edge].source - << ", target: " << contracted_edge_list[edge].target - << ", dist: " << current_edge.data.distance; + SimpleLogger().Write(logWARNING) + << "Edge: " << edge << ",source: " << contracted_edge_list[edge].source + << ", target: " << contracted_edge_list[edge].target + << ", dist: " << current_edge.data.distance; SimpleLogger().Write(logWARNING) << "Failed at adjacency list of node " << contracted_edge_list[edge].source << "/" @@ -465,7 +469,8 @@ int main(int argc, char *argv[]) SimpleLogger().Write() << "Contraction: " << (number_of_edge_based_nodes / contraction_duration.count()) << " nodes/sec and " - << number_of_used_edges / contraction_duration.count() << " edges/sec"; + << number_of_used_edges / contraction_duration.count() + << " edges/sec"; node_array.clear(); SimpleLogger().Write() << "finished preprocessing";