This commit is contained in:
Dennis Luxen 2014-05-09 16:48:58 +02:00
parent 84ffedd95d
commit b3ec9c9323
4 changed files with 32 additions and 37 deletions

View File

@ -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<DataT, RTREE_LEAF_NODE_SIZE> objects;
};
@ -252,9 +244,7 @@ class StaticRTree
: node_id(n_id), min_dist(dist)
{
}
QueryCandidate() : node_id(UINT_MAX), min_dist(std::numeric_limits<double>::max())
{
}
QueryCandidate() : node_id(UINT_MAX), min_dist(std::numeric_limits<double>::max()) {}
uint32_t node_id;
double min_dist;
inline bool operator<(const QueryCandidate &other) const

View File

@ -71,7 +71,7 @@ template <class EdgeDataT> class InternalDataFacade : public BaseDataFacade<Edge
ShM<unsigned, false>::vector m_geometry_indices;
ShM<unsigned, false>::vector m_geometry_list;
std::shared_ptr<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, false>::vector, false>>
std::shared_ptr<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, false>::vector, false>>
m_static_rtree;
void LoadTimestamp(const boost::filesystem::path &timestamp_path)

View File

@ -97,9 +97,9 @@ template <class EdgeDataT> class SharedDataFacade : public BaseDataFacade<EdgeDa
BOOST_ASSERT_MSG(!m_coordinate_list->empty(), "coordinates must be loaded before r-tree");
RTreeNode *tree_ptr = (RTreeNode *)(shared_memory + data_layout->GetRSearchTreeOffset());
m_static_rtree = std::make_shared<
StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>>(
tree_ptr, data_layout->r_search_tree_size, file_index_path, m_coordinate_list);
m_static_rtree =
std::make_shared<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>>(
tree_ptr, data_layout->r_search_tree_size, file_index_path, m_coordinate_list);
}
void LoadGraph()

View File

@ -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<ImportEdge> 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<NodeBasedDynamicGraph> node_based_graph = NodeBasedDynamicGraphFromImportEdges(number_of_node_based_nodes, edge_list);
std::unique_ptr<RestrictionMap> restriction_map = std::unique_ptr<RestrictionMap>(new RestrictionMap(node_based_graph, restriction_list));
EdgeBasedGraphFactory * edge_based_graph_factor =
std::shared_ptr<NodeBasedDynamicGraph> node_based_graph =
NodeBasedDynamicGraphFromImportEdges(number_of_node_based_nodes, edge_list);
std::unique_ptr<RestrictionMap> restriction_map =
std::unique_ptr<RestrictionMap>(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";