Apply clang-format

This commit is contained in:
Patrick Niklaus 2017-03-09 22:45:27 +00:00 committed by Patrick Niklaus
parent 94e2a8598d
commit fb552fd751
11 changed files with 64 additions and 65 deletions

View File

@ -74,7 +74,6 @@ struct ContractorConfig
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%) //(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
double core_factor; double core_factor;
}; };
} }
} }

View File

@ -8,10 +8,10 @@
#include "engine/algorithm.hpp" #include "engine/algorithm.hpp"
#include "engine/geospatial_query.hpp" #include "engine/geospatial_query.hpp"
#include "extractor/segment_data_container.hpp"
#include "extractor/guidance/turn_instruction.hpp" #include "extractor/guidance/turn_instruction.hpp"
#include "extractor/guidance/turn_lane_types.hpp" #include "extractor/guidance/turn_lane_types.hpp"
#include "extractor/profile_properties.hpp" #include "extractor/profile_properties.hpp"
#include "extractor/segment_data_container.hpp"
#include "partition/cell_storage.hpp" #include "partition/cell_storage.hpp"
#include "partition/multi_level_partition.hpp" #include "partition/multi_level_partition.hpp"

View File

@ -12,8 +12,7 @@ namespace extractor
namespace io namespace io
{ {
template <> template <> void read(const boost::filesystem::path &path, SegmentDataContainer &segment_data)
void read(const boost::filesystem::path &path, SegmentDataContainer &segment_data)
{ {
const auto fingerprint = storage::io::FileReader::HasNoFingerprint; const auto fingerprint = storage::io::FileReader::HasNoFingerprint;
storage::io::FileReader reader{path, fingerprint}; storage::io::FileReader reader{path, fingerprint};
@ -36,7 +35,8 @@ void read(const boost::filesystem::path &path, SegmentDataContainer &segment_dat
reader.ReadInto(segment_data.rev_durations.data(), segment_data.rev_durations.size()); reader.ReadInto(segment_data.rev_durations.data(), segment_data.rev_durations.size());
} }
template <> void write(const boost::filesystem::path &path, const SegmentDataContainer &segment_data) template <>
void write(const boost::filesystem::path &path, const SegmentDataContainer &segment_data)
{ {
const auto fingerprint = storage::io::FileWriter::HasNoFingerprint; const auto fingerprint = storage::io::FileWriter::HasNoFingerprint;
storage::io::FileWriter writer{path, fingerprint}; storage::io::FileWriter writer{path, fingerprint};
@ -54,7 +54,6 @@ template <> void write(const boost::filesystem::path &path, const SegmentDataCon
writer.WriteFrom(segment_data.fwd_durations.data(), segment_data.fwd_durations.size()); writer.WriteFrom(segment_data.fwd_durations.data(), segment_data.fwd_durations.size());
writer.WriteFrom(segment_data.rev_durations.data(), segment_data.rev_durations.size()); writer.WriteFrom(segment_data.rev_durations.data(), segment_data.rev_durations.size());
} }
} }
} }
} }

View File

