From 0e977cbe671cc6ee88822beda74af4152752a8ea Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 9 Dec 2019 11:14:25 +0100 Subject: [PATCH 1/4] fix unused local type --- src/Unittests/unittests_mc_decimater.cc | 3 --- src/Unittests/unittests_mixed_decimater.cc | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Unittests/unittests_mc_decimater.cc b/src/Unittests/unittests_mc_decimater.cc index 38b4808b..7df7a599 100644 --- a/src/Unittests/unittests_mc_decimater.cc +++ b/src/Unittests/unittests_mc_decimater.cc @@ -43,7 +43,6 @@ TEST_F(OpenMeshMultipleChoiceDecimater, DecimateMesh) { typedef OpenMesh::Decimater::McDecimaterT< Mesh > Decimater; typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric; - typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal; Decimater decimaterDBG(mesh_); HModQuadric hModQuadricDBG; @@ -67,7 +66,6 @@ TEST_F(OpenMeshMultipleChoiceDecimater, DecimateMeshToFaceVerticesLimit) { typedef OpenMesh::Decimater::McDecimaterT< Mesh > Decimater; typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric; - typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal; Decimater decimaterDBG(mesh_); HModQuadric hModQuadricDBG; @@ -91,7 +89,6 @@ TEST_F(OpenMeshMultipleChoiceDecimater, DecimateMeshToFaceFaceLimit) { typedef OpenMesh::Decimater::McDecimaterT< Mesh > Decimater; typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric; - typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal; Decimater decimaterDBG(mesh_); HModQuadric hModQuadricDBG; diff --git a/src/Unittests/unittests_mixed_decimater.cc b/src/Unittests/unittests_mixed_decimater.cc index 15dc7d45..62422bb2 100644 --- a/src/Unittests/unittests_mixed_decimater.cc +++ b/src/Unittests/unittests_mixed_decimater.cc @@ -43,7 +43,6 @@ TEST_F(OpenMeshMixedDecimater, DecimateMesh80PercentMc) { typedef OpenMesh::Decimater::MixedDecimaterT< Mesh > Decimater; typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric; - typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal; Decimater decimaterDBG(mesh_); HModQuadric hModQuadricDBG; @@ -67,7 +66,6 @@ TEST_F(OpenMeshMixedDecimater, DecimateMeshToFaceVerticesLimit) { typedef OpenMesh::Decimater::MixedDecimaterT< Mesh > Decimater; typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric; - typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal; Decimater decimaterDBG(mesh_); HModQuadric hModQuadricDBG; @@ -91,7 +89,6 @@ TEST_F(OpenMeshMixedDecimater, DecimateMeshToFaceFaceLimit) { typedef OpenMesh::Decimater::MixedDecimaterT< Mesh > Decimater; typedef OpenMesh::Decimater::ModQuadricT< Mesh >::Handle HModQuadric; - typedef OpenMesh::Decimater::ModNormalFlippingT< Mesh >::Handle HModNormal; Decimater decimaterDBG(mesh_); HModQuadric hModQuadricDBG; From 15965f6b8108824c5e658c709035fa34219ddc06 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 9 Dec 2019 11:14:54 +0100 Subject: [PATCH 2/4] fix unused timing variable if timing output is not enabled --- src/Unittests/unittests_propertymanager.cc | 96 +++++++++++----------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/Unittests/unittests_propertymanager.cc b/src/Unittests/unittests_propertymanager.cc index 5f0a1a1f..87c92b95 100644 --- a/src/Unittests/unittests_propertymanager.cc +++ b/src/Unittests/unittests_propertymanager.cc @@ -234,9 +234,9 @@ TEST_F(OpenMeshPropertyManager, property_move_construction) { for (auto vh : mesh_.vertices()) prop1[vh] = vh.idx()*2-13; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) auto prop2 = std::move(prop1); - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "move constructing property from temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_FALSE(prop1.isValid()) << "prop1 should have been invalidated"; @@ -250,9 +250,9 @@ TEST_F(OpenMeshPropertyManager, property_move_construction) { for (auto vh : mesh_.vertices()) prop1[vh] = vh.idx()*2-13; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) auto prop2 = std::move(prop1); // prop1 and prop2 should refere to the same property - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "move constructing from named took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_TRUE(prop1.isValid()) << "named properties cannot be invalidated"; @@ -285,9 +285,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property temporary to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Temporary property got destroyed"; @@ -309,9 +309,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property temporary to named took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Temporary property got destroyed"; @@ -334,9 +334,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { for (auto vh : mesh_.vertices()) prop1[vh] = vh.idx()*2-13; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property named to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) prop1.set_range(mesh_.vertices(), 0); @@ -357,9 +357,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property named to named with different name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) prop1.set_range(mesh_.vertices(), 0); @@ -378,9 +378,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; // this should be a no op - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property named to named with same name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; @@ -423,9 +423,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_same_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // this should be cheap - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property temporary to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_FALSE(prop1.isValid()) << "prop1 not invalidated after moving"; @@ -445,9 +445,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_same_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property temporary to named took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_FALSE(prop1.isValid()) << "prop1 not invalidated after moving"; @@ -468,9 +468,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_same_mesh) { for (auto vh : mesh_.vertices()) prop1[vh] = vh.idx()*2-13; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // moving named properties will not invalidate the property and will copy the data - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property named to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_TRUE(prop1.isValid()) << "named prop1 should not be invalidated by moving"; @@ -493,9 +493,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_same_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // moving named properties will not invalidate the property and will copy the data - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property named to named with different name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_TRUE(prop1.isValid()) << "named prop1 should not be invalidated by moving"; @@ -516,9 +516,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_same_mesh) { EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // this should be a no op - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property named to named with same name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_TRUE(prop1.isValid()) << "named prop1 should not be invalidated by moving"; @@ -559,9 +559,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_different_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property temporary to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Temporary property got destroyed"; @@ -584,9 +584,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_different_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property temporary to named took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Temporary property got destroyed"; @@ -609,9 +609,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_different_mesh) { for (auto vh : mesh_.vertices()) prop1[vh] = vh.idx()*2-13; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property named to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) prop1.set_range(mesh_.vertices(), 0); @@ -632,9 +632,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_different_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property named to named with different name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) prop1.set_range(mesh_.vertices(), 0); @@ -652,9 +652,9 @@ TEST_F(OpenMeshPropertyManager, property_copying_different_mesh) { EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = prop1; // this should be a no op - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "copying property named to named with same name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; @@ -693,9 +693,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_different_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // this should be cheap - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property temporary to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_FALSE(prop1.isValid()) << "prop1 not invalidated after moving"; @@ -716,9 +716,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_different_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property temporary to named took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_FALSE(prop1.isValid()) << "prop1 not invalidated after moving"; @@ -739,9 +739,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_different_mesh) { for (auto vh : mesh_.vertices()) prop1[vh] = vh.idx()*2-13; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // moving named properties will not invalidate the property and will copy the data - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property named to temporary took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_TRUE(prop1.isValid()) << "named prop1 should not be invalidated by moving"; @@ -764,9 +764,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_different_mesh) { EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // moving named properties will not invalidate the property and will copy the data - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property named to named with different name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_TRUE(prop1.isValid()) << "named prop1 should not be invalidated by moving"; @@ -789,9 +789,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_different_mesh) { EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], -13) << "Property not copied correctly"; - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) prop2 = std::move(prop1); // should copy - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "moving property named to named with same name took " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) EXPECT_TRUE(prop1.isValid()) << "named prop1 should not be invalidated by moving"; @@ -840,13 +840,13 @@ TEST_F(OpenMeshPropertyManager, temporary_property_on_const_mesh) { OpenMesh::VProp get_id_prop(const OpenMesh::PolyConnectivity& mesh) { - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) auto id_prop = OpenMesh::VProp(mesh); for (auto vh : mesh.vertices()) id_prop(vh) = vh.idx(); - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "Time spend in function: " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) return id_prop; @@ -857,9 +857,9 @@ TEST_F(OpenMeshPropertyManager, return_property_from_function) { for (int i = 0; i < N_VERTICES_TIMING; ++i) mesh_.add_vertex(Mesh::Point()); - auto t_start = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_start = std::chrono::high_resolution_clock::now();) auto id_p = get_id_prop(mesh_); - auto t_end = std::chrono::high_resolution_clock::now(); + TIMING_OUTPUT(auto t_end = std::chrono::high_resolution_clock::now();) TIMING_OUTPUT(std::cout << "Time spend around function " << std::chrono::duration_cast(t_end-t_start).count() << "ms" << std::endl;) for (auto vh : mesh_.vertices()) From ee752ce9967c4cbc826738bb7129d7f85d406e16 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 9 Dec 2019 11:15:09 +0100 Subject: [PATCH 3/4] fix unsed variables in writers --- src/OpenMesh/Core/IO/writer/OBJWriter.cc | 1 - src/OpenMesh/Core/IO/writer/VTKWriter.cc | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/OpenMesh/Core/IO/writer/OBJWriter.cc b/src/OpenMesh/Core/IO/writer/OBJWriter.cc index eb2bcf99..bda4a97a 100644 --- a/src/OpenMesh/Core/IO/writer/OBJWriter.cc +++ b/src/OpenMesh/Core/IO/writer/OBJWriter.cc @@ -206,7 +206,6 @@ _OBJWriter_:: write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const { unsigned int idx; - size_t nV, nF; Vec3f v, n; Vec2f t; VertexHandle vh; diff --git a/src/OpenMesh/Core/IO/writer/VTKWriter.cc b/src/OpenMesh/Core/IO/writer/VTKWriter.cc index fb718dc7..3b3b2332 100644 --- a/src/OpenMesh/Core/IO/writer/VTKWriter.cc +++ b/src/OpenMesh/Core/IO/writer/VTKWriter.cc @@ -40,11 +40,7 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const { - Vec3f n; - Vec2f t; VertexHandle vh; - OpenMesh::Vec3f c; - OpenMesh::Vec4f cA; // check exporter features if (!check(_be, _opt)) { From 7926bc92e54357e25f0da5242d811da6159512a2 Mon Sep 17 00:00:00 2001 From: Max Lyon Date: Mon, 9 Dec 2019 11:15:26 +0100 Subject: [PATCH 4/4] fix unused variables in unittests --- src/Unittests/unittests_smart_handles.cc | 9 ++++---- src/Unittests/unittests_smart_ranges.cc | 14 ++++++------ src/Unittests/unittests_split_edge_copy.cc | 2 +- src/Unittests/unittests_trimesh_iterators.cc | 24 +++++++++++++------- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/Unittests/unittests_smart_handles.cc b/src/Unittests/unittests_smart_handles.cc index 21296caf..bfd8ca22 100644 --- a/src/Unittests/unittests_smart_handles.cc +++ b/src/Unittests/unittests_smart_handles.cc @@ -469,9 +469,9 @@ TEST_F(OpenMeshSmartHandles, MixOldAndNew) for (OpenMesh::SmartHalfedgeHandle heh : mesh_.halfedges()) { heh = mesh_.opposite_halfedge_handle(heh); - OpenMesh::SmartEdgeHandle eh = OpenMesh::PolyConnectivity::s_edge_handle(heh); - OpenMesh::SmartEdgeHandle eh2 = mesh_.edge_handle(heh); - OpenMesh::SmartFaceHandle fh = mesh_.face_handle(heh); + EXPECT_TRUE((std::is_same::value)); + EXPECT_TRUE((std::is_same::value)); + EXPECT_TRUE((std::is_same::value)); } } @@ -552,10 +552,11 @@ TEST(OpenMeshSmartHandlesNoFixture, SplitTriMesh) auto p = (MyMesh::Point()); OpenMesh::SmartVertexHandle vh = mesh.split(fh, p); - OpenMesh::SmartEdgeHandle eh = fh.halfedge().edge(); OpenMesh::SmartVertexHandle vh2 = mesh.split(eh, p); + EXPECT_NE(vh.idx(), vh2.idx()) << "This was only intended to fix an unused variable warning but cool that it caugth an actual error now"; + } diff --git a/src/Unittests/unittests_smart_ranges.cc b/src/Unittests/unittests_smart_ranges.cc index be5a3dc0..72d0b7c2 100644 --- a/src/Unittests/unittests_smart_ranges.cc +++ b/src/Unittests/unittests_smart_ranges.cc @@ -225,12 +225,12 @@ TEST_F(OpenMeshSmartRanges, ToVector) auto tri_uvs = fh.halfedges().to_vector(uvs); auto heh_handles = fh.halfedges().to_vector(); for (auto heh : heh_handles) - auto n = heh.next(); + heh.next(); } auto vertex_vec = mesh_.vertices().to_vector(); for (auto vh : vertex_vec) - auto heh = vh.out(); + vh.out(); } /* Test to array @@ -244,8 +244,8 @@ TEST_F(OpenMeshSmartRanges, ToArray) for (auto fh : mesh_.faces()) { - auto tri_uvs = fh.halfedges().to_array<3>(uvs); - auto heh_handles = fh.halfedges().to_array<3>(); + fh.halfedges().to_array<3>(uvs); + fh.halfedges().to_array<3>(); } } @@ -263,7 +263,7 @@ TEST_F(OpenMeshSmartRanges, BoundingBox) auto bb_min = mesh_.vertices().min(myPos); auto bb_max = mesh_.vertices().max(myPos); - auto bb = mesh_.vertices().minmax(myPos); + mesh_.vertices().minmax(myPos); EXPECT_LT(norm(bb_min - OpenMesh::Vec3f(-1,-1,-1)), 0.000001) << "Bounding box minimum seems off"; EXPECT_LT(norm(bb_max - OpenMesh::Vec3f( 1, 1, 1)), 0.000001) << "Bounding box maximum seems off"; @@ -275,8 +275,8 @@ TEST_F(OpenMeshSmartRanges, BoundingBox) for (auto fh : mesh_.faces()) { - auto uv_bb_min = fh.halfedges().min(uvs); - auto uv_bb_max = fh.halfedges().max(uvs); + fh.halfedges().min(uvs); + fh.halfedges().max(uvs); } } diff --git a/src/Unittests/unittests_split_edge_copy.cc b/src/Unittests/unittests_split_edge_copy.cc index f92bfa54..60b93581 100644 --- a/src/Unittests/unittests_split_edge_copy.cc +++ b/src/Unittests/unittests_split_edge_copy.cc @@ -127,7 +127,7 @@ TEST_F(OpenMeshSplitEdgeCopyPolyMesh, SplitEdgeCopyPolymesh) { face_vhandles.push_back(vhandle[2]); face_vhandles.push_back(vhandle[3]); - PolyMesh::FaceHandle fh = mesh_.add_face(face_vhandles); + mesh_.add_face(face_vhandles); PolyMesh::EdgeHandle eh = *mesh_.edges_begin(); // Test setup: diff --git a/src/Unittests/unittests_trimesh_iterators.cc b/src/Unittests/unittests_trimesh_iterators.cc index a91012c0..d4e36f21 100644 --- a/src/Unittests/unittests_trimesh_iterators.cc +++ b/src/Unittests/unittests_trimesh_iterators.cc @@ -904,12 +904,14 @@ TEST_F(OpenMeshIterators, RangeIterators) { int count_faces_range = 0; for (auto fh : mesh_.faces()) - ++count_faces_range; + if (fh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_faces_range; EXPECT_EQ(1, count_faces_range) << "Wrong number of visited faces."; int count_faces_range_all = 0; for (auto fh : mesh_.all_faces()) - ++count_faces_range_all; + if (fh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_faces_range_all; EXPECT_EQ(2, count_faces_range_all) << "Wrong number of visited faces."; @@ -927,12 +929,14 @@ TEST_F(OpenMeshIterators, RangeIterators) { int count_edges_range = 0; for (auto eh : mesh_.edges()) - ++count_edges_range; + if (eh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_edges_range; EXPECT_EQ(3, count_edges_range) << "Wrong number of visited edges."; int count_edges_range_all = 0; for (auto eh : mesh_.all_edges()) - ++count_edges_range_all; + if (eh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_edges_range_all; EXPECT_EQ(5, count_edges_range_all) << "Wrong number of visited edges."; @@ -950,12 +954,14 @@ TEST_F(OpenMeshIterators, RangeIterators) { int count_halfedges_range = 0; for (auto heh : mesh_.halfedges()) - ++count_halfedges_range; + if (heh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_halfedges_range; EXPECT_EQ(6, count_halfedges_range) << "Wrong number of visited halfedges."; int count_halfedges_range_all = 0; for (auto heh : mesh_.all_halfedges()) - ++count_halfedges_range_all; + if (heh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_halfedges_range_all; EXPECT_EQ(10, count_halfedges_range_all) << "Wrong number of visited halfedges."; @@ -973,12 +979,14 @@ TEST_F(OpenMeshIterators, RangeIterators) { int count_vertices_range = 0; for (auto vh : mesh_.vertices()) - ++count_vertices_range; + if (vh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_vertices_range; EXPECT_EQ(3, count_vertices_range) << "Wrong number of visited vertices."; int count_vertices_range_all = 0; for (auto vh : mesh_.all_vertices()) - ++count_vertices_range_all; + if (vh.is_valid()) // not actually necessary but fixes unused variable warning + ++count_vertices_range_all; EXPECT_EQ(4, count_vertices_range_all) << "Wrong number of visited vertices.";