From 6566c592c2a8889bea558ccb2baa27fec00c8652 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 24 Mar 2014 12:50:18 +0100 Subject: [PATCH] remove new template parameter RNG using CGAL::Random everywhere is simpler and definitely enough note we are using CGAL::Random& as in Random_generator_base (see CGAL/generators.h) --- Mesh_3/include/CGAL/Implicit_mesh_domain_3.h | 9 +++---- .../CGAL/Labeled_image_mesh_domain_3.h | 8 +++--- .../CGAL/Mesh_3/Labeled_mesh_domain_3.h | 27 +++++++++---------- .../include/CGAL/Polyhedral_mesh_domain_3.h | 27 +++++++++---------- .../Polyhedral_mesh_domain_with_features_3.h | 20 +++++++------- 5 files changed, 42 insertions(+), 49 deletions(-) diff --git a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h index e0bdc6a9997..3f799b6e9c1 100644 --- a/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Implicit_mesh_domain_3.h @@ -46,14 +46,13 @@ namespace CGAL { */ template > class Implicit_mesh_domain_3 - : public Mesh_3::Labeled_mesh_domain_3 + : public Mesh_3::Labeled_mesh_domain_3 { public: /// Base type - typedef Mesh_3::Labeled_mesh_domain_3 Base; + typedef Mesh_3::Labeled_mesh_domain_3 Base; /// Public types typedef typename Base::Sphere_3 Sphere_3; @@ -68,7 +67,7 @@ public: */ Implicit_mesh_domain_3(const Function& f, const Sphere_3& bounding_sphere, - RNG rng = CGAL::Random(0), + CGAL::Random& rng = CGAL::Random(0), const FT& error_bound = FT(1e-3)) : Base(Wrapper(f), bounding_sphere, rng, error_bound) {} @@ -78,7 +77,7 @@ public: private: // Disabled copy constructor & assignment operator - typedef Implicit_mesh_domain_3 Self; + typedef Implicit_mesh_domain_3 Self; Implicit_mesh_domain_3(const Self& src); Self& operator=(const Self& src); diff --git a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h index 73417734d1f..a3648aae56f 100644 --- a/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_image_mesh_domain_3.h @@ -41,13 +41,13 @@ namespace CGAL { */ template > class Labeled_image_mesh_domain_3 -: public Mesh_3::Labeled_mesh_domain_3 +: public Mesh_3::Labeled_mesh_domain_3 { public: - typedef Mesh_3::Labeled_mesh_domain_3 Base; + typedef Mesh_3::Labeled_mesh_domain_3 Base; typedef typename Base::Sphere_3 Sphere_3; typedef typename Base::FT FT; @@ -56,7 +56,7 @@ public: /// Constructor Labeled_image_mesh_domain_3(const Image& image, - RNG rng = CGAL::Random(0), + CGAL::Random& rng = CGAL::Random(0), const FT& error_bound = FT(1e-3)) : Base(Wrapper(image), compute_bounding_box(image), diff --git a/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h index d65fdc0002f..5c942135fb1 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Labeled_mesh_domain_3.h @@ -57,8 +57,7 @@ namespace Mesh_3 { * Thus, a boundary facet of the domain is labelled <0,b>, where b!=0. */ template + class BGT> class Labeled_mesh_domain_3 { public: @@ -97,12 +96,12 @@ public: */ Labeled_mesh_domain_3(const Function& f, const Sphere_3& bounding_sphere, - RNG rng = CGAL::Random(0), + CGAL::Random& rng = CGAL::Random(0), const FT& error_bound = FT(1e-3)); Labeled_mesh_domain_3(const Function& f, const Bbox_3& bbox, - RNG rng = CGAL::Random(0), + CGAL::Random& rng = CGAL::Random(0), const FT& error_bound = FT(1e-3)); /// Destructor @@ -467,14 +466,14 @@ private: /// The bounding box const Iso_cuboid_3 bbox_; /// The random number generator used by Construct_initial_points - RNG& rng_; + CGAL::Random& rng_; /// Error bound relative to sphere radius FT squared_error_bound_; private: // Disabled copy constructor & assignment operator - typedef Labeled_mesh_domain_3 Self; + typedef Labeled_mesh_domain_3 Self; Labeled_mesh_domain_3(const Self& src); Self& operator=(const Self& src); @@ -486,11 +485,11 @@ private: //------------------------------------------------------- // Method implementation //------------------------------------------------------- -template -Labeled_mesh_domain_3::Labeled_mesh_domain_3( +template +Labeled_mesh_domain_3::Labeled_mesh_domain_3( const F& f, const Sphere_3& bounding_sphere, - RNG rng, + CGAL::Random& rng, const FT& error_bound ) : function_(f) , bbox_(iso_cuboid(bounding_sphere.bbox())) @@ -500,11 +499,11 @@ Labeled_mesh_domain_3::Labeled_mesh_domain_3( // TODO : CGAL_ASSERT(0 < f(bounding_sphere.get_center()) ) ? } -template -Labeled_mesh_domain_3::Labeled_mesh_domain_3( +template +Labeled_mesh_domain_3::Labeled_mesh_domain_3( const F& f, const Bbox_3& bbox, - RNG rng, + CGAL::Random& rng, const FT& error_bound ) : function_(f) , bbox_(iso_cuboid(bbox)) @@ -516,10 +515,10 @@ Labeled_mesh_domain_3::Labeled_mesh_domain_3( -template +template template OutputIterator -Labeled_mesh_domain_3::Construct_initial_points::operator()( +Labeled_mesh_domain_3::Construct_initial_points::operator()( OutputIterator pts, const int nb_points) const { diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 78ad811b355..bca4c984383 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -149,7 +149,6 @@ struct IGT_generator template, - class RNG=CGAL::Random, class Use_patch_id_tag=Tag_false, class Use_exact_intersection_construction_tag = CGAL::Tag_true> class Polyhedral_mesh_domain_3 @@ -206,17 +205,15 @@ public: : tree_() , bounding_tree_(&tree_) , has_cache(false) - , rng_(CGAL::default_random) - { - CGAL::default_random = CGAL::Random(0); - } + , rng_(CGAL::Random(0)) + {} /** * @brief Constructor. Contruction from a polyhedral surface * @param polyhedron the polyhedron describing the polyhedral surface */ Polyhedral_mesh_domain_3(const Polyhedron& p, - RNG rng = CGAL::Random(0)) + CGAL::Random& rng = CGAL::Random(0)) : tree_(TriangleAccessor().triangles_begin(p), TriangleAccessor().triangles_end(p)), bounding_tree_(&tree_) // the bounding tree is tree_ @@ -231,7 +228,7 @@ public: Polyhedral_mesh_domain_3(const Polyhedron& p, const Polyhedron& bounding_polyhedron, - RNG rng = CGAL::Random(0)) + CGAL::Random& rng = CGAL::Random(0)) : tree_(TriangleAccessor().triangles_begin(p), TriangleAccessor().triangles_end(p)) , bounding_tree_(new AABB_tree_(TriangleAccessor().triangles_begin(bounding_polyhedron), @@ -260,7 +257,7 @@ public: Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin, InputPolyhedraPtrIterator end, const Polyhedron& bounding_polyhedron, - RNG rng = CGAL::Random(0)) + CGAL::Random& rng = CGAL::Random(0)) : has_cache(false) , rng_(rng) { @@ -297,7 +294,7 @@ public: template Polyhedral_mesh_domain_3(InputPolyhedraPtrIterator begin, InputPolyhedraPtrIterator end, - RNG rng = CGAL::Random(0)) + CGAL::Random& rng = CGAL::Random(0)) : has_cache(false) , rng_(rng) { @@ -610,7 +607,7 @@ private: mutable AABB_primitive_id cached_primitive_id; //random number generator for Construct_initial_points - RNG& rng_; + CGAL::Random& rng_; public: @@ -641,10 +638,10 @@ private: template + typename Tag, typename E_tag_> template OutputIterator -Polyhedral_mesh_domain_3:: +Polyhedral_mesh_domain_3:: Construct_initial_points::operator()(OutputIterator pts, const int n) const { @@ -697,9 +694,9 @@ Construct_initial_points::operator()(OutputIterator pts, template -typename Polyhedral_mesh_domain_3::Subdomain -Polyhedral_mesh_domain_3:: + typename Tag, typename E_tag_> +typename Polyhedral_mesh_domain_3::Subdomain +Polyhedral_mesh_domain_3:: Is_in_domain::operator()(const Point_3& p) const { if(r_domain_.bounding_tree_ == 0) return Subdomain(); diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h index b649c987e0d..7cde69313c4 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -57,7 +57,6 @@ namespace CGAL { template < class IGT_, class Polyhedron_ = typename Mesh_polyhedron_3::type, class TriangleAccessor=Triangle_accessor_3, - class RNG=CGAL::Random, class Use_patch_id_tag = Tag_true, class Use_exact_intersection_construction_tag = CGAL::Tag_true > class Polyhedral_mesh_domain_with_features_3 @@ -65,13 +64,12 @@ class Polyhedral_mesh_domain_with_features_3 Polyhedral_mesh_domain_3< Polyhedron_, IGT_, TriangleAccessor, - RNG, Use_patch_id_tag, Use_exact_intersection_construction_tag > > { typedef Mesh_domain_with_polyline_features_3< Polyhedral_mesh_domain_3< - Polyhedron_, IGT_, TriangleAccessor, RNG, + Polyhedron_, IGT_, TriangleAccessor, Use_patch_id_tag, Use_exact_intersection_construction_tag > > Base; typedef Polyhedron_ Polyhedron; @@ -128,8 +126,8 @@ private: template < typename GT_, typename P_, typename TA_, - typename RNG_, typename Tag_, typename E_tag_> -Polyhedral_mesh_domain_with_features_3:: + typename Tag_, typename E_tag_> +Polyhedral_mesh_domain_with_features_3:: Polyhedral_mesh_domain_with_features_3(const Polyhedron& p) : Base() , polyhedron_(p) @@ -138,8 +136,8 @@ Polyhedral_mesh_domain_with_features_3(const Polyhedron& p) } template < typename GT_, typename P_, typename TA_, - typename RNG_, typename Tag_, typename E_tag_> -Polyhedral_mesh_domain_with_features_3:: + typename Tag_, typename E_tag_> +Polyhedral_mesh_domain_with_features_3:: Polyhedral_mesh_domain_with_features_3(const std::string& filename) : Base() , polyhedron_() @@ -152,9 +150,9 @@ Polyhedral_mesh_domain_with_features_3(const std::string& filename) template < typename GT_, typename P_, typename TA_, - typename RNG_, typename Tag_, typename E_tag_> + typename Tag_, typename E_tag_> void -Polyhedral_mesh_domain_with_features_3:: +Polyhedral_mesh_domain_with_features_3:: initialize_ts(Polyhedron& p) { std::size_t ts = 0; @@ -177,9 +175,9 @@ initialize_ts(Polyhedron& p) template < typename GT_, typename P_, typename TA_, - typename RNG_, typename Tag_, typename E_tag_> + typename Tag_, typename E_tag_> void -Polyhedral_mesh_domain_with_features_3:: +Polyhedral_mesh_domain_with_features_3:: detect_features(FT angle_in_degree, Polyhedron& p) { initialize_ts(p);