Link Here
|
|
|
1 |
--- src/extractor/extractor.cpp.orig 2021-02-06 00:31:54 UTC |
2 |
+++ src/extractor/extractor.cpp |
3 |
@@ -44,12 +44,12 @@ |
4 |
#include <osmium/thread/pool.hpp> |
5 |
#include <osmium/visitor.hpp> |
6 |
|
7 |
-#if TBB_VERSION_MAJOR == 2020 |
8 |
+#if TBB_VERSION_MAJOR >= 2020 |
9 |
#include <tbb/global_control.h> |
10 |
#else |
11 |
#include <tbb/task_scheduler_init.h> |
12 |
#endif |
13 |
-#include <tbb/pipeline.h> |
14 |
+#include <tbb/parallel_pipeline.h> |
15 |
|
16 |
#include <algorithm> |
17 |
#include <atomic> |
18 |
@@ -206,7 +206,7 @@ int Extractor::run(ScriptingEnvironment &scripting_env |
19 |
const unsigned recommended_num_threads = std::thread::hardware_concurrency(); |
20 |
const auto number_of_threads = std::min(recommended_num_threads, config.requested_num_threads); |
21 |
|
22 |
-#if TBB_VERSION_MAJOR == 2020 |
23 |
+#if TBB_VERSION_MAJOR >= 2020 |
24 |
tbb::global_control gc(tbb::global_control::max_allowed_parallelism, |
25 |
config.requested_num_threads); |
26 |
#else |
27 |
@@ -454,8 +454,8 @@ std:: |
28 |
ExtractionRelationContainer relations; |
29 |
|
30 |
const auto buffer_reader = [](osmium::io::Reader &reader) { |
31 |
- return tbb::filter_t<void, SharedBuffer>( |
32 |
- tbb::filter::serial_in_order, [&reader](tbb::flow_control &fc) { |
33 |
+ return tbb::make_filter<void, SharedBuffer>( |
34 |
+ tbb::filter_mode::serial_in_order, [&reader](tbb::flow_control &fc) { |
35 |
if (auto buffer = reader.read()) |
36 |
{ |
37 |
return std::make_shared<osmium::memory::Buffer>(std::move(buffer)); |
38 |
@@ -476,15 +476,15 @@ std:: |
39 |
osmium_index_type location_cache; |
40 |
osmium_location_handler_type location_handler(location_cache); |
41 |
|
42 |
- tbb::filter_t<SharedBuffer, SharedBuffer> location_cacher( |
43 |
- tbb::filter::serial_in_order, [&location_handler](SharedBuffer buffer) { |
44 |
+ auto location_cacher = tbb::make_filter<SharedBuffer, SharedBuffer>( |
45 |
+ tbb::filter_mode::serial_in_order, [&location_handler](SharedBuffer buffer) { |
46 |
osmium::apply(buffer->begin(), buffer->end(), location_handler); |
47 |
return buffer; |
48 |
}); |
49 |
|
50 |
// OSM elements Lua parser |
51 |
- tbb::filter_t<SharedBuffer, ParsedBuffer> buffer_transformer( |
52 |
- tbb::filter::parallel, [&](const SharedBuffer buffer) { |
53 |
+ auto buffer_transformer = tbb::make_filter<SharedBuffer, ParsedBuffer>( |
54 |
+ tbb::filter_mode::parallel, [&](const SharedBuffer buffer) { |
55 |
ParsedBuffer parsed_buffer; |
56 |
parsed_buffer.buffer = buffer; |
57 |
scripting_environment.ProcessElements(*buffer, |
58 |
@@ -503,8 +503,8 @@ std:: |
59 |
unsigned number_of_ways = 0; |
60 |
unsigned number_of_restrictions = 0; |
61 |
unsigned number_of_maneuver_overrides = 0; |
62 |
- tbb::filter_t<ParsedBuffer, void> buffer_storage( |
63 |
- tbb::filter::serial_in_order, [&](const ParsedBuffer &parsed_buffer) { |
64 |
+ auto buffer_storage = tbb::make_filter<ParsedBuffer, void>( |
65 |
+ tbb::filter_mode::serial_in_order, [&](const ParsedBuffer &parsed_buffer) { |
66 |
number_of_nodes += parsed_buffer.resulting_nodes.size(); |
67 |
// put parsed objects thru extractor callbacks |
68 |
for (const auto &result : parsed_buffer.resulting_nodes) |
69 |
@@ -530,8 +530,8 @@ std:: |
70 |
} |
71 |
}); |
72 |
|
73 |
- tbb::filter_t<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>> buffer_relation_cache( |
74 |
- tbb::filter::parallel, [&](const SharedBuffer buffer) { |
75 |
+ auto buffer_relation_cache = tbb::make_filter<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>>( |
76 |
+ tbb::filter_mode::parallel, [&](const SharedBuffer buffer) { |
77 |
if (!buffer) |
78 |
return std::shared_ptr<ExtractionRelationContainer>{}; |
79 |
|
80 |
@@ -566,8 +566,8 @@ std:: |
81 |
}); |
82 |
|
83 |
unsigned number_of_relations = 0; |
84 |
- tbb::filter_t<std::shared_ptr<ExtractionRelationContainer>, void> buffer_storage_relation( |
85 |
- tbb::filter::serial_in_order, |
86 |
+ auto buffer_storage_relation = tbb::make_filter<std::shared_ptr<ExtractionRelationContainer>, void>( |
87 |
+ tbb::filter_mode::serial_in_order, |
88 |
[&](const std::shared_ptr<ExtractionRelationContainer> parsed_relations) { |
89 |
number_of_relations += parsed_relations->GetRelationsNum(); |
90 |
relations.Merge(std::move(*parsed_relations)); |