diff --git a/include/contractor/contractor_config.hpp b/include/contractor/contractor_config.hpp index 51029ee5d..2cb92c6c2 100644 --- a/include/contractor/contractor_config.hpp +++ b/include/contractor/contractor_config.hpp @@ -74,7 +74,6 @@ struct ContractorConfig //(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%) double core_factor; }; - } } diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index 082583dfc..f24d106ce 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -8,10 +8,10 @@ #include "engine/algorithm.hpp" #include "engine/geospatial_query.hpp" -#include "extractor/segment_data_container.hpp" #include "extractor/guidance/turn_instruction.hpp" #include "extractor/guidance/turn_lane_types.hpp" #include "extractor/profile_properties.hpp" +#include "extractor/segment_data_container.hpp" #include "partition/cell_storage.hpp" #include "partition/multi_level_partition.hpp" @@ -574,41 +574,41 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade { auto range = segment_data.GetForwardGeometry(id); - return std::vector {range.begin(), range.end()}; + return std::vector{range.begin(), range.end()}; } virtual std::vector GetUncompressedReverseGeometry(const EdgeID id) const override final { auto range = segment_data.GetReverseGeometry(id); - return std::vector {range.begin(), range.end()}; + return std::vector{range.begin(), range.end()}; } virtual std::vector GetUncompressedForwardDurations(const EdgeID id) const override final { auto range = segment_data.GetForwardDurations(id); - return std::vector {range.begin(), range.end()}; + return std::vector{range.begin(), range.end()}; } virtual std::vector GetUncompressedReverseDurations(const EdgeID id) const override final { auto range = segment_data.GetReverseDurations(id); - return std::vector {range.begin(), range.end()}; + return std::vector{range.begin(), range.end()}; } virtual std::vector GetUncompressedForwardWeights(const EdgeID id) const override final { auto range = segment_data.GetForwardWeights(id); - return std::vector {range.begin(), range.end()}; + return std::vector{range.begin(), range.end()}; } virtual std::vector GetUncompressedReverseWeights(const EdgeID id) const override final { auto range = segment_data.GetReverseWeights(id); - return std::vector {range.begin(), range.end()}; + return std::vector{range.begin(), range.end()}; } virtual GeometryID GetGeometryIndexForEdgeID(const EdgeID id) const override final diff --git a/include/extractor/io.hpp b/include/extractor/io.hpp index bec3adb89..55f1645d1 100644 --- a/include/extractor/io.hpp +++ b/include/extractor/io.hpp @@ -12,8 +12,7 @@ namespace extractor namespace io { -template <> -void read(const boost::filesystem::path &path, SegmentDataContainer &segment_data) +template <> void read(const boost::filesystem::path &path, SegmentDataContainer &segment_data) { const auto fingerprint = storage::io::FileReader::HasNoFingerprint; 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()); } -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; 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.rev_durations.data(), segment_data.rev_durations.size()); } - } } } diff --git a/include/extractor/segment_data_container.hpp b/include/extractor/segment_data_container.hpp index 099f87992..67bd60eff 100644 --- a/include/extractor/segment_data_container.hpp +++ b/include/extractor/segment_data_container.hpp @@ -4,9 +4,9 @@ #include "util/shared_memory_vector_wrapper.hpp" #include "util/typedefs.hpp" +#include #include #include -#include #include @@ -28,9 +28,11 @@ template class SegmentDataContainerImpl; namespace io { template -inline void read(const boost::filesystem::path &path, detail::SegmentDataContainerImpl &segment_data); +inline void read(const boost::filesystem::path &path, + detail::SegmentDataContainerImpl &segment_data); template -inline void write(const boost::filesystem::path &path, const detail::SegmentDataContainerImpl &segment_data); +inline void write(const boost::filesystem::path &path, + const detail::SegmentDataContainerImpl &segment_data); } namespace detail @@ -61,19 +63,19 @@ template class SegmentDataContainerImpl } // TODO these random access functions can be removed after we implemented #3737 - auto& ForwardDuration(const DirectionalGeometryID id, const SegmentOffset offset) + auto &ForwardDuration(const DirectionalGeometryID id, const SegmentOffset offset) { return fwd_durations[index[id] + 1 + offset]; } - auto& ReverseDuration(const DirectionalGeometryID id, const SegmentOffset offset) + auto &ReverseDuration(const DirectionalGeometryID id, const SegmentOffset offset) { return rev_durations[index[id] + offset]; } - auto& ForwardWeight(const DirectionalGeometryID id, const SegmentOffset offset) + auto &ForwardWeight(const DirectionalGeometryID id, const SegmentOffset offset) { return fwd_weights[index[id] + 1 + offset]; } - auto& ReverseWeight(const DirectionalGeometryID id, const SegmentOffset offset) + auto &ReverseWeight(const DirectionalGeometryID id, const SegmentOffset offset) { return rev_weights[index[id] + offset]; } @@ -129,15 +131,14 @@ template class SegmentDataContainerImpl return boost::adaptors::reverse(boost::make_iterator_range(begin, end)); } - auto GetNumberOfSegments() const - { - return fwd_weights.size(); - } + auto GetNumberOfSegments() const { return fwd_weights.size(); } - friend void io::read(const boost::filesystem::path &path, - detail::SegmentDataContainerImpl &segment_data); - friend void io::write(const boost::filesystem::path &path, - const detail::SegmentDataContainerImpl &segment_data); + friend void + io::read(const boost::filesystem::path &path, + detail::SegmentDataContainerImpl &segment_data); + friend void + io::write(const boost::filesystem::path &path, + const detail::SegmentDataContainerImpl &segment_data); private: Vector index; diff --git a/include/updater/csv_file_parser.hpp b/include/updater/csv_file_parser.hpp index 40010b1c3..9f1d2b7b8 100644 --- a/include/updater/csv_file_parser.hpp +++ b/include/updater/csv_file_parser.hpp @@ -3,9 +3,9 @@ #include "updater/source.hpp" -#include "util/log.hpp" #include "util/exception.hpp" #include "util/exception_utils.hpp" +#include "util/log.hpp" #include #include @@ -51,16 +51,18 @@ template struct CSVFilesParser { tbb::spin_mutex mutex; std::vector> lookup; - tbb::parallel_for(std::size_t{0}, csv_filenames.size(), [&](const std::size_t idx) { - auto local = ParseCSVFile(csv_filenames[idx], start_index + 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); - { // Merge local CSV results into a flat global vector - tbb::spin_mutex::scoped_lock _{mutex}; - lookup.insert(end(lookup), - std::make_move_iterator(begin(local)), - std::make_move_iterator(end(local))); - } - }); + { // Merge local CSV results into a flat global vector + tbb::spin_mutex::scoped_lock _{mutex}; + lookup.insert(end(lookup), + std::make_move_iterator(begin(local)), + std::make_move_iterator(end(local))); + } + }); // With flattened map-ish view of all the files, make a stable sort on key and source // and unique them on key to keep only the value with the largest file index @@ -78,8 +80,8 @@ template struct CSVFilesParser }); lookup.erase(it, end(lookup)); - util::Log() << "In total loaded " << csv_filenames.size() - << " file(s) with a total of " << lookup.size() << " unique values"; + util::Log() << "In total loaded " << csv_filenames.size() << " file(s) with a total of " + << lookup.size() << " unique values"; return LookupTable{lookup}; } diff --git a/include/updater/csv_source.hpp b/include/updater/csv_source.hpp index f60b5979b..08c8d22bb 100644 --- a/include/updater/csv_source.hpp +++ b/include/updater/csv_source.hpp @@ -9,11 +9,10 @@ namespace updater { namespace csv { - SegmentLookupTable readSegmentValues(const std::vector &paths); - TurnLookupTable readTurnValues(const std::vector &paths); +SegmentLookupTable readSegmentValues(const std::vector &paths); +TurnLookupTable readTurnValues(const std::vector &paths); } } } - #endif diff --git a/include/updater/source.hpp b/include/updater/source.hpp index 4a9abb1cf..72d06171c 100644 --- a/include/updater/source.hpp +++ b/include/updater/source.hpp @@ -63,7 +63,7 @@ struct Turn final : from(from), via(via), to(to) { } - template + template Turn(const Other &turn) : from(static_cast(turn.from_id)), via(static_cast(turn.via_id)), to(static_cast(turn.to_id)) @@ -89,7 +89,6 @@ struct PenaltySource final using SegmentLookupTable = LookupTable; using TurnLookupTable = LookupTable; - } } diff --git a/include/updater/updater.hpp b/include/updater/updater.hpp index d28c8470b..f12e86d9e 100644 --- a/include/updater/updater.hpp +++ b/include/updater/updater.hpp @@ -13,14 +13,14 @@ namespace updater { class Updater { -public: - Updater(UpdaterConfig config_) :config(std::move(config_)) {} + public: + Updater(UpdaterConfig config_) : config(std::move(config_)) {} - EdgeID LoadAndUpdateEdgeExpandedGraph( - std::vector &edge_based_edge_list, - std::vector &node_weights) const; + EdgeID + LoadAndUpdateEdgeExpandedGraph(std::vector &edge_based_edge_list, + std::vector &node_weights) const; -private: + private: UpdaterConfig config; }; } diff --git a/src/extractor/compressed_edge_container.cpp b/src/extractor/compressed_edge_container.cpp index bfeff6877..736fed391 100644 --- a/src/extractor/compressed_edge_container.cpp +++ b/src/extractor/compressed_edge_container.cpp @@ -332,6 +332,5 @@ std::unique_ptr CompressedEdgeContainer::ToSegmentData() { return std::move(segment_data); } - } } diff --git a/src/tools/contract.cpp b/src/tools/contract.cpp index 300b9ef8a..0601d3e61 100644 --- a/src/tools/contract.cpp +++ b/src/tools/contract.cpp @@ -58,7 +58,8 @@ return_code parseArguments(int argc, char *argv[], contractor::ContractorConfig ->default_value(false), "Use .level file to retain the contaction level for each node from the last run.")( "edge-weight-updates-over-factor", - boost::program_options::value(&contractor_config.updater_config.log_edge_updates_factor) + boost::program_options::value( + &contractor_config.updater_config.log_edge_updates_factor) ->default_value(0.0), "Use with `--segment-speed-file`. Provide an `x` factor, by which Extractor will log edge " "weights updated by more than this factor"); diff --git a/src/updater/updater.cpp b/src/updater/updater.cpp index 8c6afb19f..ef45e52c7 100644 --- a/src/updater/updater.cpp +++ b/src/updater/updater.cpp @@ -4,8 +4,8 @@ #include "extractor/compressed_edge_container.hpp" #include "extractor/edge_based_graph_factory.hpp" -#include "extractor/node_based_edge.hpp" #include "extractor/io.hpp" +#include "extractor/node_based_edge.hpp" #include "storage/io.hpp" #include "util/exception.hpp" @@ -21,10 +21,10 @@ #include "util/typedefs.hpp" #include -#include -#include #include #include +#include +#include #include #include @@ -53,13 +53,11 @@ template inline bool is_aligned(const void *pointer) } // anon ns - namespace osrm { namespace updater { - // Returns duration in deci-seconds inline EdgeWeight ConvertToDuration(double distance_in_meters, double speed_in_kmh) { @@ -343,10 +341,8 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &e BOOST_ASSERT(u_index < nodes_range.size()); BOOST_ASSERT(v_index < nodes_range.size()); - const extractor::QueryNode &u = - 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 &u = internal_to_external_node_map[nodes_range[u_index]]; + const extractor::QueryNode &v = internal_to_external_node_map[nodes_range[v_index]]; const double segment_length = util::coordinate_calculation::greatCircleDistance( util::Coordinate{u.lon, u.lat}, util::Coordinate{v.lon, v.lat}); @@ -366,8 +362,10 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &e new_segment_duration); segment_data.ForwardWeight(geometry_id, segment_offset) = new_segment_weight; - segment_data.ForwardDuration(geometry_id, segment_offset) = new_segment_duration; - geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset)+1] = value->source; + segment_data.ForwardDuration(geometry_id, segment_offset) = + new_segment_duration; + geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset) + 1] = + value->source; fwd_source = value->source; } @@ -385,8 +383,10 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &e new_segment_duration); segment_data.ReverseWeight(geometry_id, segment_offset) = new_segment_weight; - segment_data.ReverseDuration(geometry_id, segment_offset) = new_segment_duration; - geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset)] = value->source; + segment_data.ReverseDuration(geometry_id, segment_offset) = + new_segment_duration; + geometry_datasource[segment_data.GetOffset(geometry_id, segment_offset)] = + value->source; rev_source = value->source; }