Subject: CGAL users discussion list
List archive
- From: Benjamin Kehlet <>
- To: cgal-discuss <>
- Subject: [cgal-discuss] Mesh generator crash on certain criterias
- Date: Tue, 25 Mar 2014 13:45:24 +0100
Dear CGAL community
When attempting to generate tetrahedral meshes from polyhedral
domains, I sometimes experience program crashes. However, a very minor
change in the meshing may change this. So I wonder if there are any
preconditions related to the meshing criteria that I am violating? Or
if I am doing something else wrong.
The code below reproduces the problem (at least on my computer which
is 64 bit debian testing with gcc 4.8.2 and a debug build of CGAL
4.4-beta).
The program crashes with this message:
---
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
File:
/home/benjamik/software/cgal-4.4-install/include/CGAL/Mesh_3/Refine_facets_3.h
Line: 609
Explanation: Mesh_3 ERROR: A facet is not in conflict with its refinement
point!
Debugging informations:
Facet: (0x2384a08, 3) = (0 1 0 0.033749951974560002,
0.11277293612403594 0.77406573045858007 0.11316133341738403 0,
0.14285714285714285 0.85714285714285721 0 0.0043481882548937938)
Dual: Segment(-17252455614223 -17252455614222 -17252455614223 ,
0.072258906576809029 0.82649559070083445 0.069019099072440845)
Refinement point: 0.0032398075043681704 0.75747649162839448 0 0
Aborted
---
Here is the most minimal code I could come up with that reproduces the problem
---
#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;
typedef CGAL::Mesh_polyhedron_3<K>::type MeshPolyhedron_3;
typedef K::Point_3 Point_3;
// 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;
using namespace CGAL::parameters;
template<typename Builder>
void add_triangular_facet(Builder& builder, int v0, int v1, int v2)
{
builder.begin_facet();
builder.add_vertex_to_facet( v0 );
builder.add_vertex_to_facet( v1 );
builder.add_vertex_to_facet( v2 );
builder.end_facet();
}
struct TetrahedronBuilder
: public CGAL::Modifier_base<typename MeshPolyhedron_3::HalfedgeDS>
{
void operator()(typename MeshPolyhedron_3::HalfedgeDS& out_hds)
{
typedef typename MeshPolyhedron_3::HalfedgeDS Output_HDS;
CGAL::Polyhedron_incremental_builder_3<Output_HDS> builder(out_hds);
builder.begin_surface(4, 4);
builder.add_vertex(Point_3(0, 0, 0));
builder.add_vertex(Point_3(0, 0, 1));
builder.add_vertex(Point_3(0, 1, 0));
builder.add_vertex(Point_3(1, 0, 0));
add_triangular_facet(builder, 3, 1, 2);
add_triangular_facet(builder, 0, 1, 3);
add_triangular_facet(builder, 0, 3, 2);
add_triangular_facet(builder, 0, 2, 1);
builder.end_surface();
}
};
int main(int argc, char** argv)
{
MeshPolyhedron_3 P;
{
TetrahedronBuilder b;
P.delegate(b);
}
CGAL_assertion(P.is_valid());
// Create domain
Mesh_domain domain(P);
// Get sharp features
domain.detect_features();
// Mesh criteria
const double cs = 0.408248;
Mesh_criteria criteria(edge_size = cs/2.0,
facet_angle = 25,
facet_size = cs,
facet_distance = cs/10.0,
cell_radius_edge_ratio = 3,
cell_size = cs);
// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
}
---
I can not reproduce the problem on a 32 bit computer with Ubuntu 13.10
and gcc 4.8.1
Setting cs to .40825 on line 74 "fixes" the problem.
Thanks in advance!
Best regards
Benjamin Kehlet
- [cgal-discuss] Mesh generator crash on certain criterias, Benjamin Kehlet, 03/25/2014
- Re: [cgal-discuss] Mesh generator crash on certain criterias, Laurent Rineau (CGAL/GeometryFactory), 03/31/2014
- Re: [cgal-discuss] Mesh generator crash on certain criterias, Benjamin Kehlet, 03/31/2014
- Re: [cgal-discuss] Mesh generator crash on certain criterias, Laurent Rineau (CGAL/GeometryFactory), 03/31/2014
Archive powered by MHonArc 2.6.18.