Bug with dD Triangulation stream operators?

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

Bug with dD Triangulation stream operators?

Shabi Ma
I wrote a trivial program that initializes a dD triangulation, writes the
triangulation to a file using the given overloaded operator<<, and then
tries to read the file into the triangulation using operator>>.

I noticed that the operator<< works fine, but operator>> ends up giving a
long list of template substitution errors due to the line at
Triangulation_vertex.h:116 at "is >> v.point();". I think it might have to
do with the fact that v.point() in that line returns a const reference.
However, after I removed it, it still reports an error.

There does not seem to be any problem when I initialize the 3D or 2D
triangulation however.

Is this a small oversight in the dD triangulation? How can I circumvent it?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: Bug with dD Triangulation stream operators?

Sebastien Loriot (GeometryFactory)
Just a quick guess, are you using the same kernel for reading and writing?

Sebastien.

On 06/08/2018 04:06 AM, Shabi Ma wrote:

> I wrote a trivial program that initializes a dD triangulation, writes the
> triangulation to a file using the given overloaded operator<<, and then
> tries to read the file into the triangulation using operator>>.
>
> I noticed that the operator<< works fine, but operator>> ends up giving a
> long list of template substitution errors due to the line at
> Triangulation_vertex.h:116 at "is >> v.point();". I think it might have to
> do with the fact that v.point() in that line returns a const reference.
> However, after I removed it, it still reports an error.
>
> There does not seem to be any problem when I initialize the 3D or 2D
> triangulation however.
>
> Is this a small oversight in the dD triangulation? How can I circumvent it?
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

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


Reply | Threaded
Open this post in threaded view
|

Re: Bug with dD Triangulation stream operators?

Shabi Ma
I believe so (with the Epick_d kernel).

Here is the code for reference:

#include <fstream>

#define CGAL_EIGEN3_ENABLED

#include <CGAL/Epick_d.h>
#include <CGAL/Triangulation_vertex.h>
#include <CGAL/Triangulation_data_structure.h>
#include <CGAL/Delaunay_triangulation.h>

using namespace std;

template <unsigned int D>
using K = CGAL::Epick_d<CGAL::Dimension_tag&lt;D>>;
template <unsigned int D>
using Vb = CGAL::Triangulation_vertex<K&lt;D>,double>;
template <unsigned int D>
using Tds =
CGAL::Triangulation_data_structure<CGAL::Dimension_tag&lt;D>,Vb<D>>;
template <unsigned int D>
using T = CGAL::Delaunay_triangulation<K&lt;D>, Tds<D>>;

int main(){
    T<4> test(4);
    std::ofstream out("test.txt");
    out << test;
    std::ifstream in("test.txt");
    in >> test;
    return 0;
}

The errors are a long list of template substitution errors, ending with this
one:

/usr/include/CGAL/Triangulation_vertex.h:116:8: note:   types
‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘const Point {aka
const CGAL::Wrap::Point_d<CGAL::Epick_d&lt;CGAL::Dimension_tag&lt;3> > >}’
have incompatible cv-qualifiers
     is >> v.point();




--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: Bug with dD Triangulation stream operators?

Sebastien Loriot (GeometryFactory)
Did you try out.close() before reading the file again?

On 06/12/2018 07:27 PM, Shabi Ma wrote:

> I believe so (with the Epick_d kernel).
>
> Here is the code for reference:
>
> #include <fstream>
>
> #define CGAL_EIGEN3_ENABLED
>
> #include <CGAL/Epick_d.h>
> #include <CGAL/Triangulation_vertex.h>
> #include <CGAL/Triangulation_data_structure.h>
> #include <CGAL/Delaunay_triangulation.h>
>
> using namespace std;
>
> template <unsigned int D>
> using K = CGAL::Epick_d<CGAL::Dimension_tag&lt;D>>;
> template <unsigned int D>
> using Vb = CGAL::Triangulation_vertex<K&lt;D>,double>;
> template <unsigned int D>
> using Tds =
> CGAL::Triangulation_data_structure<CGAL::Dimension_tag&lt;D>,Vb<D>>;
> template <unsigned int D>
> using T = CGAL::Delaunay_triangulation<K&lt;D>, Tds<D>>;
>
> int main(){
>      T<4> test(4);
>      std::ofstream out("test.txt");
>      out << test;
>      std::ifstream in("test.txt");
>      in >> test;
>      return 0;
> }
>
> The errors are a long list of template substitution errors, ending with this
> one:
>
> /usr/include/CGAL/Triangulation_vertex.h:116:8: note:   types
> ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘const Point {aka
> const CGAL::Wrap::Point_d<CGAL::Epick_d&lt;CGAL::Dimension_tag&lt;3> > >}’
> have incompatible cv-qualifiers
>       is >> v.point();
>
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

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


Reply | Threaded
Open this post in threaded view
|

Re: Bug with dD Triangulation stream operators?

Sebastien Loriot (GeometryFactory)
In reply to this post by Shabi Ma
Sorry I miss that it was a compilation issue.
It is a bug in CGAL. The fix is here:

https://github.com/CGAL/cgal/pull/3172

Sebastien.

On 06/12/2018 07:27 PM, Shabi Ma wrote:

> I believe so (with the Epick_d kernel).
>
> Here is the code for reference:
>
> #include <fstream>
>
> #define CGAL_EIGEN3_ENABLED
>
> #include <CGAL/Epick_d.h>
> #include <CGAL/Triangulation_vertex.h>
> #include <CGAL/Triangulation_data_structure.h>
> #include <CGAL/Delaunay_triangulation.h>
>
> using namespace std;
>
> template <unsigned int D>
> using K = CGAL::Epick_d<CGAL::Dimension_tag&lt;D>>;
> template <unsigned int D>
> using Vb = CGAL::Triangulation_vertex<K&lt;D>,double>;
> template <unsigned int D>
> using Tds =
> CGAL::Triangulation_data_structure<CGAL::Dimension_tag&lt;D>,Vb<D>>;
> template <unsigned int D>
> using T = CGAL::Delaunay_triangulation<K&lt;D>, Tds<D>>;
>
> int main(){
>      T<4> test(4);
>      std::ofstream out("test.txt");
>      out << test;
>      std::ifstream in("test.txt");
>      in >> test;
>      return 0;
> }
>
> The errors are a long list of template substitution errors, ending with this
> one:
>
> /usr/include/CGAL/Triangulation_vertex.h:116:8: note:   types
> ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘const Point {aka
> const CGAL::Wrap::Point_d<CGAL::Epick_d&lt;CGAL::Dimension_tag&lt;3> > >}’
> have incompatible cv-qualifiers
>       is >> v.point();
>
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

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