compiles and builds and partitions and customizes but routed fails
This commit is contained in:
parent
c3fc68c139
commit
98d53a83fa
@ -133,6 +133,46 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
const std::size_t stride;
|
const std::size_t stride;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ColumnIteratorD : public boost::iterator_facade<ColumnIteratorD,
|
||||||
|
DistanceValueT,
|
||||||
|
boost::random_access_traversal_tag>
|
||||||
|
{
|
||||||
|
using RowIterator = DistanceValueT;
|
||||||
|
typedef boost::iterator_facade<ColumnIteratorD,
|
||||||
|
DistanceValueT,
|
||||||
|
boost::random_access_traversal_tag>
|
||||||
|
base_t;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef typename base_t::value_type value_type;
|
||||||
|
typedef typename base_t::difference_type difference_type;
|
||||||
|
typedef typename base_t::reference reference;
|
||||||
|
typedef std::random_access_iterator_tag iterator_category;
|
||||||
|
|
||||||
|
explicit ColumnIteratorD() : current(nullptr), stride(1) {}
|
||||||
|
|
||||||
|
explicit ColumnIteratorD(DistancePtrT begin, std::size_t row_length)
|
||||||
|
: current(begin), stride(row_length)
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(begin != nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void increment() { current += stride; }
|
||||||
|
void decrement() { current -= stride; }
|
||||||
|
void advance(difference_type offset) { current += stride * offset; }
|
||||||
|
bool equal(const ColumnIteratorD &other) const { return current == other.current; }
|
||||||
|
reference dereference() const { return *current; }
|
||||||
|
difference_type distance_to(const ColumnIteratorD &other) const
|
||||||
|
{
|
||||||
|
return (other.current - current) / static_cast<std::intptr_t>(stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
friend class ::boost::iterator_core_access;
|
||||||
|
DistancePtrT current;
|
||||||
|
const std::size_t stride;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename ValuePtr> auto GetOutRange(const ValuePtr ptr, const NodeID node) const
|
template <typename ValuePtr> auto GetOutRange(const ValuePtr ptr, const NodeID node) const
|
||||||
{
|
{
|
||||||
auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node);
|
auto iter = std::find(source_boundary, source_boundary + num_source_nodes, node);
|
||||||
@ -159,6 +199,20 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
return boost::make_iterator_range(begin, end);
|
return boost::make_iterator_range(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto GetInRangeD(const DistancePtrT ptr, const NodeID node) const
|
||||||
|
{
|
||||||
|
auto iter =
|
||||||
|
std::find(destination_boundary, destination_boundary + num_destination_nodes, node);
|
||||||
|
if (iter == destination_boundary + num_destination_nodes)
|
||||||
|
return boost::make_iterator_range(ColumnIteratorD{}, ColumnIteratorD{});
|
||||||
|
|
||||||
|
auto column = std::distance(destination_boundary, iter);
|
||||||
|
auto begin = ColumnIteratorD{ptr + column, num_destination_nodes};
|
||||||
|
auto end = ColumnIteratorD{ptr + column + num_source_nodes * num_destination_nodes,
|
||||||
|
num_destination_nodes};
|
||||||
|
return boost::make_iterator_range(begin, end);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
auto GetOutWeight(NodeID node) const { return GetOutRange(weights, node); }
|
auto GetOutWeight(NodeID node) const { return GetOutRange(weights, node); }
|
||||||
|
|
||||||
@ -168,13 +222,11 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
|
|
||||||
auto GetInDuration(NodeID node) const { return GetInRange(durations, node); }
|
auto GetInDuration(NodeID node) const { return GetInRange(durations, node); }
|
||||||
|
|
||||||
auto GetOutDistance(NodeID node) const
|
auto GetInDistance(NodeID node) const { return GetInRangeD(distances, node); }
|
||||||
{
|
|
||||||
return GetOutRange(distances, node);
|
|
||||||
} // Might be symmetric and may be able to get away with simply having GetDistance and not
|
|
||||||
// have both GetInDistance and GetOutDistance
|
|
||||||
|
|
||||||
auto GetInDistance(NodeID node) const { return GetInRange(distances, node); }
|
auto GetOutDistance(NodeID node) const { return GetOutRange(distances, node); }
|
||||||
|
|
||||||
|
// auto GetInDistance(NodeID node) const { return GetInRange(distances, node); }
|
||||||
|
|
||||||
auto GetSourceNodes() const
|
auto GetSourceNodes() const
|
||||||
{
|
{
|
||||||
@ -203,7 +255,7 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(all_weights != nullptr);
|
BOOST_ASSERT(all_weights != nullptr);
|
||||||
BOOST_ASSERT(all_durations != nullptr);
|
BOOST_ASSERT(all_durations != nullptr);
|
||||||
BOOST_ASSERT(all_durations != nullptr);
|
BOOST_ASSERT(all_distances != nullptr);
|
||||||
BOOST_ASSERT(num_source_nodes == 0 || all_sources != nullptr);
|
BOOST_ASSERT(num_source_nodes == 0 || all_sources != nullptr);
|
||||||
BOOST_ASSERT(num_destination_nodes == 0 || all_destinations != nullptr);
|
BOOST_ASSERT(num_destination_nodes == 0 || all_destinations != nullptr);
|
||||||
}
|
}
|
||||||
@ -376,6 +428,7 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
|
|
||||||
metric.weights.resize(total_size + 1, INVALID_EDGE_WEIGHT);
|
metric.weights.resize(total_size + 1, INVALID_EDGE_WEIGHT);
|
||||||
metric.durations.resize(total_size + 1, MAXIMAL_EDGE_DURATION);
|
metric.durations.resize(total_size + 1, MAXIMAL_EDGE_DURATION);
|
||||||
|
metric.distances.resize(total_size + 1, INVALID_EDGE_DISTANCE);
|
||||||
|
|
||||||
return metric;
|
return metric;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,7 +167,10 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
|
|||||||
// New Node discovered -> Add to Heap + Node Info Storage
|
// New Node discovered -> Add to Heap + Node Info Storage
|
||||||
if (!query_heap.WasInserted(to))
|
if (!query_heap.WasInserted(to))
|
||||||
{
|
{
|
||||||
query_heap.Insert(to, to_weight, {node, false, to_duration, int(node_distance)});
|
query_heap.Insert(
|
||||||
|
to,
|
||||||
|
to_weight,
|
||||||
|
{node, false, to_duration, static_cast<EdgeDistance>(node_distance)});
|
||||||
}
|
}
|
||||||
// Found a shorter Path -> Update weight and set new parent
|
// Found a shorter Path -> Update weight and set new parent
|
||||||
else if (std::tie(to_weight, to_duration, node_distance, node) <
|
else if (std::tie(to_weight, to_duration, node_distance, node) <
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user