test the dry_run

This commit is contained in:
Maxime Gimeno 2019-10-01 09:56:37 +02:00
parent 1a429d03e4
commit c42d1b3cfd
2 changed files with 13 additions and 7 deletions

View File

@ -240,8 +240,9 @@ std::size_t remove_connected_components_of_negligible_size(TriangleMesh& tmesh,
for(face_descriptor f : faces(tmesh)) for(face_descriptor f : faces(tmesh))
{ {
const std::size_t i = face_cc[f]; const std::size_t i = face_cc[f];
if(!cc_closeness[i]) if(!cc_closeness[i]){
continue; continue;
}
const FT fv = cv3(origin, const FT fv = cv3(origin,
get(vpm, target(halfedge(f, tmesh), tmesh)), get(vpm, target(halfedge(f, tmesh), tmesh)),
@ -284,7 +285,7 @@ std::size_t remove_connected_components_of_negligible_size(TriangleMesh& tmesh,
#ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL #ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL
std::cout << "Removing " << ccs_to_remove.size() << " CCs" << std::endl; std::cout << "Removing " << ccs_to_remove.size() << " CCs" << std::endl;
#endif #endif
if(dry_run){ if(!dry_run){
remove_connected_components(tmesh, ccs_to_remove, face_cc, np); remove_connected_components(tmesh, ccs_to_remove, face_cc, np);
CGAL_postcondition(is_valid_polygon_mesh(tmesh)); CGAL_postcondition(is_valid_polygon_mesh(tmesh));
} }

View File

@ -248,7 +248,11 @@ void remove_negligible_connected_components(const char* filename)
// Could also have used default paramaters, which does the job by itself // Could also have used default paramaters, which does the job by itself
std::cout << "---------\ndefault values..." << std::endl; std::cout << "---------\ndefault values..." << std::endl;
PMP::remove_connected_components_of_negligible_size(mesh_cpy);
std::size_t nb_to_be_rm = PMP::remove_connected_components_of_negligible_size(mesh_cpy, CGAL::parameters::dry_run(true));
assert(nb_to_be_rm ==
PMP::remove_connected_components_of_negligible_size(mesh_cpy));
assert(PMP::internal::number_of_connected_components(mesh_cpy) == 1); assert(PMP::internal::number_of_connected_components(mesh_cpy) == 1);
} }
@ -308,6 +312,7 @@ void test()
6, 7, 2, 4, 3, 3); 6, 7, 2, 4, 3, 3);
remove_negligible_connected_components<K, Mesh>("data_degeneracies/small_ccs.off"); remove_negligible_connected_components<K, Mesh>("data_degeneracies/small_ccs.off");
} }
template <typename Kernel> template <typename Kernel>