@ -4,9 +4,9 @@
#include "util/shared_memory_vector_wrapper.hpp" #include "util/shared_memory_vector_wrapper.hpp"
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/range/adaptor/reversed.hpp> #include <boost/range/adaptor/reversed.hpp>
#include <boost/range/iterator_range.hpp> #include <boost/range/iterator_range.hpp>
#include <boost/filesystem/path.hpp>
#include <unordered_map> #include <unordered_map>
@ -28,9 +28,11 @@ template <bool UseShareMemory> class SegmentDataContainerImpl;
namespace io namespace io
{ {
template <bool UseShareMemory> template <bool UseShareMemory>
inline void read(const boost::filesystem::path &path, detail::SegmentDataContainerImpl<UseShareMemory> &segment_data); inline void read(const boost::filesystem::path &path,
detail::SegmentDataContainerImpl<UseShareMemory> &segment_data);
template <bool UseShareMemory> template <bool UseShareMemory>
inline void write(const boost::filesystem::path &path, const detail::SegmentDataContainerImpl<UseShareMemory> &segment_data); inline void write(const boost::filesystem::path &path,
const detail::SegmentDataContainerImpl<UseShareMemory> &segment_data);
} }
namespace detail namespace detail
@ -129,14 +131,13 @@ template <bool UseShareMemory> class SegmentDataContainerImpl
return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); return boost::adaptors::reverse(boost::make_iterator_range(begin, end));
} }
auto GetNumberOfSegments() const auto GetNumberOfSegments() const { return fwd_weights.size(); }
{
return fwd_weights.size();
}
friend void io::read<UseShareMemory>(const boost::filesystem::path &path, friend void
io::read<UseShareMemory>(const boost::filesystem::path &path,
detail::SegmentDataContainerImpl<UseShareMemory> &segment_data); detail::SegmentDataContainerImpl<UseShareMemory> &segment_data);
friend void io::write<UseShareMemory>(const boost::filesystem::path &path, friend void
io::write<UseShareMemory>(const boost::filesystem::path &path,
const detail::SegmentDataContainerImpl<UseShareMemory> &segment_data); const detail::SegmentDataContainerImpl<UseShareMemory> &segment_data);
private: private:

View File

@ -3,9 +3,9 @@
#include "updater/source.hpp" #include "updater/source.hpp"
#include "util/log.hpp"
#include "util/exception.hpp" #include "util/exception.hpp"
#include "util/exception_utils.hpp" #include "util/exception_utils.hpp"
#include "util/log.hpp"
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#include <tbb/spin_mutex.h> #include <tbb/spin_mutex.h>
@ -51,7 +51,9 @@ template <typename Key, typename Value> struct CSVFilesParser
{ {
tbb::spin_mutex mutex; tbb::spin_mutex mutex;
std::vector<std::pair<Key, Value>> lookup; std::vector<std::pair<Key, Value>> lookup;
tbb::parallel_for(std::size_t{0}, csv_filenames.size(), [&](const std::size_t idx) { tbb::parallel_for(std::size_t{0},
csv_filenames.size(),
[&](const std::size_t idx) {
auto local = ParseCSVFile(csv_filenames[idx], start_index + idx); auto local = ParseCSVFile(csv_filenames[idx], start_index + idx);
{ // Merge local CSV results into a flat global vector { // Merge local CSV results into a flat global vector
@ -78,8 +80,8 @@ template <typename Key, typename Value> struct CSVFilesParser
}); });
lookup.erase(it, end(lookup)); lookup.erase(it, end(lookup));
util::Log() << "In total loaded " << csv_filenames.size() util::Log() << "In total loaded " << csv_filenames.size() << " file(s) with a total of "
<< " file(s) with a total of " << lookup.size() << " unique values"; << lookup.size() << " unique values";
return LookupTable<Key, Value>{lookup}; return LookupTable<Key, Value>{lookup};
} }

View File

@ -15,5 +15,4 @@ namespace csv
} }
} }
#endif #endif

View File

@ -89,7 +89,6 @@ struct PenaltySource final
using SegmentLookupTable = LookupTable<Segment, SpeedSource>; using SegmentLookupTable = LookupTable<Segment, SpeedSource>;
using TurnLookupTable = LookupTable<Turn, PenaltySource>; using TurnLookupTable = LookupTable<Turn, PenaltySource>;
} }
} }

View File

@ -16,8 +16,8 @@ class Updater
public: public:
Updater(UpdaterConfig config_) : config(std::move(config_)) {} Updater(UpdaterConfig config_) : config(std::move(config_)) {}
EdgeID LoadAndUpdateEdgeExpandedGraph( EdgeID
std::vector<extractor::EdgeBasedEdge> &edge_based_edge_list, LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &edge_based_edge_list,
std::vector<EdgeWeight> &node_weights) const; std::vector<EdgeWeight> &node_weights) const;
private: private:

View File

@ -332,6 +332,5 @@ std::unique_ptr<SegmentDataContainer> CompressedEdgeContainer::ToSegmentData()
{ {
return std::move(segment_data); return std::move(segment_data);
} }
} }
} }

View File

