added new osqp support + fixed multiple warnings

This commit is contained in:
Dmitry Anisimov 2021-05-31 15:15:37 +02:00
parent 42ad711540
commit 8aa49a2561
18 changed files with 20 additions and 36 deletions

View File

@ -15,7 +15,8 @@ if(CGAL_FOUND)
# Find OSQP library and headers.
find_package(OSQP QUIET)
if(OSQP_FOUND)
include(CGAL_OSQP_support)
if(TARGET CGAL::OSQP_support)
message(STATUS "Found OSQP")
set(osqp_targets
@ -25,11 +26,9 @@ if(CGAL_FOUND)
foreach(osqp_target ${osqp_targets})
create_single_source_cgal_program("${osqp_target}.cpp")
if(TARGET ${osqp_target})
target_link_libraries(${osqp_target} PUBLIC ${OSQP_LIBRARIES})
target_compile_definitions(${osqp_target} PUBLIC -DCGAL_USE_OSQP)
target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support)
endif()
endforeach()
else()
message(STATUS "NOTICE: OSQP was not found. OSQP benchmarks won't be available.")
endif()

View File

@ -124,7 +124,7 @@ void benchmark_contours(
timer.start();
CD closed_directions(contour, true);
timer.stop();
const double longest_closed = timer.time();
// const double longest_closed = timer.time();
timer.reset();
double closed_time = 0.0;
@ -144,7 +144,7 @@ void benchmark_contours(
timer.start();
CD open_directions(contour, false);
timer.stop();
const double longest_open = timer.time();
// const double longest_open = timer.time();
timer.reset();
double open_time = 0.0;
@ -168,7 +168,7 @@ void benchmark_contours(
"closed/open): " << closed_time << "/" << open_time << " seconds" << std::endl;
}
int main(int argc, char *argv[]) {
int main() {
const std::size_t num_iters = 1;
const std::vector<std::size_t> ns = {

View File

@ -145,7 +145,7 @@ void benchmark_qp_segments(
}
}
timer.stop();
const double delaunay_time = timer.time();
// const double delaunay_time = timer.time();
timer.reset();
const FT max_angle_2 = FT(10);
@ -164,7 +164,7 @@ void benchmark_qp_segments(
}
}
timer.stop();
const double setup_angle_time = timer.time();
// const double setup_angle_time = timer.time();
timer.reset();
double angle_time = 0.0;
@ -184,7 +184,7 @@ void benchmark_qp_segments(
OR offset_regularization(
segments, CGAL::parameters::max_offset(max_offset_2));
timer.stop();
const double setup_offset_time = timer.time();
// const double setup_offset_time = timer.time();
timer.reset();
timer.start();
@ -192,7 +192,7 @@ void benchmark_qp_segments(
angle_regularization.parallel_groups(
std::back_inserter(pgroups));
timer.stop();
const double init_group_time = timer.time();
// const double init_group_time = timer.time();
timer.reset();
timer.start();
@ -202,7 +202,7 @@ void benchmark_qp_segments(
offset_regularization.add_group(pgroup);
}
timer.stop();
const double add_group_time = timer.time();
// const double add_group_time = timer.time();
timer.reset();
double offset_time = 0.0;
@ -239,7 +239,7 @@ void benchmark_qp_segments(
}
}
int main(int argc, char *argv[]) {
int main() {
const std::size_t num_iters = 1;
const std::vector<std::size_t> ns = {

View File

@ -15,7 +15,8 @@ if(CGAL_FOUND)
# Find OSQP library and headers.
find_package(OSQP QUIET)
if(OSQP_FOUND)
include(CGAL_OSQP_support)
if(TARGET CGAL::OSQP_support)
message(STATUS "Found OSQP")
set(osqp_targets
@ -27,8 +28,7 @@ if(CGAL_FOUND)
foreach(osqp_target ${osqp_targets})
create_single_source_cgal_program("${osqp_target}.cpp")
if(TARGET ${osqp_target})
target_link_libraries(${osqp_target} PUBLIC ${OSQP_LIBRARIES})
target_compile_definitions(${osqp_target} PUBLIC -DCGAL_USE_OSQP)
target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support)
endif()
endforeach()
@ -38,9 +38,7 @@ if(CGAL_FOUND)
if(TARGET CGAL::Eigen3_support)
message(STATUS "Found Eigen")
create_single_source_cgal_program("regularize_real_data_2.cpp")
target_link_libraries(regularize_real_data_2 PUBLIC CGAL::Eigen3_support ${OSQP_LIBRARIES})
target_compile_definitions(regularize_real_data_2 PUBLIC -DCGAL_USE_OSQP)
target_link_libraries(regularize_real_data_2 PUBLIC CGAL::Eigen3_support CGAL::OSQP_support)
else()
message(STATUS "NOTICE: Eigen was not found. Eigen examples won't be available.")
endif()

View File

@ -31,7 +31,7 @@ int main(int argc, char** argv) {
file.precision(20);
if (!file ||
!CGAL::read_xyz_points(
!CGAL::IO::read_XYZ(
file,
std::back_inserter(points),
CGAL::parameters::point_map(Point_map()).

View File

@ -15,7 +15,8 @@ if(CGAL_FOUND)
# Find OSQP library and headers.
find_package(OSQP QUIET)
if(OSQP_FOUND)
include(CGAL_OSQP_support)
if(TARGET CGAL::OSQP_support)
message(STATUS "Found OSQP")
set(osqp_targets
@ -32,11 +33,9 @@ if(CGAL_FOUND)
foreach(osqp_target ${osqp_targets})
create_single_source_cgal_program("${osqp_target}.cpp")
if(TARGET ${osqp_target})
target_link_libraries(${osqp_target} PUBLIC ${OSQP_LIBRARIES})
target_compile_definitions(${osqp_target} PUBLIC -DCGAL_USE_OSQP)
target_link_libraries(${osqp_target} PUBLIC CGAL::OSQP_support)
endif()
endforeach()
else()
message(STATUS "NOTICE: OSQP was not found. OSQP tests won't be available.")
endif()

View File

@ -11,7 +11,6 @@ template<class Traits>
void test_0_segments() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Segment_2 = typename Traits::Segment_2;
using Segments = std::vector<Segment_2>;
using Indices = std::vector<std::size_t>;

View File

@ -10,7 +10,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_closed_contour_10_edges() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Contour = std::vector<Point_2>;
using Saver = SR::Tests::Saver<Traits>;

View File

@ -10,7 +10,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_closed_contour_3_edges() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Contour = std::vector<Point_2>;
using Saver = SR::Tests::Saver<Traits>;

View File

@ -10,7 +10,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_closed_contour_4_edges() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Contour = std::vector<Point_2>;
using Saver = SR::Tests::Saver<Traits>;

View File

@ -10,7 +10,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_directions_longest() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Direction_2 = typename Traits::Direction_2;
using Contour = std::vector<Point_2>;

View File

@ -11,7 +11,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_directions_multiple_3() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Contour = std::vector<Point_2>;
using Saver = SR::Tests::Saver<Traits>;

View File

@ -10,7 +10,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_neighbor_query() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Segment_2 = typename Traits::Segment_2;
using Segments = std::vector<Segment_2>;

View File

@ -10,7 +10,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_open_contour_1_edge() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Contour = std::vector<Point_2>;
using Saver = SR::Tests::Saver<Traits>;

View File

@ -10,7 +10,6 @@ namespace SR = CGAL::Shape_regularization;
template<class Traits>
void test_open_contour_9_edges() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Contour = std::vector<Point_2>;
using Saver = SR::Tests::Saver<Traits>;

View File

@ -34,7 +34,6 @@ bool has_no_difference(
template<class Traits>
void test_segments() {
using FT = typename Traits::FT;
using Point_2 = typename Traits::Point_2;
using Segment_2 = typename Traits::Segment_2;
using Segments = std::vector<Segment_2>;

View File

@ -14,7 +14,6 @@ void test_unique_segments() {
using Point_2 = typename Traits::Point_2;
using Segment_2 = typename Traits::Segment_2;
using Segments = std::vector<Segment_2>;
using Indices = std::vector<std::size_t>;
using Saver = SR::Tests::Saver<Traits>;
Saver saver;

View File

@ -1,7 +1,6 @@
* Comment the code.
* Spell check all files.
* Check memory leaking.
* Check authors.
* Install OSQP on all testing platforms.
* Add a 3D version of the QP regularization algorithm.