Fix formating

This commit is contained in:
Patrick Niklaus 2017-04-05 10:23:53 +00:00 committed by Patrick Niklaus
parent 0da041477b
commit 45df8568b6
2 changed files with 17 additions and 10 deletions

View File

@ -23,14 +23,15 @@ class CellCustomizer
};
public:
using Heap = util::
BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>;
using Heap =
util::BinaryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::ArrayStorage<NodeID, int>>;
using HeapPtr = tbb::enumerable_thread_specific<Heap>;
CellCustomizer(const partition::MultiLevelPartition &partition) : partition(partition) {}
template <typename GraphT>
void Customize(const GraphT &graph, Heap& heap, partition::CellStorage &cells, LevelID level, CellID id)
void Customize(
const GraphT &graph, Heap &heap, partition::CellStorage &cells, LevelID level, CellID id)
{
auto cell = cells.GetCell(level, id);
auto destinations = cell.GetDestinationNodes();
@ -77,7 +78,7 @@ class CellCustomizer
{
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, partition.GetNumberOfCells(level)),
[&](const tbb::blocked_range<std::size_t> &range) {
auto& heap = heaps.local();
auto &heap = heaps.local();
for (auto id = range.begin(), end = range.end(); id != end; ++id)
{
Customize(graph, heap, cells, level, id);
@ -87,7 +88,6 @@ class CellCustomizer
}
private:
template <bool first_level, typename GraphT>
void RelaxNode(const GraphT &graph,
const partition::CellStorage &cells,

View File

@ -19,15 +19,21 @@ namespace util
template <typename NodeID, typename Key> class GenerationArrayStorage
{
using GenerationCounter = std::uint16_t;
public:
explicit GenerationArrayStorage(std::size_t size) : positions(size, 0), generation(1), generations(size, 0) {}
Key &operator[](NodeID node) {
public:
explicit GenerationArrayStorage(std::size_t size)
: positions(size, 0), generation(1), generations(size, 0)
{
}
Key &operator[](NodeID node)
{
generation[node] = generation;
return positions[node];
}
Key peek_index(const NodeID node) const {
Key peek_index(const NodeID node) const
{
if (generations[node] < generation)
{
return std::numeric_limits<Key>::max();
@ -35,7 +41,8 @@ template <typename NodeID, typename Key> class GenerationArrayStorage
return positions[node];
}
void Clear() {
void Clear()
{
generation++;
// if generation overflows we end up at 0 again and need to clear the vector
if (generation == 0)