diff --git a/Installation/changes.html b/Installation/changes.html index 52b9f50eea6..c1b76fd12d0 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -166,6 +166,14 @@ and src/ directories). +

3D Mesh Generation

+ + + diff --git a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h b/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h index b8012b38643..0c68e3dc06e 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Polyhedral_mesh_domain_with_features_3.h @@ -57,11 +57,6 @@ Its interior of `bounding_polyhedron` will be meshed. template Polyhedral_mesh_domain_with_features_3(Polyhedron bounding_polyhedron); -/*! -Constructs a `Polyhedral_mesh_domain_with_features_3` from an off file. No feature -detection is done at this level. -*/ -Polyhedral_mesh_domain_with_features_3(const std::string& filename); /*! Constructs a `Polyhedral_mesh_domain_with_features_3` from a polyhedral surface, and a bounding polyhedral surface. @@ -75,6 +70,13 @@ template Polyhedral_mesh_domain_with_features_3(Polyhedron polyhedron, Polyhedron bounding_polyhedron); +/*! +\deprecated Constructs a `Polyhedral_mesh_domain_with_features_3` from an off file. No feature +detection is done at this level. Users must read the file into a `Polyhedron_3` and call the +constructor above. +*/ +Polyhedral_mesh_domain_with_features_3(const std::string& filename); + /// @} /// \name Operations diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp index f0afd583f94..c26494dc830 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp @@ -40,7 +40,7 @@ int main(int argc, char*argv[]) Polyhedron polyhedron; std::ifstream input(fname); input >> polyhedron; - if(input.bad()){ + if(input.fail()){ std::cerr << "Error: Cannot read file " << fname << std::endl; return EXIT_FAILURE; } diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp index 916a4d612a9..5c20fb16395 100644 --- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features.cpp @@ -9,8 +9,10 @@ // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Mesh_polyhedron_3::type Polyhedron; typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; + #ifdef CGAL_CONCURRENT_MESH_3 typedef CGAL::Parallel_tag Concurrency_tag; #else @@ -32,8 +34,15 @@ using namespace CGAL::parameters; int main(int argc, char*argv[]) { const char* fname = (argc>1)?argv[1]:"data/fandisk.off"; + std::ifstream input(fname); + Polyhedron polyhedron; + input >> polyhedron; + if(input.fail()){ + std::cerr << "Error: Cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } // Create domain - Mesh_domain domain(fname); + Mesh_domain domain(polyhedron); // Get sharp features domain.detect_features(); diff --git a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp index 4f7866503d0..b669a8a4ab9 100644 --- a/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp +++ b/Mesh_3/examples/Mesh_3/remesh_polyhedral_surface.cpp @@ -56,5 +56,5 @@ int main() std::ofstream off_file("out.off"); c3t3.output_boundary_to_off(off_file); - return off_file.bad() ? EXIT_FAILURE : EXIT_SUCCESS; + return off_file.fail() ? EXIT_FAILURE : EXIT_SUCCESS; } 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 3731b02ac15..05f5912657e 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 @@ -74,9 +74,9 @@ class Polyhedral_mesh_domain_with_features_3 Polyhedral_mesh_domain_3< Polyhedron_, IGT_, TriangleAccessor, Use_patch_id_tag, Use_exact_intersection_construction_tag > > Base; - + typedef Polyhedron_ Polyhedron; - + public: // Index types typedef typename Base::Index Index; @@ -99,13 +99,14 @@ public: /// Constructors Polyhedral_mesh_domain_with_features_3(const Polyhedron& p, CGAL::Random* p_rng = NULL); - Polyhedral_mesh_domain_with_features_3(const std::string& filename, + + CGAL_DEPRECATED Polyhedral_mesh_domain_with_features_3(const std::string& filename, CGAL::Random* p_rng = NULL); // The following is needed, because otherwise, when a "const char*" is // passed, the constructors templates are a better match, than the // constructor with `std::string`. - Polyhedral_mesh_domain_with_features_3(const char* filename, + CGAL_DEPRECATED Polyhedral_mesh_domain_with_features_3(const char* filename, CGAL::Random* p_rng = NULL); // Inherited constructors @@ -193,9 +194,10 @@ Polyhedral_mesh_domain_with_features_3(const Polyhedron& p, this->set_random_generator(p_rng); } + template < typename GT_, typename P_, typename TA_, typename Tag_, typename E_tag_> -Polyhedral_mesh_domain_with_features_3:: +CGAL_DEPRECATED Polyhedral_mesh_domain_with_features_3:: Polyhedral_mesh_domain_with_features_3(const char* filename, CGAL::Random* p_rng) : Base() @@ -209,9 +211,10 @@ Polyhedral_mesh_domain_with_features_3(const char* filename, this->set_random_generator(p_rng); } + template < typename GT_, typename P_, typename TA_, typename Tag_, typename E_tag_> -Polyhedral_mesh_domain_with_features_3:: +CGAL_DEPRECATED Polyhedral_mesh_domain_with_features_3:: Polyhedral_mesh_domain_with_features_3(const std::string& filename, CGAL::Random* p_rng) : Base() diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index 5801b7dfbf7..acff5775f3c 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -54,6 +54,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_meshing_determinism.cpp" ) create_single_source_cgal_program( "test_c3t3_extract_subdomains_boundaries.cpp" ) create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" ) + create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" ) else() diff --git a/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp b/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp index c9116d6a759..4e6b23f2422 100644 --- a/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp +++ b/Mesh_3/test/Mesh_3/test_mesh_3_issue_1554.cpp @@ -7,8 +7,11 @@ #include #include +#include + // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Mesh_polyhedron_3::type Polyhedron; typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; #ifdef CGAL_CONCURRENT_MESH_3 @@ -43,7 +46,10 @@ int main(int argc, char*argv[]) { const char* fname = (argc>1)?argv[1]:"data/fandisk.off"; // Create domain - Mesh_domain domain(fname); + std::ifstream in(fname); + Polyhedron poly; + in >> poly; + Mesh_domain domain(poly); // Get sharp features domain.detect_features(); diff --git a/Mesh_3/test/Mesh_3/test_mesh_polyhedral_domain_with_features_deprecated.cpp b/Mesh_3/test/Mesh_3/test_mesh_polyhedral_domain_with_features_deprecated.cpp new file mode 100644 index 00000000000..05930e50d8d --- /dev/null +++ b/Mesh_3/test/Mesh_3/test_mesh_polyhedral_domain_with_features_deprecated.cpp @@ -0,0 +1,55 @@ +#define CGAL_NO_DEPRECATION_WARNINGS + +#include + +#include +#include +#include + +#include +#include + +// Domain +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Mesh_polyhedron_3::type Polyhedron; +typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; + + +#ifdef CGAL_CONCURRENT_MESH_3 +typedef CGAL::Parallel_tag Concurrency_tag; +#else +typedef CGAL::Sequential_tag Concurrency_tag; +#endif + +// Triangulation +typedef CGAL::Mesh_triangulation_3::type Tr; + +typedef CGAL::Mesh_complex_3_in_triangulation_3< + Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3; + +// Criteria +typedef CGAL::Mesh_criteria_3 Mesh_criteria; + +// To avoid verbose function and named parameters call +using namespace CGAL::parameters; + +int main() +{ + // Create domain + Mesh_domain domain("data/cube.off"); + + // Get sharp features + domain.detect_features(); + + // Mesh criteria + Mesh_criteria criteria(edge_size = 0.3, + facet_angle = 25, facet_size = 0.3, facet_distance = 0.1, + cell_radius_edge_ratio = 3, cell_size = 0.3); + + // Mesh generation + C3t3 c3t3 = CGAL::make_mesh_3(domain, criteria); + + // Output + std::ofstream medit_file("out.mesh"); + c3t3.output_to_medit(medit_file); +} diff --git a/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp b/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp index 877ea4ed865..687ebefc478 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_determinism.cpp @@ -10,11 +10,13 @@ #include #include +#include #include #include // Domain typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Mesh_polyhedron_3::type Polyhedron; typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; // Triangulation @@ -39,7 +41,10 @@ int main(int, char*[]) // Domain std::cout << "\tSeed is\t 0" << std::endl; - Mesh_domain domain("data/cube.off"); + std::ifstream input("data/cube.off"); + Polyhedron polyhedron; + input >> polyhedron; + Mesh_domain domain(polyhedron); //no random generator is given, so CGAL::Random(0) is used // Get sharp features diff --git a/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp b/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp index b543d20e6fc..43c372cf6ed 100644 --- a/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp +++ b/Mesh_3/test/Mesh_3/test_meshing_polyhedron_with_features.cpp @@ -29,12 +29,15 @@ #include #include +#include + template struct Polyhedron_with_features_tester : public Tester { void operator()() const { typedef CGAL::Mesh_3::Robust_intersection_traits_3 Gt; + typedef typename CGAL::Mesh_polyhedron_3::type Polyhedron; typedef CGAL::Polyhedral_mesh_domain_with_features_3 Mesh_domain; typedef typename CGAL::Mesh_triangulation_3< @@ -56,7 +59,10 @@ struct Polyhedron_with_features_tester : public Tester //------------------------------------------------------- std::cout << "\tSeed is\t" << CGAL::get_default_random().get_seed() << std::endl; - Mesh_domain domain("data/cube.off", &CGAL::get_default_random()); + std::ifstream input("data/cube.off"); + Polyhedron polyhedron; + input >> polyhedron; + Mesh_domain domain(polyhedron, &CGAL::get_default_random()); domain.detect_features(); // Set mesh criteria