Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Why is my OFF file producing segmentation fault for polyhedron generation ?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Why is my OFF file producing segmentation fault for polyhedron generation ?


Chronological Thread 
  • From: Timothée Nicolas <>
  • To:
  • Subject: Re: [cgal-discuss] Why is my OFF file producing segmentation fault for polyhedron generation ?
  • Date: Thu, 14 Apr 2016 21:33:02 +0900
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:XhqBLhMrQCYpLlJWAb0l6mtUPXoX/o7sNwtQ0KIMzox0Kfn9rarrMEGX3/hxlliBBdydsKIUzbeI+Py8EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35Txir75p8GbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/NGSrjwKqQkUaRDXnNhKHEw/MSttB/ZTALJ6GFbSXQTihMPAg7L61bxUZ719yf7reFgwzLJAMvtULphWSi+97w5D1jzmSIfPng49nvWg4p+luVAsRe5rlt+xYDTJ4qaPf47cqLGds4BXjl9WZNaWCVFR4+9dIASFPEpPOBCroC7qUFdgwG5AFyQBebo1j/Ji0jQ3KY91+06WVXa3QknA9IDvTLSrd7yMK4Jee+wxajMiz7EaqUFin/G9IHUf0V58rm3VrVqfJ+JxA==

I have attached the file I am using. This is exactly the same file as was provided with the package, there is not a coma of change. I believe it does use Polyhedral_mesh_domain constructor, if m understanding is correct. I compile it (along with the other files in CGAL-4.7/examples/Mesh_3) with 

cmake .
make

I replace the original data/elephant.off with my own .off file, so now data/elephant.off contains

OFF
5 6 0

0.0 0.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
0.0 1.0 0.0
0.5 0.5 1.0
3 2 1 0
3 3 2 0
3 0 1 4
3 1 2 4
3 2 3 4
3 3 0 4

(also attached)

Then I simply do
./mesh_polyhedral_domain

And even when I add the #define CGAL_MESH_3_VERBOSE line at the beginning, the only output I get is

Erreur de segmentation (core dumped)

Instead, with the original file, I obtain the following quite long output:

construct initial points:
8/8 initial point(s) found...
Start surface scan...Scanning triangulation for bad facets (sequential) - number of finite facets = 26...
Number of bad facets: 12
end scan. [Bad facets:12]

Refining Surface...
Legend of the following line: (#vertices,#steps,#facets to refine,#tets to refine)
(754,745,0,0) (10039.3 vertices/s))
Total refining surface time: 0.074208s

Start volume scan...Scanning triangulation for bad cells (sequential)... 4725 cells scanned, done.
Number of bad cells: 31
end scan. [Bad tets:31]

Refining...
Legend of the following line: (#vertices,#steps,#facets to refine,#tets to refine)
(760,5,0,0) (13812.2 vertices/s)
Total refining volume time: 0.000374s
Total refining time: 0.077584s

Start surface scan...Scanning triangulation for bad facets (sequential) - number of finite facets = 9517...
Number of bad facets: 0
end scan. [Bad facets:0]

Refining Surface...
Legend of the following line: (#vertices,#steps,#facets to refine,#tets to refine)
(760,0,0,0)
Total refining surface time: 0s

Start volume scan...Scanning triangulation for bad cells (sequential)... 4708 cells scanned, done.
Number of bad cells: 1271
end scan. [Bad tets:1271]

Refining...
Legend of the following line: (#vertices,#steps,#facets to refine,#tets to refine)
(1912,1589,0,0) (18002.2 vertices/s))))
Total refining volume time: 0.088267s
Total refining time: 0.111051s

Running sliver perturbation...
Legend of the following line: (#vertices in pqueue, #iterations, #fails)
bound 12: (0,41,0) (479.9 iteration/s))
Total perturbation time: 0.085439s
Perturbation statistics:
Sq radius gradient perturbation: 93.0769% (121 in 58ms)
Volume gradient perturbation: 3.07692% (4 in 6ms)
Dihedral angle gradient perturbation: 3.07692% (4 in 5ms)
Li random perturbation [100, 0.15, in]: 0.769231% (1 in 0ms)
Perturbation return code: BOUND_REACHED

