Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] 3D mesh generation and gcc version/optimisation level

Subject: CGAL users discussion list

List archive

[cgal-discuss] 3D mesh generation and gcc version/optimisation level


Chronological Thread 
  • From: Garth Wells <>
  • To:
  • Subject: [cgal-discuss] 3D mesh generation and gcc version/optimisation level
  • Date: Tue, 7 Feb 2012 12:22:52 -0800 (PST)

I've been running into some issues with mesh generation in 3D. I'm creating
meshes of rather simple polyhedra (tetrahedra, cubes), but have been finding
that the generation randomly fails at times. I'm also seeing a dependency on
the gcc version and optimisation level. The code at the end of this message,
taken from


http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Mesh_3/Chapter_main.html#Subsection_50.3.5

runs without error with g++ 4.6.1, but with g++ 4.4.6 and the -O2 or -O3
flag I get the error

terminate called after throwing an instance of
'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: index != Subdomain_index()
File: /usr/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h
Line: 160
Aborted

I've tested with CGAL 3.8 and 3.9. The code is compiled using

g++ -O2 -frounding-math test.cpp -lCGAL -lboost_thread -lmpfr -lgmp

Any help with this would be greatly appreciated.

Garth




#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/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/make_mesh_3.h>

// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;

// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::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<Tr> Mesh_criteria;

// To avoid verbose function and named parameters call
using namespace CGAL::parameters;

int main()
{
// Create domain
Mesh_domain domain("fandisk.off");

// Get sharp features
domain.detect_features();

// Mesh criteria
Mesh_criteria criteria(edge_size = 0.025,
facet_angle = 25, facet_size = 0.05, facet_distance
= 0.005,
cell_radius_edge_ratio = 3, cell_size = 0.05);

// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
}

--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/3D-mesh-generation-and-gcc-version-optimisation-level-tp4366153p4366153.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page