Clang format

This commit is contained in:
Patrick Niklaus 2017-03-04 02:16:20 +00:00 committed by Patrick Niklaus
parent 5f73ac1eda
commit ef71cc0d12
7 changed files with 46 additions and 41 deletions

View File

@ -1103,15 +1103,22 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>
BOOST_ASSERT(data_layout.GetBlockSize(storage::DataLayout::MLD_LEVEL_DATA) > 0); BOOST_ASSERT(data_layout.GetBlockSize(storage::DataLayout::MLD_LEVEL_DATA) > 0);
BOOST_ASSERT(data_layout.GetBlockSize(storage::DataLayout::MLD_CELL_TO_CHILDREN) > 0); BOOST_ASSERT(data_layout.GetBlockSize(storage::DataLayout::MLD_CELL_TO_CHILDREN) > 0);
auto level_data = *data_layout.GetBlockPtr<util::MultiLevelPartitionView::LevelData>(memory_block, storage::DataLayout::MLD_PARTITION); auto level_data = *data_layout.GetBlockPtr<util::MultiLevelPartitionView::LevelData>(
memory_block, storage::DataLayout::MLD_PARTITION);
auto mld_partition_ptr = data_layout.GetBlockPtr<util::PartitionID>(memory_block, storage::DataLayout::MLD_PARTITION); auto mld_partition_ptr = data_layout.GetBlockPtr<util::PartitionID>(
auto partition_entries_count = data_layout.GetBlockEntries(storage::DataLayout::MLD_PARTITION); memory_block, storage::DataLayout::MLD_PARTITION);
util::ShM<util::PartitionID, true>::vector partition(mld_partition_ptr, partition_entries_count); auto partition_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_PARTITION);
util::ShM<util::PartitionID, true>::vector partition(mld_partition_ptr,
partition_entries_count);
auto mld_chilren_ptr = data_layout.GetBlockPtr<util::CellID>(memory_block, storage::DataLayout::MLD_CELL_TO_CHILDREN); auto mld_chilren_ptr = data_layout.GetBlockPtr<util::CellID>(
auto children_entries_count = data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_TO_CHILDREN); memory_block, storage::DataLayout::MLD_CELL_TO_CHILDREN);
util::ShM<util::CellID, true>::vector cell_to_children(mld_chilren_ptr, children_entries_count); auto children_entries_count =
data_layout.GetBlockEntries(storage::DataLayout::MLD_CELL_TO_CHILDREN);
util::ShM<util::CellID, true>::vector cell_to_children(mld_chilren_ptr,
children_entries_count);
mld_partition = util::MultiLevelPartitionView{level_data, partition, cell_to_children}; mld_partition = util::MultiLevelPartitionView{level_data, partition, cell_to_children};
} }
@ -1138,10 +1145,7 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory()); InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory());
} }
const util::MultiLevelPartitionView &GetMultiLevelPartition() const const util::MultiLevelPartitionView &GetMultiLevelPartition() const { return mld_partition; }
{
return mld_partition;
}
const util::CellStorage<true> &GetCellStorage() const { return mld_cell_storage; } const util::CellStorage<true> &GetCellStorage() const { return mld_cell_storage; }
}; };

View File

