Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions tasks/perepelkin_i_convex_hull_graham_scan/tbb/src/ops_tbb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <tbb/parallel_reduce.h>
#include <tbb/parallel_sort.h>

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <utility>
Expand Down Expand Up @@ -80,19 +79,12 @@ size_t PerepelkinIConvexHullGrahamScanTBB::FindPivotParallel(const std::vector<s

void PerepelkinIConvexHullGrahamScanTBB::ParallelSort(std::vector<std::pair<double, double>> &data,
const std::pair<double, double> &pivot) {
size_t n = data.size();

if (n < 10000) {
std::ranges::sort(data, [&](const auto &a, const auto &b) { return AngleCmp(a, b, pivot); });
return;
}

tbb::parallel_sort(data.begin(), data.end(), [&](const auto &a, const auto &b) { return AngleCmp(a, b, pivot); });
}

void perepelkin_i_convex_hull_graham_scan::PerepelkinIConvexHullGrahamScanTBB::HullConstruction(
std::vector<std::pair<double, double>> &hull, const std::vector<std::pair<double, double>> &pts,
const std::pair<double, double> &pivot) {
void PerepelkinIConvexHullGrahamScanTBB::HullConstruction(std::vector<std::pair<double, double>> &hull,
const std::vector<std::pair<double, double>> &pts,
const std::pair<double, double> &pivot) {
hull.reserve(pts.size() + 1);

hull.push_back(pivot);
Expand Down
Loading