Skip to content
Draft
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions src/db/db/dbPLCConvexDecomposition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
#include <memory>
#include <vector>
#include <map>
#include <algorithm>

#if defined(__cpp_lib_execution)
#include <execution>
#define PARALLEL_EXEC_POLICY std::execution::par,
#else
#define PARALLEL_EXEC_POLICY
#endif

// #define DEBUG_DUMP_ESSENTIAL_EDGES

Expand Down Expand Up @@ -269,7 +277,7 @@ ConvexDecomposition::hertel_mehlhorn_decomposition (Triangulation &tris, const C

if (! new_points.empty ()) {

std::sort (new_points.begin (), new_points.end (), less_compare_func<db::DPoint> ());
std::sort (PARALLEL_EXEC_POLICY new_points.begin (), new_points.end (), less_compare_func<db::DPoint> ());
new_points.erase (std::unique (new_points.begin (), new_points.end (), equal_compare_func<db::DPoint> ()), new_points.end ());

// Insert the new points and make connections
Expand Down Expand Up @@ -332,7 +340,7 @@ ConvexDecomposition::hertel_mehlhorn_decomposition (Triangulation &tris, const C
}
}

std::sort (sorted_edges.begin (), sorted_edges.end (), SortAngleAndEdgesByEdgeLength ());
std::sort (PARALLEL_EXEC_POLICY sorted_edges.begin (), sorted_edges.end (), SortAngleAndEdgesByEdgeLength ());

for (auto i = sorted_edges.end (); i != sorted_edges.begin (); ) {
--i;
Expand Down
10 changes: 9 additions & 1 deletion src/db/db/dbShapes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
#include "dbLayout.h"

#include <limits>
#include <algorithm>

#if defined(__cpp_lib_execution)
#include <execution>
#define PARALLEL_EXEC_POLICY std::execution::par,
#else
#define PARALLEL_EXEC_POLICY
#endif

namespace db
{
Expand Down Expand Up @@ -111,7 +119,7 @@ layer_op<Sh, StableTag>::erase (Shapes *shapes)
std::vector<bool> done;
done.resize (m_shapes.size (), false);

std::sort (m_shapes.begin (), m_shapes.end ());
std::sort (PARALLEL_EXEC_POLICY m_shapes.begin (), m_shapes.end ());

typename std::vector<Sh>::const_iterator s_begin = m_shapes.begin ();
typename std::vector<Sh>::const_iterator s_end = m_shapes.end ();
Expand Down
Loading