@ -126,10 +126,7 @@ struct DataLayout
entry_align[bid] = alignof(T); entry_align[bid] = alignof(T);
} }
inline uint64_t GetBlockEntries(BlockID bid) const inline uint64_t GetBlockEntries(BlockID bid) const { return num_entries[bid]; }
{
return num_entries[bid];
}
inline uint64_t GetBlockSize(BlockID bid) const inline uint64_t GetBlockSize(BlockID bid) const
{ {
@ -178,8 +175,7 @@ struct DataLayout
return ptr; return ptr;
} }
template <typename T> template <typename T> inline T *GetBlockEnd(char *shared_memory, BlockID bid) const
inline T *GetBlockEnd(char *shared_memory, BlockID bid) const
{ {
auto begin = GetBlockPtr<T>(shared_memory, bid); auto begin = GetBlockPtr<T>(shared_memory, bid);
return begin + GetBlockEntries(bid); return begin + GetBlockEntries(bid);

View File

@ -178,11 +178,7 @@ template <bool UseShareMemory> class MultiLevelPartitionImpl final
auto offsets = MakeLevelOffsets(lidx_to_num_cells); auto offsets = MakeLevelOffsets(lidx_to_num_cells);
auto masks = MakeLevelMasks(offsets, num_level); auto masks = MakeLevelMasks(offsets, num_level);
auto bits = MakeBitToLevel(offsets, num_level); auto bits = MakeBitToLevel(offsets, num_level);
return LevelData{num_level, return LevelData{num_level, offsets, masks, bits, {0}};
offsets,
masks,
bits,
{0}};
} }
inline std::size_t LevelIDToIndex(LevelID l) const { return l - 1; } inline std::size_t LevelIDToIndex(LevelID l) const { return l - 1; }
@ -228,7 +224,8 @@ template <bool UseShareMemory> class MultiLevelPartitionImpl final
return offsets; return offsets;
} }
auto MakeLevelMasks(const std::array<std::uint8_t, MAX_NUM_LEVEL - 1> &level_offsets, std::uint32_t num_level) const auto MakeLevelMasks(const std::array<std::uint8_t, MAX_NUM_LEVEL - 1> &level_offsets,
std::uint32_t num_level) const
{ {
std::array<PartitionID, MAX_NUM_LEVEL - 1> masks; std::array<PartitionID, MAX_NUM_LEVEL - 1> masks;
@ -250,7 +247,8 @@ template <bool UseShareMemory> class MultiLevelPartitionImpl final
return masks; return masks;
} }
auto MakeBitToLevel(const std::array<std::uint8_t, MAX_NUM_LEVEL - 1> &level_offsets, std::uint32_t num_level) const auto MakeBitToLevel(const std::array<std::uint8_t, MAX_NUM_LEVEL - 1> &level_offsets,
std::uint32_t num_level) const
{ {
std::array<LevelID, NUM_PARTITION_BITS> bit_to_level; std::array<LevelID, NUM_PARTITION_BITS> bit_to_level;

View File

@ -3,9 +3,9 @@
#include "partition/bisection_graph.hpp" #include "partition/bisection_graph.hpp"
#include "partition/compressed_node_based_graph_reader.hpp" #include "partition/compressed_node_based_graph_reader.hpp"
#include "partition/edge_based_graph_reader.hpp" #include "partition/edge_based_graph_reader.hpp"
#include "partition/io.hpp"
#include "partition/node_based_graph_to_edge_based_graph_mapping_reader.hpp" #include "partition/node_based_graph_to_edge_based_graph_mapping_reader.hpp"
#include "partition/recursive_bisection.hpp" #include "partition/recursive_bisection.hpp"
#include "partition/io.hpp"
#include "util/cell_storage.hpp" #include "util/cell_storage.hpp"
#include "util/coordinate.hpp" #include "util/coordinate.hpp"

View File

@ -403,15 +403,19 @@ void Storage::PopulateLayout(DataLayout &layout)
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint); io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
reader.Skip<util::MultiLevelPartition::LevelData>(1); reader.Skip<util::MultiLevelPartition::LevelData>(1);
layout.SetBlockSize<util::MultiLevelPartition::LevelData>(DataLayout::MLD_LEVEL_DATA, 1); layout.SetBlockSize<util::MultiLevelPartition::LevelData>(DataLayout::MLD_LEVEL_DATA,
1);
const auto partition_entries_count = reader.ReadVectorSize<util::PartitionID>(); const auto partition_entries_count = reader.ReadVectorSize<util::PartitionID>();
layout.SetBlockSize<util::PartitionID>(DataLayout::MLD_PARTITION, partition_entries_count); layout.SetBlockSize<util::PartitionID>(DataLayout::MLD_PARTITION,
partition_entries_count);
const auto children_entries_count = reader.ReadVectorSize<util::CellID>(); const auto children_entries_count = reader.ReadVectorSize<util::CellID>();
layout.SetBlockSize<util::CellID>(DataLayout::MLD_CELL_TO_CHILDREN, children_entries_count); layout.SetBlockSize<util::CellID>(DataLayout::MLD_CELL_TO_CHILDREN,
children_entries_count);
} }
else else
{ {
layout.SetBlockSize<util::MultiLevelPartition::LevelData>(DataLayout::MLD_LEVEL_DATA, 0); layout.SetBlockSize<util::MultiLevelPartition::LevelData>(DataLayout::MLD_LEVEL_DATA,
0);
layout.SetBlockSize<util::PartitionID>(DataLayout::MLD_PARTITION, 0); layout.SetBlockSize<util::PartitionID>(DataLayout::MLD_PARTITION, 0);
layout.SetBlockSize<util::CellID>(DataLayout::MLD_CELL_TO_CHILDREN, 0); layout.SetBlockSize<util::CellID>(DataLayout::MLD_CELL_TO_CHILDREN, 0);
} }
@ -877,15 +881,20 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr)
// Loading MLD Data // Loading MLD Data
if (boost::filesystem::exists(config.mld_partition_path)) if (boost::filesystem::exists(config.mld_partition_path))
{ {
auto mld_level_data_ptr = layout.GetBlockPtr<util::MultiLevelPartition::LevelData, true>(memory_ptr, DataLayout::MLD_LEVEL_DATA); auto mld_level_data_ptr =
auto mld_partition_ptr = layout.GetBlockPtr<util::PartitionID, true>(memory_ptr, DataLayout::MLD_PARTITION); layout.GetBlockPtr<util::MultiLevelPartition::LevelData, true>(
auto mld_chilren_ptr = layout.GetBlockPtr<util::CellID, true>(memory_ptr, DataLayout::MLD_CELL_TO_CHILDREN); memory_ptr, DataLayout::MLD_LEVEL_DATA);
auto mld_partition_ptr =
layout.GetBlockPtr<util::PartitionID, true>(memory_ptr, DataLayout::MLD_PARTITION);
auto mld_chilren_ptr = layout.GetBlockPtr<util::CellID, true>(
memory_ptr, DataLayout::MLD_CELL_TO_CHILDREN);
io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint); io::FileReader reader(config.mld_partition_path, io::FileReader::VerifyFingerprint);
reader.ReadInto(mld_level_data_ptr); reader.ReadInto(mld_level_data_ptr);
reader.ReadInto(mld_partition_ptr, layout.GetBlockEntries(DataLayout::MLD_PARTITION)); reader.ReadInto(mld_partition_ptr, layout.GetBlockEntries(DataLayout::MLD_PARTITION));
reader.ReadInto(mld_chilren_ptr, layout.GetBlockEntries(DataLayout::MLD_CELL_TO_CHILDREN)); reader.ReadInto(mld_chilren_ptr,
layout.GetBlockEntries(DataLayout::MLD_CELL_TO_CHILDREN));
} }
const auto mld_cell_storage_ptr = const auto mld_cell_storage_ptr =

View File

@ -20,8 +20,7 @@ StorageConfig::StorageConfig(const boost::filesystem::path &base)
names_data_path{base.string() + ".names"}, properties_path{base.string() + ".properties"}, names_data_path{base.string() + ".names"}, properties_path{base.string() + ".properties"},
intersection_class_path{base.string() + ".icd"}, turn_lane_data_path{base.string() + ".tld"}, intersection_class_path{base.string() + ".icd"}, turn_lane_data_path{base.string() + ".tld"},
turn_lane_description_path{base.string() + ".tls"}, turn_lane_description_path{base.string() + ".tls"},
mld_partition_path{base.string() + ".partition"}, mld_partition_path{base.string() + ".partition"}, mld_storage_path{base.string() + ".cell"}
mld_storage_path{base.string() + ".cell"}
{ {
} }

View File

@ -43,5 +43,4 @@ BOOST_AUTO_TEST_CASE(test_mld)
OSRM osrm{config}; OSRM osrm{config};
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()