CGAL Update from 4.13 to 5.5

Viewed 46

I have updated a project using CGAL 4.13 to CGAL 5.5. It uses the kernel:

typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::FT dbl;

and some functions do not compile now anymore. For example the one below:

inline void decouple(const dbl& val,dbl& decoupled)
{
   ...
   decoupled=CGAL::Gmpq(val.exact().mpq());
}

../geometricTools.h:476:50: error: 'const ET' {aka 'const class boost::multiprecision::numberboost::multiprecision::backends::gmp_rational'} has no member named 'mpq' 476 |
decoupled=CGAL::Gmpq(val.exact().mpq());

A second problem is a line wher e a string ("123/456") is converted to a number:

dbl AlgorithmHdf5::getDbl(int n, int d)
{
...
    dbl ret(m_vDbl[ind]); // argument is a std::string
    return ret;
}

AlgorithmHdf5.cpp:71:36: error: no matching function for call to 'CGAL::Lazy_exact_ntboost::multiprecision::number<boost::multiprecision::backends::gmp_rational

::Lazy_exact_nt(__gnu_cxx::__alloc_traitsstd::allocator<std::__cxx11::basic_string<char , std::__cxx11::basic_string >::value_type&)' 71 | dbl ret(m_vDbl[ind]);

these lines used to work with CGAL 4.13 but do not with CGAL 5.5. I'd appreciate any help on this. Compiler: g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0

1 Answers

Epeck::FT is a wrapper around some rational type that depends on what is available. If you have GMPXX or LEDA, it may use that. In your case you have GMP and a recent enough Boost, so it uses Boost.Multiprecision. If you disable that with -DCGAL_DO_NOT_USE_BOOST_MP, you may get back to the Gmpq your old code was apparently expecting.

Boost.Multiprecision does not use reference counting, so decoupled=val.exact() should be sufficient for that type. To construct from std::string, it may help to first construct a FT::Exact_type (or CGAL::Exact_rational) and then convert that to FT. You may want to file an issue on github about this direct construction from a string, it looks like something that CGAL could support.

Related