CGAL circulator operator* runtime error - segmenation fault

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CGAL circulator operator* runtime error - segmenation fault

mparusinski
Hi everyone,

I am having some trouble with CGAL circulators. I am stuck with an akward segmentation fault. The gdb debugger informs that * operator fails to work. But it doesn't happen systematically. The code usually manages to perform a few iterations. Any ideas on what could be wrong or any advice on how to use circulators? (I am using CGAL 3.6)

 if (circ == 0) {
    cerr << "ERROR: Unexpected error empty circulator" << endl;
    exit(-1);
  }
  Orientation minimun = none;
  Facet_circulator origin(circ);
  do {
    // operator * fails
    // Valgrind -> "Invalid read of size 8" Compact_container.h:808 operator*() const
    if (circ == 0) {
      cerr << "ERROR: Unexpected empty circulator" << endl;
      exit(-1);
    }
    Facet adj_facet = *circ;
    // Make sure adjacent facet is a surface facet
    map<Facet, int>::iterator iter = f_map.find(adj_facet);
    if (iter != f_map.end()){
      int adj_facet_pos = iter->second;
      Orientation dir = orientations[adj_facet_pos];
      minimun =  dir < minimun ? dir : minimun;
    }
  } while (++circ != origin);

Michal Parusinski
Reply | Threaded
Open this post in threaded view
|

Re: CGAL circulator operator* runtime error - segmenation fault

Sylvain Pion
Administrator
Le 05/08/10 13:30, mparusinski a écrit :

>
> Hi everyone,
>
> I am having some trouble with CGAL circulators. I am stuck with an akward
> segmentation fault. The gdb debugger informs that * operator fails to work.
> But it doesn't happen systematically. The code usually manages to perform a
> few iterations. Any ideas on what could be wrong or any advice on how to use
> circulators? (I am using CGAL 3.6)
>
>   if (circ == 0) {
>      cerr<<  "ERROR: Unexpected error empty circulator"<<  endl;
>      exit(-1);
>    }
>    Orientation minimun = none;
>    Facet_circulator origin(circ);
>    do {
>      // operator * fails
>      // Valgrind ->  "Invalid read of size 8" Compact_container.h:808 operator*() const

Do you see this problem when running under valgrind ?
As mentioned recently in another mail, valgrind does not work
with (most of) CGAL.  Namely it kills some numerical computations
(because it does not support rounding modes), so the triangulation
computed can be severely buggy, and then circulators can go wrong.

Otherwise, I don't see anything wrong with your piece of code,
but you don't show much anyway.

>      if (circ == 0) {
>        cerr<<  "ERROR: Unexpected empty circulator"<<  endl;
>        exit(-1);
>      }
>      Facet adj_facet = *circ;
>      // Make sure adjacent facet is a surface facet
>      map<Facet, int>::iterator iter = f_map.find(adj_facet);
>      if (iter != f_map.end()){
>        int adj_facet_pos = iter->second;
>        Orientation dir = orientations[adj_facet_pos];
>        minimun =  dir<  minimun ? dir : minimun;
>      }
>    } while (++circ != origin);
>
> Michal Parusinski


--
Sylvain

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

Reply | Threaded
Open this post in threaded view
|

Re: CGAL circulator operator* runtime error - segmenation fault

mparusinski
No it doesn't work regardless of using valgrind or not!
But thanks anyway. I found another to solve my problem and it doesn't require the circulators anymore.

On 6 August 2010 14:04, Sylvain Pion <[hidden email]> wrote:
Le 05/08/10 13:30, mparusinski a écrit :


Hi everyone,

I am having some trouble with CGAL circulators. I am stuck with an akward
segmentation fault. The gdb debugger informs that * operator fails to work.
But it doesn't happen systematically. The code usually manages to perform a
few iterations. Any ideas on what could be wrong or any advice on how to use
circulators? (I am using CGAL 3.6)

 if (circ == 0) {
    cerr<<  "ERROR: Unexpected error empty circulator"<<  endl;
    exit(-1);
  }
  Orientation minimun = none;
  Facet_circulator origin(circ);
  do {
    // operator * fails
    // Valgrind ->  "Invalid read of size 8" Compact_container.h:808 operator*() const

Do you see this problem when running under valgrind ?
As mentioned recently in another mail, valgrind does not work
with (most of) CGAL.  Namely it kills some numerical computations
(because it does not support rounding modes), so the triangulation
computed can be severely buggy, and then circulators can go wrong.

Otherwise, I don't see anything wrong with your piece of code,
but you don't show much anyway.


    if (circ == 0) {
      cerr<<  "ERROR: Unexpected empty circulator"<<  endl;
      exit(-1);
    }
    Facet adj_facet = *circ;
    // Make sure adjacent facet is a surface facet
    map<Facet, int>::iterator iter = f_map.find(adj_facet);
    if (iter != f_map.end()){
      int adj_facet_pos = iter->second;
      Orientation dir = orientations[adj_facet_pos];
      minimun =  dir<  minimun ? dir : minimun;
    }
  } while (++circ != origin);

Michal Parusinski


--
Sylvain


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