Exuding...
Legend of the following line: (#cells left,#vertices pumped,#vertices ignored)
(6550,238,4087) (36781.1 vertices/s)
Total exuding time: 0.111117s
Exuding return code: TIME_LIMIT_REACHED





2016-04-14 21:05 GMT+09:00 Jane Tournois <>:
Can you please send us your command line, and the complete log, until "Segmentation fault" happens?

Are you using the Polyhedral_mesh_domain constructor that takes a filename as parameter?



Le 14/04/2016 13:52, Timothée Nicolas a écrit :
Good question.

I am using CGAL-4.7

2016-04-14 20:49 GMT+09:00 Andreas Fabri <>:

Are you both sure to use the same releases of CGAL?

andreas


On 14/04/2016 13:48, Timothée Nicolas wrote:
Thank you for your answer.

So you say you were able to produce a valid out.mesh file with the .off
file I suggested ?

I just checked on my Ubuntu computer, and it does the same as this
afternoon at work on a Mac OS X. The error message here is

Erreur de segmentation (core dumped)

If I remember correctly, on the mac, it was something like

Segmentation fault:11

I have added the verbose line you sent me, and it does not tell me
anything else...

Timothée

2016-04-14 19:45 GMT+09:00 Jane Tournois
<
<mailto:>>:


    Hi Timothee,

    I could not reproduce your seg fault.

    You can try to add the following macro definition on the very first
    line of your cpp file :
    #define CGAL_MESH_3_VERBOSE

    and then post the execution log?

    This could help you or us find the error.


    Also, you mention an "error message". What does it say ?

    Best,

    Jane.

    --
    Jane Tournois, PhD
    R&D Engineer at GeometryFactory
    http://www.geometryfactory.com/





    Le 14/04/2016 10:18, Timothée Nicolas a écrit :

        Dear all,

        I am trying to produce a 3D tetrahedral mesh from a boundary
        surface mesh. I
        figured that the easiest way to do this was to use a .OFF file of my
        boundary, which does not seem too difficult to produce, and feed
        it directly
        to this example program

        http://doc.cgal.org/latest/Mesh_3/Mesh_3_2mesh_polyhedral_domain_8cpp-example.html

        Before taking on my actual boundary surface mesh, I need to
        understand
        exactly what I am doing, so I tried replacing the file
        elephant.off with the
        following simple .off file representing a pyramid

        OFF
        5 6 0

        0.0 0.0 0.0
        1.0 0.0 0.0
        1.0 1.0 0.0
        0.0 1.0 0.0
        0.5 0.5 1.0
        3 2 1 0
        3 3 2 0
        3 0 1 4
        3 1 2 4
        3 2 3 4
        3 3 0 4

        Unfortunately this produces a segmentation fault when making the
        mesh. I
        have no idea what causes it to malfunction. Anyone has a clue ?
        I have also
        tried with a simple tetrahedron or a cube with each face cut
        into two
        triangles, same error message.

        Best

        Timothee



    --
    You are currently subscribed to cgal-discuss.
    To unsubscribe or access the archives, go to
    https://sympa.inria.fr/sympa/info/cgal-discuss




--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project

phone: +33.492.954.912    skype: andreas.fabri


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss




-- 
Jane Tournois, PhD
R&D Engineer at GeometryFactory
http://www.geometryfactory.com/

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

// IO
#include <CGAL/IO/Polyhedron_iostream.h>

// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::Polyhedral_mesh_domain_3<Polyhedron, K> Mesh_domain;

// Triangulation
#ifdef CGAL_CONCURRENT_MESH_3
  typedef CGAL::Mesh_triangulation_3<
    Mesh_domain,
    CGAL::Kernel_traits<Mesh_domain>::Kernel, // Same as sequential
    CGAL::Parallel_tag                        // Tag to activate parallelism
  >::type Tr;
#else
  typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
#endif
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> 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 input polyhedron
  Polyhedron polyhedron;
  std::ifstream input("data/elephant.off");
  input >> polyhedron;
   
  // Create domain
  Mesh_domain domain(polyhedron);
  
  // Mesh criteria (no cell_size set)
  Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008,
                         cell_radius_edge_ratio=3);
  
  // Mesh generation
  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());

  // Output
  std::ofstream medit_file("out_1.mesh");
  c3t3.output_to_medit(medit_file);
  medit_file.close();

  // Set tetrahedron size (keep cell_radius_edge_ratio), ignore facets
  Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.03);

  // Mesh refinement
  CGAL::refine_mesh_3(c3t3, domain, new_criteria);

  // Output
  medit_file.open("out_2.mesh");
  c3t3.output_to_medit(medit_file);

  return 0;
}

Attachment: elephant.off
Description: Binary data




Archive powered by MHonArc 2.6.18.

Top of Page