From 6cb1dbe4d4c9ecff4b13c8238f696f1cd48307c2 Mon Sep 17 00:00:00 2001 From: Konstantinos Katrioplas Date: Fri, 8 Jun 2018 12:00:28 +0200 Subject: [PATCH] small corrections on docs and test files --- .../internal/Smoothing/smoothing_evaluation.h | 14 +++---- .../Polygon_mesh_processing/smooth_mesh.h | 28 ++++++-------- .../Polygon_mesh_processing/smooth_shape.h | 3 -- .../test_mesh_smoothing.cpp | 38 +------------------ 4 files changed, 20 insertions(+), 63 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h index c309c1c24dc..5bbf99c4046 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/smoothing_evaluation.h @@ -26,8 +26,6 @@ #include #include -#include -#include #include #include #include @@ -77,9 +75,9 @@ public: #endif } - void extract_angles(const char* filename) + template + void extract_angles(Stream& output) { - std::ofstream output(filename); for(unsigned int i=0; i!=angles_.size(); ++i) output << angles_[i] << std::endl; output.close(); @@ -95,9 +93,9 @@ public: #endif } - void extract_areas(const char* filename) + template + void extract_areas(Stream& output) { - std::ofstream output(filename); for(unsigned int i=0; i!=areas_.size(); ++i) output << areas_[i] << std::endl; output.close(); @@ -130,9 +128,9 @@ public: #endif } - void extract_aspect_ratios(const char* filename) + template + void extract_aspect_ratios(Stream& output) { - std::ofstream output(filename); for(unsigned int i=0; i!=aspect_ratios_.size(); ++i) output << aspect_ratios_[i] << std::endl; output.close(); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h index 6b988aaa075..1977195a6a8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_mesh.h @@ -46,9 +46,6 @@ namespace Polygon_mesh_processing { * after each iteration. * * @tparam PolygonMesh model of `MutableFaceGraph`. -* If `PolygonMesh` has an internal property map for `CGAL::face_index_t`, -* and no `face_index_map` is given -* as a named parameter, then the internal one should be initialized. * @tparam FaceRange range of `boost::graph_traits::%face_descriptor`, model of `Range`. Its iterator type is `ForwardIterator`. * @tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters". @@ -182,9 +179,6 @@ void smooth_angles(PolygonMesh& pmesh) * Optionally, the points are reprojected after each iteration. * * @tparam PolygonMesh model of `MutableFaceGraph`. -* If `PolygonMesh` has an internal property map for `CGAL::face_index_t`, -* and no `face_index_map` is given -* as a named parameter, then the internal one should be initialized. * @tparam FaceRange range of `boost::graph_traits::%face_descriptor`, model of `Range`. Its iterator type is `ForwardIterator`. * @tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters" @@ -313,30 +307,32 @@ void smooth_areas(PolygonMesh& pmesh) } -// not documented -template -void angles_evaluation(PolygonMesh& pmesh, const char* filename) +///\cond SKIP_IN_MANUAL +template +void angles_evaluation(PolygonMesh& pmesh, GeomTraits, Stream& output) { internal::Quality_evaluator evaluator(pmesh); evaluator.gather_angles(); - evaluator.extract_angles(filename); + evaluator.extract_angles(output); } -template -void areas_evaluation(PolygonMesh& pmesh, const char* filename) +template +void areas_evaluation(PolygonMesh& pmesh, GeomTraits, Stream& output) { internal::Quality_evaluator evaluator(pmesh); evaluator.measure_areas(); - evaluator.extract_areas(filename); + evaluator.extract_areas(output); } -template -void aspect_ratio_evaluation(PolygonMesh& pmesh, const char* filename) +template +void aspect_ratio_evaluation(PolygonMesh& pmesh, GeomTraits, Stream& output) { internal::Quality_evaluator evaluator(pmesh); evaluator.calc_aspect_ratios(); - evaluator.extract_aspect_ratios(filename); + evaluator.extract_aspect_ratios(output); } +///\cond SKIP_IN_MANUAL + } // namespace Polygon_mesh_processing } // namespace CGAL diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h index 21f2437c1ba..8346de6b462 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/smooth_shape.h @@ -136,9 +136,6 @@ void smooth_curvature_flow_explicit(const FaceRange& faces, PolygonMesh& pmesh, * * * @tparam PolygonMesh model of `MutableFaceGraph`. -* If `PolygonMesh` has an internal property map for `CGAL::face_index_t`, -* and no `face_index_map` is given -* as a named parameter, then the internal one should be initialized. * @tparam FaceRange range of `boost::graph_traits::%face_descriptor`, * model of `Range`. Its iterator type is `ForwardIterator`. * @tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters" diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp index a31545c0d2a..f562ac1d10a 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_mesh_smoothing.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; @@ -10,41 +11,6 @@ typedef Kernel::Point_3 Point; typedef CGAL::Surface_mesh SurfaceMesh; typedef CGAL::Polyhedron_3 Polyhedron; -template -struct Constraints_pmap -{ - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - - typedef vertex_descriptor key_type; - typedef bool value_type; - typedef value_type& reference; - typedef boost::read_write_property_map_tag category; - - std::set* set_ptr_; - - public: - Constraints_pmap(std::set* set_ptr) - : set_ptr_(set_ptr) - {} - Constraints_pmap() - : set_ptr_(NULL) - {} - - friend value_type get(const Constraints_pmap& map, const key_type& v) - { - CGAL_assertion(map.set_ptr_ != NULL); - return !map.set_ptr_->empty() - && map.set_ptr_->count(v); - } - - friend void put(Constraints_pmap& map - , const key_type& v, const value_type is) - { - CGAL_assertion(map.set_ptr_ != NULL); - if (is) map.set_ptr_->insert(v); - else if(get(map, v)) map.set_ptr_->erase(v); - } - }; template void test_angle_smoothing(const char* filename) @@ -193,7 +159,7 @@ void test_constrained_vertices(const char* filename) z_init = get(vpmap, v).z(); } } - Constraints_pmap vcmap(&selected_vertices); + CGAL::Boolean_property_map > vcmap(selected_vertices); CGAL::Polygon_mesh_processing::smooth_angles(mesh, CGAL::Polygon_mesh_processing::parameters::vertex_is_constrained_map(vcmap));