Remove duration fallback for turn penalties to simplify logic

This commit is contained in:
Patrick Niklaus
2017-03-14 23:08:01 +00:00
committed by Patrick Niklaus
parent 5ab882759d
commit 809d8a7d03
4 changed files with 20 additions and 101 deletions
@@ -417,20 +417,11 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
m_turn_weight_penalties = util::ShM<TurnPenalty, true>::vector(
turn_weight_penalties_ptr,
data_layout.num_entries[storage::DataLayout::TURN_WEIGHT_PENALTIES]);
if (data_layout.num_entries[storage::DataLayout::TURN_DURATION_PENALTIES] == 0)
{ // Fallback to turn weight penalties that are turn duration penalties in deciseconds
m_turn_duration_penalties = util::ShM<TurnPenalty, true>::vector(
turn_weight_penalties_ptr,
data_layout.num_entries[storage::DataLayout::TURN_WEIGHT_PENALTIES]);
}
else
{
auto turn_duration_penalties_ptr = data_layout.GetBlockPtr<TurnPenalty>(
memory_block, storage::DataLayout::TURN_DURATION_PENALTIES);
m_turn_duration_penalties = util::ShM<TurnPenalty, true>::vector(
turn_duration_penalties_ptr,
data_layout.num_entries[storage::DataLayout::TURN_DURATION_PENALTIES]);
}
auto turn_duration_penalties_ptr = data_layout.GetBlockPtr<TurnPenalty>(
memory_block, storage::DataLayout::TURN_DURATION_PENALTIES);
m_turn_duration_penalties = util::ShM<TurnPenalty, true>::vector(
turn_duration_penalties_ptr,
data_layout.num_entries[storage::DataLayout::TURN_DURATION_PENALTIES]);
}
void InitializeGeometryPointers(storage::DataLayout &data_layout, char *memory_block)
@@ -46,37 +46,6 @@ class ScriptingEnvironment;
namespace lookup
{
// Set to 1 byte alignment
#pragma pack(push, 1)
struct SegmentHeaderBlock
{
std::uint32_t num_osm_nodes;
OSMNodeID previous_osm_node_id;
};
#pragma pack(pop)
static_assert(sizeof(SegmentHeaderBlock) == 12, "SegmentHeaderBlock is not packed correctly");
#pragma pack(push, 1)
struct SegmentBlock
{
OSMNodeID this_osm_node_id;
double segment_length;
EdgeWeight segment_weight;
EdgeWeight segment_duration;
};
#pragma pack(pop)
static_assert(sizeof(SegmentBlock) == 24, "SegmentBlock is not packed correctly");
#pragma pack(push, 1)
struct TurnPenaltiesHeader
{
//! the number of penalties in each block
std::uint64_t number_of_penalties;
};
#pragma pack(pop)
static_assert(std::is_trivial<TurnPenaltiesHeader>::value, "TurnPenaltiesHeader is not trivial");
static_assert(sizeof(TurnPenaltiesHeader) == 8, "TurnPenaltiesHeader is not packed correctly");
#pragma pack(push, 1)
struct TurnIndexBlock
{