reformat
This commit is contained in:
parent
84ffedd95d
commit
b3ec9c9323
@ -72,9 +72,7 @@ class StaticRTree
|
|||||||
public:
|
public:
|
||||||
struct RectangleInt2D
|
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_lon, max_lon;
|
||||||
int32_t min_lat, max_lat;
|
int32_t min_lat, max_lat;
|
||||||
@ -207,9 +205,7 @@ class StaticRTree
|
|||||||
|
|
||||||
struct TreeNode
|
struct TreeNode
|
||||||
{
|
{
|
||||||
TreeNode() : child_count(0), child_is_on_disk(false)
|
TreeNode() : child_count(0), child_is_on_disk(false) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
RectangleT minimum_bounding_rectangle;
|
RectangleT minimum_bounding_rectangle;
|
||||||
uint32_t child_count : 31;
|
uint32_t child_count : 31;
|
||||||
bool child_is_on_disk : 1;
|
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;
|
uint32_t m_array_index;
|
||||||
uint64_t m_hilbert_value;
|
uint64_t m_hilbert_value;
|
||||||
@ -239,9 +233,7 @@ class StaticRTree
|
|||||||
|
|
||||||
struct LeafNode
|
struct LeafNode
|
||||||
{
|
{
|
||||||
LeafNode() : object_count(0)
|
LeafNode() : object_count(0) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
uint32_t object_count;
|
uint32_t object_count;
|
||||||
std::array<DataT, RTREE_LEAF_NODE_SIZE> objects;
|
std::array<DataT, RTREE_LEAF_NODE_SIZE> objects;
|
||||||
};
|
};
|
||||||
@ -252,9 +244,7 @@ class StaticRTree
|
|||||||
: node_id(n_id), min_dist(dist)
|
: 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;
|
uint32_t node_id;
|
||||||
double min_dist;
|
double min_dist;
|
||||||
inline bool operator<(const QueryCandidate &other) const
|
inline bool operator<(const QueryCandidate &other) const
|
||||||
|
@ -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_indices;
|
||||||
ShM<unsigned, false>::vector m_geometry_list;
|
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;
|
m_static_rtree;
|
||||||
|
|
||||||
void LoadTimestamp(const boost::filesystem::path ×tamp_path)
|
void LoadTimestamp(const boost::filesystem::path ×tamp_path)
|
||||||
|
@ -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");
|
BOOST_ASSERT_MSG(!m_coordinate_list->empty(), "coordinates must be loaded before r-tree");
|
||||||
|
|
||||||
RTreeNode *tree_ptr = (RTreeNode *)(shared_memory + data_layout->GetRSearchTreeOffset());
|
RTreeNode *tree_ptr = (RTreeNode *)(shared_memory + data_layout->GetRSearchTreeOffset());
|
||||||
m_static_rtree = std::make_shared<
|
m_static_rtree =
|
||||||
StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>>(
|
std::make_shared<StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>>(
|
||||||
tree_ptr, data_layout->r_search_tree_size, file_index_path, m_coordinate_list);
|
tree_ptr, data_layout->r_search_tree_size, file_index_path, m_coordinate_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadGraph()
|
void LoadGraph()
|
||||||
|
41
prepare.cpp
41
prepare.cpp
@ -198,7 +198,7 @@ int main(int argc, char *argv[])
|
|||||||
restriction_stream.read((char *)&number_of_usable_restrictions, sizeof(unsigned));
|
restriction_stream.read((char *)&number_of_usable_restrictions, sizeof(unsigned));
|
||||||
restriction_list.resize(number_of_usable_restrictions);
|
restriction_list.resize(number_of_usable_restrictions);
|
||||||
restriction_stream.read((char *)&(restriction_list[0]),
|
restriction_stream.read((char *)&(restriction_list[0]),
|
||||||
number_of_usable_restrictions * sizeof(TurnRestriction));
|
number_of_usable_restrictions * sizeof(TurnRestriction));
|
||||||
restriction_stream.close();
|
restriction_stream.close();
|
||||||
|
|
||||||
boost::filesystem::ifstream in;
|
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");
|
speed_profile.has_turn_penalty_function = lua_function_exists(lua_state, "turn_function");
|
||||||
|
|
||||||
std::vector<ImportEdge> edge_list;
|
std::vector<ImportEdge> edge_list;
|
||||||
NodeID number_of_node_based_nodes = readBinaryOSRMGraphFromStream(in,
|
NodeID number_of_node_based_nodes =
|
||||||
edge_list,
|
readBinaryOSRMGraphFromStream(in,
|
||||||
barrier_node_list,
|
edge_list,
|
||||||
traffic_light_list,
|
barrier_node_list,
|
||||||
&internal_to_external_node_map,
|
traffic_light_list,
|
||||||
restriction_list);
|
&internal_to_external_node_map,
|
||||||
|
restriction_list);
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
if (edge_list.empty())
|
if (edge_list.empty())
|
||||||
@ -276,9 +277,11 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SimpleLogger().Write() << "Generating edge-expanded graph representation";
|
SimpleLogger().Write() << "Generating edge-expanded graph representation";
|
||||||
std::shared_ptr<NodeBasedDynamicGraph> node_based_graph = NodeBasedDynamicGraphFromImportEdges(number_of_node_based_nodes, edge_list);
|
std::shared_ptr<NodeBasedDynamicGraph> node_based_graph =
|
||||||
std::unique_ptr<RestrictionMap> restriction_map = std::unique_ptr<RestrictionMap>(new RestrictionMap(node_based_graph, restriction_list));
|
NodeBasedDynamicGraphFromImportEdges(number_of_node_based_nodes, edge_list);
|
||||||
EdgeBasedGraphFactory * edge_based_graph_factor =
|
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,
|
new EdgeBasedGraphFactory(node_based_graph,
|
||||||
std::move(restriction_map),
|
std::move(restriction_map),
|
||||||
barrier_node_list,
|
barrier_node_list,
|
||||||
@ -335,7 +338,7 @@ int main(int argc, char *argv[])
|
|||||||
const unsigned size_of_mapping = internal_to_external_node_map.size();
|
const unsigned size_of_mapping = internal_to_external_node_map.size();
|
||||||
node_stream.write((char *)&size_of_mapping, sizeof(unsigned));
|
node_stream.write((char *)&size_of_mapping, sizeof(unsigned));
|
||||||
node_stream.write((char *)&(internal_to_external_node_map[0]),
|
node_stream.write((char *)&(internal_to_external_node_map[0]),
|
||||||
size_of_mapping * sizeof(NodeInfo));
|
size_of_mapping * sizeof(NodeInfo));
|
||||||
node_stream.close();
|
node_stream.close();
|
||||||
internal_to_external_node_map.clear();
|
internal_to_external_node_map.clear();
|
||||||
internal_to_external_node_map.shrink_to_fit();
|
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.source);
|
||||||
max_used_node_id = std::max(max_used_node_id, edge.target);
|
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";
|
SimpleLogger().Write(logDEBUG) << "contracted graph has " << max_used_node_id << " nodes";
|
||||||
max_used_node_id += 1;
|
max_used_node_id += 1;
|
||||||
|
|
||||||
@ -398,7 +402,7 @@ int main(int argc, char *argv[])
|
|||||||
++edge;
|
++edge;
|
||||||
}
|
}
|
||||||
node_array[node].firstEdge = position; //=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();
|
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);
|
BOOST_ASSERT(current_edge.target < max_used_node_id);
|
||||||
if (current_edge.data.distance <= 0)
|
if (current_edge.data.distance <= 0)
|
||||||
{
|
{
|
||||||
SimpleLogger().Write(logWARNING) << "Edge: " << edge
|
SimpleLogger().Write(logWARNING)
|
||||||
<< ",source: " << contracted_edge_list[edge].source
|
<< "Edge: " << edge << ",source: " << contracted_edge_list[edge].source
|
||||||
<< ", target: " << contracted_edge_list[edge].target
|
<< ", target: " << contracted_edge_list[edge].target
|
||||||
<< ", dist: " << current_edge.data.distance;
|
<< ", dist: " << current_edge.data.distance;
|
||||||
|
|
||||||
SimpleLogger().Write(logWARNING) << "Failed at adjacency list of node "
|
SimpleLogger().Write(logWARNING) << "Failed at adjacency list of node "
|
||||||
<< contracted_edge_list[edge].source << "/"
|
<< contracted_edge_list[edge].source << "/"
|
||||||
@ -465,7 +469,8 @@ int main(int argc, char *argv[])
|
|||||||
SimpleLogger().Write() << "Contraction: "
|
SimpleLogger().Write() << "Contraction: "
|
||||||
<< (number_of_edge_based_nodes / contraction_duration.count())
|
<< (number_of_edge_based_nodes / contraction_duration.count())
|
||||||
<< " nodes/sec and "
|
<< " nodes/sec and "
|
||||||
<< number_of_used_edges / contraction_duration.count() << " edges/sec";
|
<< number_of_used_edges / contraction_duration.count()
|
||||||
|
<< " edges/sec";
|
||||||
|
|
||||||
node_array.clear();
|
node_array.clear();
|
||||||
SimpleLogger().Write() << "finished preprocessing";
|
SimpleLogger().Write() << "finished preprocessing";
|
||||||
|
Loading…
Reference in New Issue
Block a user