clang-format
This commit is contained in:
parent
16665aeb00
commit
091a495632
@ -19,20 +19,17 @@ namespace customizer
|
||||
using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData;
|
||||
|
||||
struct MultiLevelEdgeBasedGraph
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||
osrm::storage::Ownership::Container>
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>
|
||||
{
|
||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||
osrm::storage::Ownership::Container>;
|
||||
using Base =
|
||||
partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>;
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
struct MultiLevelEdgeBasedGraphView
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||
osrm::storage::Ownership::View>
|
||||
: public partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::View>
|
||||
{
|
||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||
osrm::storage::Ownership::View>;
|
||||
using Base = partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::View>;
|
||||
using Base::Base;
|
||||
};
|
||||
|
||||
|
@ -251,8 +251,7 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
util::vector_view<util::guidance::EntryClass> m_entry_class_table;
|
||||
// the look-up table for distinct bearing classes. A bearing class lists the available bearings
|
||||
// at an intersection
|
||||
std::shared_ptr<util::RangeTable<16, osrm::storage::Ownership::View>>
|
||||
m_bearing_ranges_table;
|
||||
std::shared_ptr<util::RangeTable<16, osrm::storage::Ownership::View>> m_bearing_ranges_table;
|
||||
util::vector_view<DiscreteBearing> m_bearing_values_table;
|
||||
|
||||
// allocator that keeps the allocation data
|
||||
|
@ -190,8 +190,7 @@ template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||
auto GetNumberOfGeometries() const { return index.size() - 1; }
|
||||
auto GetNumberOfSegments() const { return fwd_weights.size(); }
|
||||
|
||||
friend void
|
||||
io::read<Ownership>(const boost::filesystem::path &path,
|
||||
friend void io::read<Ownership>(const boost::filesystem::path &path,
|
||||
detail::SegmentDataContainerImpl<Ownership> &segment_data);
|
||||
friend void
|
||||
io::write<Ownership>(const boost::filesystem::path &path,
|
||||
@ -208,10 +207,8 @@ template <osrm::storage::Ownership Ownership> class SegmentDataContainerImpl
|
||||
};
|
||||
}
|
||||
|
||||
using SegmentDataView =
|
||||
detail::SegmentDataContainerImpl<osrm::storage::Ownership::View>;
|
||||
using SegmentDataContainer =
|
||||
detail::SegmentDataContainerImpl<osrm::storage::Ownership::Container>;
|
||||
using SegmentDataView = detail::SegmentDataContainerImpl<osrm::storage::Ownership::View>;
|
||||
using SegmentDataContainer = detail::SegmentDataContainerImpl<osrm::storage::Ownership::Container>;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,7 @@ using CellStorageView = detail::CellStorageImpl<osrm::storage::Ownership::View>;
|
||||
namespace io
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
inline void read(const boost::filesystem::path &path,
|
||||
detail::CellStorageImpl<Ownership> &storage);
|
||||
inline void read(const boost::filesystem::path &path, detail::CellStorageImpl<Ownership> &storage);
|
||||
template <osrm::storage::Ownership Ownership>
|
||||
inline void write(const boost::filesystem::path &path,
|
||||
const detail::CellStorageImpl<Ownership> &storage);
|
||||
@ -186,8 +185,7 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||
|
||||
CellStorageImpl() {}
|
||||
|
||||
template <
|
||||
typename GraphT,
|
||||
template <typename GraphT,
|
||||
typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||
CellStorageImpl(const partition::MultiLevelPartition &partition, const GraphT &base_graph)
|
||||
{
|
||||
@ -317,8 +315,7 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||
weights.resize(weight_offset + 1, INVALID_EDGE_WEIGHT);
|
||||
}
|
||||
|
||||
template <
|
||||
typename = std::enable_if<Ownership == osrm::storage::Ownership::View>>
|
||||
template <typename = std::enable_if<Ownership == osrm::storage::Ownership::View>>
|
||||
CellStorageImpl(Vector<EdgeWeight> weights_,
|
||||
Vector<NodeID> source_boundary_,
|
||||
Vector<NodeID> destination_boundary_,
|
||||
@ -343,8 +340,7 @@ template <osrm::storage::Ownership Ownership> class CellStorageImpl
|
||||
destination_boundary.empty() ? nullptr : destination_boundary.data()};
|
||||
}
|
||||
|
||||
template <
|
||||
typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||
template <typename = std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||
Cell GetCell(LevelID level, CellID id)
|
||||
{
|
||||
const auto level_index = LevelIDToIndex(level);
|
||||
|
@ -17,8 +17,7 @@ namespace io
|
||||
{
|
||||
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
inline void read(const boost::filesystem::path &path,
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||
inline void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph)
|
||||
{
|
||||
const auto fingerprint = storage::io::FileReader::VerifyFingerprint;
|
||||
storage::io::FileReader reader{path, fingerprint};
|
||||
|
@ -24,8 +24,7 @@ template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
void read(const boost::filesystem::path &path, MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
void write(const boost::filesystem::path &path,
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
void write(const boost::filesystem::path &path, const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
}
|
||||
|
||||
template <typename EdgeDataT, osrm::storage::Ownership Ownership>
|
||||
@ -191,11 +190,9 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
|
||||
node_to_edge_offset.push_back(mlp.GetNumberOfLevels());
|
||||
}
|
||||
|
||||
friend void
|
||||
io::read<EdgeDataT, Ownership>(const boost::filesystem::path &path,
|
||||
friend void io::read<EdgeDataT, Ownership>(const boost::filesystem::path &path,
|
||||
MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
friend void
|
||||
io::write<EdgeDataT, Ownership>(const boost::filesystem::path &path,
|
||||
friend void io::write<EdgeDataT, Ownership>(const boost::filesystem::path &path,
|
||||
const MultiLevelGraph<EdgeDataT, Ownership> &graph);
|
||||
|
||||
Vector<EdgeOffset> node_to_edge_offset;
|
||||
|
@ -28,10 +28,8 @@ namespace detail
|
||||
{
|
||||
template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl;
|
||||
}
|
||||
using MultiLevelPartition =
|
||||
detail::MultiLevelPartitionImpl<osrm::storage::Ownership::Container>;
|
||||
using MultiLevelPartitionView =
|
||||
detail::MultiLevelPartitionImpl<osrm::storage::Ownership::View>;
|
||||
using MultiLevelPartition = detail::MultiLevelPartitionImpl<osrm::storage::Ownership::Container>;
|
||||
using MultiLevelPartitionView = detail::MultiLevelPartitionImpl<osrm::storage::Ownership::View>;
|
||||
|
||||
namespace io
|
||||
{
|
||||
@ -70,8 +68,7 @@ template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl fina
|
||||
// cell_sizes is index by level (starting at 0, the base graph).
|
||||
// However level 0 always needs to have cell size 1, since it is the
|
||||
// basegraph.
|
||||
template <typename = typename std::enable_if<Ownership ==
|
||||
osrm::storage::Ownership::Container>>
|
||||
template <typename = typename std::enable_if<Ownership == osrm::storage::Ownership::Container>>
|
||||
MultiLevelPartitionImpl(const std::vector<std::vector<CellID>> &partitions,
|
||||
const std::vector<std::uint32_t> &lidx_to_num_cells)
|
||||
: level_data(MakeLevelData(lidx_to_num_cells))
|
||||
@ -79,8 +76,7 @@ template <osrm::storage::Ownership Ownership> class MultiLevelPartitionImpl fina
|
||||
InitializePartitionIDs(partitions);
|
||||
}
|
||||
|
||||
template <typename = typename std::enable_if<Ownership ==
|
||||
osrm::storage::Ownership::View>>
|
||||
template <typename = typename std::enable_if<Ownership == osrm::storage::Ownership::View>>
|
||||
MultiLevelPartitionImpl(LevelData level_data,
|
||||
Vector<PartitionID> partition_,
|
||||
Vector<CellID> cell_to_children_)
|
||||
|
@ -22,8 +22,7 @@ namespace util
|
||||
* NOTE: this type is templated for future use, but will require a slight refactor to
|
||||
* configure BITSIZE and ELEMSIZE
|
||||
*/
|
||||
template <typename T,
|
||||
osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||
template <typename T, osrm::storage::Ownership Ownership = osrm::storage::Ownership::Container>
|
||||
class PackedVector
|
||||
{
|
||||
static const constexpr std::size_t BITSIZE = 33;
|
||||
|
@ -216,8 +216,7 @@ template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership> class RangeTa
|
||||
};
|
||||
|
||||
template <unsigned BLOCK_SIZE, osrm::storage::Ownership Ownership>
|
||||
unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index,
|
||||
const BlockT &block) const
|
||||
unsigned RangeTable<BLOCK_SIZE, Ownership>::PrefixSumAtIndex(int index, const BlockT &block) const
|
||||
{
|
||||
// this loop looks inefficent, but a modern compiler
|
||||
// will emit nice SIMD here, at least for sensible block sizes. (I checked.)
|
||||
|
@ -128,8 +128,7 @@ template <typename DataT> class vector_view
|
||||
|
||||
auto data() const { return m_ptr; }
|
||||
|
||||
template <typename T>
|
||||
friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
|
||||
template <typename T> friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
|
||||
};
|
||||
|
||||
template <> class vector_view<bool>
|
||||
@ -163,13 +162,11 @@ template <> class vector_view<bool>
|
||||
|
||||
bool operator[](const unsigned index) const { return at(index); }
|
||||
|
||||
template <typename T>
|
||||
friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
|
||||
template <typename T> friend void swap(vector_view<T> &, vector_view<T> &) noexcept;
|
||||
};
|
||||
|
||||
// Both vector_view<T> and the vector_view<bool> specializations share this impl.
|
||||
template <typename DataT>
|
||||
void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
|
||||
template <typename DataT> void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
|
||||
{
|
||||
std::swap(lhs.m_ptr, rhs.m_ptr);
|
||||
std::swap(lhs.m_size, rhs.m_size);
|
||||
@ -177,8 +174,7 @@ void swap(vector_view<DataT> &lhs, vector_view<DataT> &rhs) noexcept
|
||||
|
||||
template <typename DataT, osrm::storage::Ownership Ownership> struct ShM
|
||||
{
|
||||
using vector =
|
||||
typename std::conditional<Ownership == osrm::storage::Ownership::View,
|
||||
using vector = typename std::conditional<Ownership == osrm::storage::Ownership::View,
|
||||
vector_view<DataT>,
|
||||
std::vector<DataT>>::type;
|
||||
};
|
||||
|
@ -27,8 +27,8 @@ constexpr int32_t WORLD_MIN_LON = -180 * COORDINATE_PRECISION;
|
||||
constexpr int32_t WORLD_MAX_LON = 180 * COORDINATE_PRECISION;
|
||||
|
||||
using RTreeLeaf = extractor::EdgeBasedNode;
|
||||
using BenchStaticRTree = util::StaticRTree<
|
||||
RTreeLeaf,
|
||||
using BenchStaticRTree =
|
||||
util::StaticRTree<RTreeLeaf,
|
||||
util::ShM<util::Coordinate, osrm::storage::Ownership::Container>::vector,
|
||||
osrm::storage::Ownership::Container>;
|
||||
|
||||
|
@ -84,9 +84,8 @@ auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
|
||||
auto directed = partition::splitBidirectionalEdges(edge_based_edge_list);
|
||||
auto tidied =
|
||||
partition::prepareEdgesForUsageInGraph<StaticEdgeBasedGraphEdge>(std::move(directed));
|
||||
auto edge_based_graph =
|
||||
std::make_unique<partition::MultiLevelGraph<EdgeBasedGraphEdgeData,
|
||||
osrm::storage::Ownership::Container>>(
|
||||
auto edge_based_graph = std::make_unique<
|
||||
partition::MultiLevelGraph<EdgeBasedGraphEdgeData, osrm::storage::Ownership::Container>>(
|
||||
mlp, num_nodes, std::move(tidied));
|
||||
|
||||
util::Log() << "Loaded edge based graph for mapping partition ids: "
|
||||
|
@ -365,14 +365,13 @@ void Storage::PopulateLayout(DataLayout &layout)
|
||||
intersection_file.Skip<std::uint32_t>(1); // sum_lengths
|
||||
|
||||
layout.SetBlockSize<unsigned>(DataLayout::BEARING_OFFSETS, bearing_blocks);
|
||||
layout.SetBlockSize<
|
||||
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||
layout.SetBlockSize<typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||
DataLayout::BEARING_BLOCKS, bearing_blocks);
|
||||
|
||||
// No need to read the data
|
||||
intersection_file.Skip<unsigned>(bearing_blocks);
|
||||
intersection_file.Skip<
|
||||
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||
intersection_file
|
||||
.Skip<typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>(
|
||||
bearing_blocks);
|
||||
|
||||
const auto num_bearings = intersection_file.ReadElementCount64();
|
||||
@ -807,8 +806,7 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
|
||||
intersection_file.Skip<std::uint32_t>(1); // sum_lengths
|
||||
|
||||
std::vector<unsigned> bearing_offsets_data(bearing_blocks);
|
||||
std::vector<
|
||||
typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>
|
||||
std::vector<typename util::RangeTable<16, osrm::storage::Ownership::View>::BlockT>
|
||||
bearing_blocks_data(bearing_blocks);
|
||||
|
||||
intersection_file.ReadInto(bearing_offsets_data.data(), bearing_blocks);
|
||||
|
@ -38,8 +38,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
|
||||
edges.push_back(Edge{m.target, m.source, false, true});
|
||||
}
|
||||
std::sort(edges.begin(), edges.end());
|
||||
return MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
|
||||
mlp, max_id + 1, edges);
|
||||
return MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(mlp, max_id + 1, edges);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,11 +45,8 @@ using TestStaticRTree = StaticRTree<TestData,
|
||||
osrm::storage::Ownership::Container,
|
||||
TEST_BRANCHING_FACTOR,
|
||||
TEST_LEAF_NODE_SIZE>;
|
||||
using MiniStaticRTree = StaticRTree<TestData,
|
||||
std::vector<Coordinate>,
|
||||
osrm::storage::Ownership::Container,
|
||||
2,
|
||||
128>;
|
||||
using MiniStaticRTree =
|
||||
StaticRTree<TestData, std::vector<Coordinate>, osrm::storage::Ownership::Container, 2, 128>;
|
||||
|
||||
// Choosen by a fair W20 dice roll (this value is completely arbitrary)
|
||||
constexpr unsigned RANDOM_SEED = 42;
|
||||
@ -277,11 +274,8 @@ void construction_test(const std::string &prefix, FixtureT *fixture)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(construct_tiny, TestRandomGraphFixture_10_30)
|
||||
{
|
||||
using TinyTestTree = StaticRTree<TestData,
|
||||
std::vector<Coordinate>,
|
||||
osrm::storage::Ownership::Container,
|
||||
2,
|
||||
64>;
|
||||
using TinyTestTree =
|
||||
StaticRTree<TestData, std::vector<Coordinate>, osrm::storage::Ownership::Container, 2, 64>;
|
||||
construction_test<TinyTestTree>("test_tiny", this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user