Use 16bit for SegmentWeight and SegmentDuration
This commit is contained in:
committed by
Patrick Niklaus
parent
5c4f96e4bc
commit
d6c6a262d8
@@ -431,27 +431,27 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
geometries_node_list_ptr,
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_NODE_LIST]);
|
||||
|
||||
auto geometries_fwd_weight_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
||||
auto geometries_fwd_weight_list_ptr = data_layout.GetBlockPtr<SegmentWeight>(
|
||||
memory_block, storage::DataLayout::GEOMETRIES_FWD_WEIGHT_LIST);
|
||||
util::vector_view<EdgeWeight> geometry_fwd_weight_list(
|
||||
util::vector_view<SegmentWeight> geometry_fwd_weight_list(
|
||||
geometries_fwd_weight_list_ptr,
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_FWD_WEIGHT_LIST]);
|
||||
|
||||
auto geometries_rev_weight_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
||||
auto geometries_rev_weight_list_ptr = data_layout.GetBlockPtr<SegmentWeight>(
|
||||
memory_block, storage::DataLayout::GEOMETRIES_REV_WEIGHT_LIST);
|
||||
util::vector_view<EdgeWeight> geometry_rev_weight_list(
|
||||
util::vector_view<SegmentWeight> geometry_rev_weight_list(
|
||||
geometries_rev_weight_list_ptr,
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_WEIGHT_LIST]);
|
||||
|
||||
auto geometries_fwd_duration_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
||||
auto geometries_fwd_duration_list_ptr = data_layout.GetBlockPtr<SegmentDuration>(
|
||||
memory_block, storage::DataLayout::GEOMETRIES_FWD_DURATION_LIST);
|
||||
util::vector_view<EdgeWeight> geometry_fwd_duration_list(
|
||||
util::vector_view<SegmentDuration> geometry_fwd_duration_list(
|
||||
geometries_fwd_duration_list_ptr,
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_FWD_DURATION_LIST]);
|
||||
|
||||
auto geometries_rev_duration_list_ptr = data_layout.GetBlockPtr<EdgeWeight>(
|
||||
auto geometries_rev_duration_list_ptr = data_layout.GetBlockPtr<SegmentDuration>(
|
||||
memory_block, storage::DataLayout::GEOMETRIES_REV_DURATION_LIST);
|
||||
util::vector_view<EdgeWeight> geometry_rev_duration_list(
|
||||
util::vector_view<SegmentDuration> geometry_rev_duration_list(
|
||||
geometries_rev_duration_list_ptr,
|
||||
data_layout.num_entries[storage::DataLayout::GEOMETRIES_REV_DURATION_LIST]);
|
||||
|
||||
|
||||
@@ -371,8 +371,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
|
||||
EdgeWeight forward_weight_offset = 0, forward_weight = 0;
|
||||
EdgeWeight reverse_weight_offset = 0, reverse_weight = 0;
|
||||
EdgeWeight forward_duration_offset = 0, forward_duration = 0;
|
||||
EdgeWeight reverse_duration_offset = 0, reverse_duration = 0;
|
||||
EdgeDuration forward_duration_offset = 0, forward_duration = 0;
|
||||
EdgeDuration reverse_duration_offset = 0, reverse_duration = 0;
|
||||
|
||||
const std::vector<EdgeWeight> forward_weight_vector =
|
||||
datafacade.GetUncompressedForwardWeights(data.packed_geometry_id);
|
||||
@@ -408,12 +408,12 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
if (data.forward_segment_id.id != SPECIAL_SEGMENTID)
|
||||
{
|
||||
forward_weight = static_cast<EdgeWeight>(forward_weight * ratio);
|
||||
forward_duration = static_cast<EdgeWeight>(forward_duration * ratio);
|
||||
forward_duration = static_cast<EdgeDuration>(forward_duration * ratio);
|
||||
}
|
||||
if (data.reverse_segment_id.id != SPECIAL_SEGMENTID)
|
||||
{
|
||||
reverse_weight -= static_cast<EdgeWeight>(reverse_weight * ratio);
|
||||
reverse_duration -= static_cast<EdgeWeight>(reverse_duration * ratio);
|
||||
reverse_duration -= static_cast<EdgeDuration>(reverse_duration * ratio);
|
||||
}
|
||||
|
||||
auto transformed = PhantomNodeWithDistance{PhantomNode{data,
|
||||
|
||||
@@ -22,8 +22,8 @@ class CompressedEdgeContainer
|
||||
{
|
||||
public:
|
||||
NodeID node_id; // refers to an internal node-based-node
|
||||
EdgeWeight weight; // the weight of the edge leading to this node
|
||||
EdgeWeight duration; // the duration of the edge leading to this node
|
||||
SegmentWeight weight; // the weight of the edge leading to this node
|
||||
SegmentDuration duration; // the duration of the edge leading to this node
|
||||
};
|
||||
|
||||
using OnewayEdgeBucket = std::vector<OnewayCompressedEdge>;
|
||||
@@ -35,13 +35,13 @@ class CompressedEdgeContainer
|
||||
const NodeID target_node,
|
||||
const EdgeWeight weight1,
|
||||
const EdgeWeight weight2,
|
||||
const EdgeWeight duration1,
|
||||
const EdgeWeight duration2);
|
||||
const EdgeDuration duration1,
|
||||
const EdgeDuration duration2);
|
||||
|
||||
void AddUncompressedEdge(const EdgeID edge_id,
|
||||
const NodeID target_node,
|
||||
const EdgeWeight weight,
|
||||
const EdgeWeight duration);
|
||||
const SegmentWeight weight,
|
||||
const SegmentWeight duration);
|
||||
|
||||
void InitializeBothwayVector();
|
||||
unsigned ZipEdges(const unsigned f_edge_pos, const unsigned r_edge_pos);
|
||||
|
||||
@@ -19,7 +19,7 @@ struct NodeBasedEdge
|
||||
NodeID target,
|
||||
NodeID name_id,
|
||||
EdgeWeight weight,
|
||||
EdgeWeight duration,
|
||||
EdgeDuration duration,
|
||||
bool forward,
|
||||
bool backward,
|
||||
bool roundabout,
|
||||
@@ -37,7 +37,7 @@ struct NodeBasedEdge
|
||||
NodeID target; // 32 4
|
||||
NodeID name_id; // 32 4
|
||||
EdgeWeight weight; // 32 4
|
||||
EdgeWeight duration; // 32 4
|
||||
EdgeDuration duration; // 32 4
|
||||
std::uint8_t forward : 1; // 1
|
||||
std::uint8_t backward : 1; // 1
|
||||
std::uint8_t roundabout : 1; // 1
|
||||
@@ -56,7 +56,7 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge
|
||||
OSMNodeID target,
|
||||
NodeID name_id,
|
||||
EdgeWeight weight,
|
||||
EdgeWeight duration,
|
||||
EdgeDuration duration,
|
||||
bool forward,
|
||||
bool backward,
|
||||
bool roundabout,
|
||||
@@ -86,7 +86,7 @@ inline NodeBasedEdge::NodeBasedEdge(NodeID source,
|
||||
NodeID target,
|
||||
NodeID name_id,
|
||||
EdgeWeight weight,
|
||||
EdgeWeight duration,
|
||||
EdgeDuration duration,
|
||||
bool forward,
|
||||
bool backward,
|
||||
bool roundabout,
|
||||
@@ -125,7 +125,7 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
|
||||
OSMNodeID target,
|
||||
NodeID name_id,
|
||||
EdgeWeight weight,
|
||||
EdgeWeight duration,
|
||||
EdgeDuration duration,
|
||||
bool forward,
|
||||
bool backward,
|
||||
bool roundabout,
|
||||
|
||||
@@ -55,10 +55,10 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||
|
||||
SegmentDataContainerImpl(Vector<std::uint32_t> index_,
|
||||
Vector<NodeID> nodes_,
|
||||
Vector<EdgeWeight> fwd_weights_,
|
||||
Vector<EdgeWeight> rev_weights_,
|
||||
Vector<EdgeWeight> fwd_durations_,
|
||||
Vector<EdgeWeight> rev_durations_,
|
||||
Vector<SegmentWeight> fwd_weights_,
|
||||
Vector<SegmentWeight> rev_weights_,
|
||||
Vector<SegmentDuration> fwd_durations_,
|
||||
Vector<SegmentDuration> rev_durations_,
|
||||
Vector<DatasourceID> datasources_)
|
||||
: index(std::move(index_)), nodes(std::move(nodes_)), fwd_weights(std::move(fwd_weights_)),
|
||||
rev_weights(std::move(rev_weights_)), fwd_durations(std::move(fwd_durations_)),
|
||||
@@ -201,10 +201,10 @@ template <storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||
private:
|
||||
Vector<std::uint32_t> index;
|
||||
Vector<NodeID> nodes;
|
||||
Vector<EdgeWeight> fwd_weights;
|
||||
Vector<EdgeWeight> rev_weights;
|
||||
Vector<EdgeWeight> fwd_durations;
|
||||
Vector<EdgeWeight> rev_durations;
|
||||
Vector<SegmentWeight> fwd_weights;
|
||||
Vector<SegmentWeight> rev_weights;
|
||||
Vector<SegmentDuration> fwd_durations;
|
||||
Vector<SegmentDuration> rev_durations;
|
||||
Vector<DatasourceID> datasources;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ using NodeID = std::uint32_t;
|
||||
using EdgeID = std::uint32_t;
|
||||
using NameID = std::uint32_t;
|
||||
using EdgeWeight = std::int32_t;
|
||||
using EdgeDuration = std::int32_t;
|
||||
using SegmentWeight = std::uint16_t;
|
||||
using SegmentDuration = std::uint16_t;
|
||||
using TurnPenalty = std::int16_t; // turn penalty in 100ms units
|
||||
|
||||
static const std::size_t INVALID_INDEX = std::numeric_limits<std::size_t>::max();
|
||||
@@ -85,8 +88,10 @@ static const EdgeID SPECIAL_EDGEID = std::numeric_limits<EdgeID>::max();
|
||||
static const NameID INVALID_NAMEID = std::numeric_limits<NameID>::max();
|
||||
static const NameID EMPTY_NAMEID = 0;
|
||||
static const unsigned INVALID_COMPONENTID = 0;
|
||||
static const SegmentWeight INVALID_SEGMENT_WEIGHT = std::numeric_limits<SegmentWeight>::max();
|
||||
static const SegmentDuration INVALID_SEGMENT_DURATION = std::numeric_limits<SegmentDuration>::max();
|
||||
static const EdgeWeight INVALID_EDGE_WEIGHT = std::numeric_limits<EdgeWeight>::max();
|
||||
static const EdgeWeight MAXIMAL_EDGE_DURATION = std::numeric_limits<EdgeWeight>::max();
|
||||
static const EdgeDuration MAXIMAL_EDGE_DURATION = std::numeric_limits<EdgeDuration>::max();
|
||||
static const TurnPenalty INVALID_TURN_PENALTY = std::numeric_limits<TurnPenalty>::max();
|
||||
|
||||
// FIXME the bitfields we use require a reduced maximal duration, this should be kept consistent
|
||||
|
||||
Reference in New Issue
Block a user