Skip to content

Commit

Permalink
Refactor RTree so that .fileIndex only contains EdgeDataT, and all r-…
Browse files Browse the repository at this point in the history
…tree structure is in the .ramIndex file.

Also tunes the BRANCHING_FACTOR a bit to speed up access with this new layout.
  • Loading branch information
danpat committed Jun 2, 2017
1 parent a926740 commit 805b12f
Show file tree
Hide file tree
Showing 6 changed files with 444 additions and 217 deletions.
16 changes: 8 additions & 8 deletions features/testbot/traffic_speeds.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Feature: Traffic - speeds
# \ | /
# d./
Given the node locations
| node | lat | lon |
| a | 0.1 | 0.1 |
| b | 0.05 | 0.1 |
| c | 0.0 | 0.1 |
| d | 0.05 | 0.03 |
| e | 0.05 | 0.066 |
| f | 0.075 | 0.066 |
| g | 0.075 | 0.1 |
| node | lat | lon | id |
| a | 0.1 | 0.1 | 1 |
| b | 0.05 | 0.1 | 2 |
| c | 0.0 | 0.1 | 3 |
| d | 0.05 | 0.03 | 4 |
| e | 0.05 | 0.066 | 5 |
| f | 0.075 | 0.066 | 6 |
| g | 0.075 | 0.1 | 7 |
And the ways
| nodes | highway |
| ab | primary |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,15 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
"Is any data loaded into shared memory?" + SOURCE_REF);
}

auto tree_ptr =
auto tree_nodes_ptr =
data_layout.GetBlockPtr<RTreeNode>(memory_block, storage::DataLayout::R_SEARCH_TREE);
auto tree_level_sizes_ptr = data_layout.GetBlockPtr<std::uint64_t>(
memory_block, storage::DataLayout::R_SEARCH_TREE_LEVELS);
m_static_rtree.reset(
new SharedRTree(tree_ptr,
new SharedRTree(tree_nodes_ptr,
data_layout.num_entries[storage::DataLayout::R_SEARCH_TREE],
tree_level_sizes_ptr,
data_layout.num_entries[storage::DataLayout::R_SEARCH_TREE_LEVELS],
file_index_path,
m_coordinate_list));
m_geospatial_query.reset(
Expand Down
2 changes: 2 additions & 0 deletions include/storage/shared_datatype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const constexpr char *block_id_to_name[] = {"NAME_CHAR_DATA",
"TURN_INSTRUCTION",
"ENTRY_CLASSID",
"R_SEARCH_TREE",
"R_SEARCH_TREE_LEVELS",
"GEOMETRIES_INDEX",
"GEOMETRIES_NODE_LIST",
"GEOMETRIES_FWD_WEIGHT_LIST",
Expand Down Expand Up @@ -84,6 +85,7 @@ struct DataLayout
TURN_INSTRUCTION,
ENTRY_CLASSID,
R_SEARCH_TREE,
R_SEARCH_TREE_LEVELS,
GEOMETRIES_INDEX,
GEOMETRIES_NODE_LIST,
GEOMETRIES_FWD_WEIGHT_LIST,
Expand Down
9 changes: 6 additions & 3 deletions include/util/rectangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,12 @@ struct RectangleInt2D
};
inline std::ostream &operator<<(std::ostream &out, const RectangleInt2D &rect)
{
out << std::setprecision(12) << "(" << toFloating(rect.min_lon) << ","
<< toFloating(rect.max_lon) << "," << toFloating(rect.min_lat) << ","
<< toFloating(rect.max_lat) << ")";
out << std::setprecision(12) << "{\"type\":\"Polygon\",\"coordinates\": [["
<< toFloating(rect.min_lon) << "," << toFloating(rect.min_lat) << "],["
<< toFloating(rect.min_lon) << "," << toFloating(rect.max_lat) << "],["
<< toFloating(rect.max_lon) << "," << toFloating(rect.max_lat) << "],["
<< toFloating(rect.max_lon) << "," << toFloating(rect.min_lat) << "],["
<< toFloating(rect.min_lon) << "," << toFloating(rect.min_lat) << "]] }";
return out;
}
}
Expand Down
Loading

0 comments on commit 805b12f

Please sign in to comment.