mirror of https://github.com/CGAL/cgal
add a test for one_step() loop with features on tiny data
This commit is contained in:
parent
18dd164769
commit
5b004ffbe6
|
|
@ -0,0 +1,13 @@
|
|||
OFF
|
||||
5 4 0
|
||||
|
||||
-1 -1 1
|
||||
-1 1 1
|
||||
1 -1 -1
|
||||
-1 1 -1
|
||||
-1 -1 -1
|
||||
3 0 4 2
|
||||
3 2 4 3
|
||||
3 4 0 1
|
||||
3 1 3 4
|
||||
|
||||
|
|
@ -53,6 +53,7 @@ create_single_source_cgal_program( "test_meshing_without_features_determinism.cp
|
|||
create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" )
|
||||
create_single_source_cgal_program( "test_mesh_polyhedral_domain_with_features_deprecated.cpp" )
|
||||
create_single_source_cgal_program( "test_meshing_with_one_step.cpp" )
|
||||
create_single_source_cgal_program( "test_meshing_with_one_step_with_features.cpp" )
|
||||
create_single_source_cgal_program( "test_mesh_cell_base_3.cpp")
|
||||
create_single_source_cgal_program( "test_min_edge_length.cpp")
|
||||
|
||||
|
|
@ -85,6 +86,7 @@ foreach(target
|
|||
test_mesh_polyhedral_domain_with_features_deprecated
|
||||
test_mesh_cell_base_3
|
||||
test_meshing_with_one_step
|
||||
test_meshing_with_one_step_with_features
|
||||
test_min_edge_length
|
||||
test_min_size_criteria
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/Mesh_triangulation_3.h>
|
||||
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
|
||||
#include <CGAL/Mesh_criteria_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
|
||||
#include <CGAL/make_mesh_3.h>
|
||||
#include <CGAL/refine_mesh_3.h>
|
||||
|
||||
// Domain
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Surface_mesh<K::Point_3> Polyhedron;
|
||||
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K, Polyhedron> Mesh_domain;
|
||||
|
||||
typedef CGAL::Sequential_tag Concurrency_tag;
|
||||
|
||||
// Triangulation
|
||||
typedef CGAL::Mesh_triangulation_3<Mesh_domain,
|
||||
CGAL::Default,
|
||||
Concurrency_tag>::type Tr;
|
||||
|
||||
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
|
||||
|
||||
// Criteria
|
||||
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
|
||||
|
||||
typedef CGAL::Mesh_3::Mesher_3<C3t3,
|
||||
Mesh_criteria,
|
||||
Mesh_domain> Mesher;
|
||||
|
||||
// To avoid verbose function and named parameters call
|
||||
using namespace CGAL::parameters;
|
||||
|
||||
int main(int argc, char*argv[])
|
||||
{
|
||||
const std::string fname = CGAL::data_file_path("meshes/halfcube.off");
|
||||
// Create input polyhedron
|
||||
Polyhedron polyhedron;
|
||||
std::ifstream input(fname);
|
||||
input >> polyhedron;
|
||||
if(input.fail()){
|
||||
std::cerr << "Error: Cannot read file " << fname << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
input.close();
|
||||
|
||||
if (!CGAL::is_triangle_mesh(polyhedron)){
|
||||
std::cerr << "Input geometry is not triangulated." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Create domain
|
||||
|
||||
std::vector<Polyhedron*> polyhedra;
|
||||
polyhedra.push_back(&polyhedron);
|
||||
|
||||
Mesh_domain domain(polyhedra.begin(), polyhedra.end());
|
||||
domain.detect_features();
|
||||
|
||||
// Mesh criteria (no cell_size set)
|
||||
Mesh_criteria criteria(facet_angle = 25,
|
||||
facet_size = 0.17,
|
||||
facet_distance = 0.017,
|
||||
edge_size = 0.17);
|
||||
|
||||
// Mesh generation
|
||||
namespace p = CGAL::parameters;
|
||||
C3t3 c3t3;
|
||||
CGAL::Mesh_3::internal::C3t3_initializer<C3t3,
|
||||
Mesh_domain,
|
||||
Mesh_criteria,
|
||||
true>()(c3t3, domain, criteria, true);
|
||||
|
||||
Mesher mesher(c3t3, domain, criteria, CGAL::FACET_VERTICES_ON_SURFACE);
|
||||
mesher.initialize();
|
||||
mesher.display_number_of_bad_elements();
|
||||
while ( ! mesher.is_algorithm_done() ) mesher.one_step();
|
||||
assert(c3t3.triangulation().number_of_vertices() > 200);
|
||||
|
||||
// Output
|
||||
mesher.display_number_of_bad_elements();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Loading…
Reference in New Issue