@ -58,7 +58,8 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig
->default_value(false), ->default_value(false),
"Use .level file to retain the contaction level for each node from the last run.")( "Use .level file to retain the contaction level for each node from the last run.")(
"edge-weight-updates-over-factor", "edge-weight-updates-over-factor",
boost::program_options::value<double>(&contractor_config.updater_config.log_edge_updates_factor) boost::program_options::value<double>(
&contractor_config.updater_config.log_edge_updates_factor)
->default_value(0.0), ->default_value(0.0),
"Use with `--segment-speed-file`. Provide an `x` factor, by which Extractor will log edge " "Use with `--segment-speed-file`. Provide an `x` factor, by which Extractor will log edge "
"weights updated by more than this factor"); "weights updated by more than this factor");

View File

@ -4,8 +4,8 @@
#include "extractor/compressed_edge_container.hpp" #include "extractor/compressed_edge_container.hpp"
#include "extractor/edge_based_graph_factory.hpp" #include "extractor/edge_based_graph_factory.hpp"
#include "extractor/node_based_edge.hpp"
#include "extractor/io.hpp" #include "extractor/io.hpp"
#include "extractor/node_based_edge.hpp"
#include "storage/io.hpp" #include "storage/io.hpp"
#include "util/exception.hpp" #include "util/exception.hpp"
@ -21,10 +21,10 @@
#include "util/typedefs.hpp" #include "util/typedefs.hpp"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/file_mapping.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <boost/interprocess/file_mapping.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <tbb/blocked_range.h> #include <tbb/blocked_range.h>
#include <tbb/concurrent_unordered_map.h> #include <tbb/concurrent_unordered_map.h>
@ -53,13 +53,11 @@ template <typename T> inline bool is_aligned(const void *pointer)
} // anon ns } // anon ns
namespace osrm namespace osrm
{ {
namespace updater namespace updater
{ {
// Returns duration in deci-seconds // Returns duration in deci-seconds
inline EdgeWeight ConvertToDuration(double distance_in_meters, double speed_in_kmh) inline EdgeWeight ConvertToDuration(double distance_in_meters, double speed_in_kmh)
{ {
@ -343,10 +341,8 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
BOOST_ASSERT(u_index < nodes_range.size()); BOOST_ASSERT(u_index < nodes_range.size());
BOOST_ASSERT(v_index < nodes_range.size()); BOOST_ASSERT(v_index < nodes_range.size());
const extractor::QueryNode &u = const extractor::QueryNode &u = internal_to_external_node_map[nodes_range[u_index]];
internal_to_external_node_map[nodes_range[u_index]]; const extractor::QueryNode &v = internal_to_external_node_map[nodes_range[v_index]];
const extractor::QueryNode &v =
internal_to_external_node_map[nodes_range[v_index]];
const double segment_length = util::coordinate_calculation::greatCircleDistance( const double segment_length = util::coordinate_calculation::greatCircleDistance(
util::Coordinate{u.lon, u.lat}, util::Coordinate{v.lon, v.lat}); util::Coordinate{u.lon, u.lat}, util::Coordinate{v.lon, v.lat});
@ -366,8 +362,10 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
new_segment_duration); new_segment_duration);
segment_data.ForwardWeight(geometry_id, segment_offset) = new_segment_weight; segment_data.ForwardWeight(geometry_id, segment_offset) = new_segment_weight;
segment_data.ForwardDuration(geometry_id, segment_offset) = new_segment_duration; segment_data.ForwardDuration(geometry_id, segment_offset) =
geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset)+1] = value->source; new_segment_duration;
geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset) + 1] =
value->source;
fwd_source = value->source; fwd_source = value->source;
} }
@ -385,8 +383,10 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
new_segment_duration); new_segment_duration);
segment_data.ReverseWeight(geometry_id, segment_offset) = new_segment_weight; segment_data.ReverseWeight(geometry_id, segment_offset) = new_segment_weight;
segment_data.ReverseDuration(geometry_id, segment_offset) = new_segment_duration; segment_data.ReverseDuration(geometry_id, segment_offset) =
geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset)] = value->source; new_segment_duration;
geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset)] =
value->source;
rev_source = value->source; rev_source = value->source;
} }