I’m attempting to following the http://www.boost.org/doc/libs/1_53_0_beta1/libs/polygon/doc/voronoi_advanced_tutorial.htm

to compile boost::polygon::voronoi using 64 bit integer input. I’m using the boost::multiprecision library to do so.

Using boost version 1.53 and Microsoft Visual Studio 2012.

 

The error message is:

1>d:\workspace\movingboundary\boost_1_53_0\boost\polygon\detail\voronoi_robust_fpt.hpp(60): error C2665: 'sqrt' : none of the 3 overloads could convert all the argument types

1>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\math.h(588): could be 'long double sqrt(long double)'

1>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\math.h(540): or       'float sqrt(float)'

1>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\math.h(127): or       'double sqrt(double)'

1>          while trying to match the argument list '(const boost::multiprecision::detail::expression<tag,Arg1,Arg2,Arg3,Arg4>)'

1>          with

1>          [

1>              tag=boost::multiprecision::detail::multiplies,

1>              Arg1=boost::multiprecision::detail::expression<boost::multiprecision::detail::multiplies,boost::multiprecision::detail::expression<boost::multiprecision::detail::plus,boost::multiprecision::detail::expression<boost::multiprecision::detail::multiply_immediates,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,void,void>,boost::multiprecision::detail::expression<boost::multiprecision::detail::multiply_immediates,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,void,void>,void,void>,boost::multiprecision::detail::expression<boost::multiprecision::detail::plus,boost::multiprecision::detail::expression<boost::multiprecision::detail::multiply_immediates,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,void,void>,boost::multiprecision::detail::expression<boost::multiprecision::detail::multiply_immediates,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,void,void>,void,void>,void,void>,

1>              Arg2=boost::multiprecision::detail::expression<boost::multiprecision::detail::plus,boost::multiprecision::detail::expression<boost::multiprecision::detail::multiply_immediates,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,void,void>,boost::multiprecision::detail::expression<boost::multiprecision::detail::multiply_immediates,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<48>>,void,void>,void,void>,

1>              Arg3=void,

1>              Arg4=void

 

== reference line is

template <typename T>

T get_sqrt(const T& that) {

  return (std::sqrt)(that); //ß line 60

}

 

== code ==

 

#pragma warning (disable: 4996 4267)

#include <cmath>

#include <boost/multiprecision/cpp_int.hpp>

#include <boost/multiprecision/cpp_dec_float.hpp>

#include <boost/polygon/voronoi.hpp>

 

#include <limits>

#include <gtest/gtest.h>

 

#include <iostream>

using namespace boost::polygon;

 

namespace vcellVoronoiImpl {

    typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<48>> floatingType;

 

    struct FloatingConverter {

        template <typename T>

        floatingType operator( )(T x)  const {

            return static_cast<floatingType>(x);

        }

    };

 

    struct compareFloatingType {

        enum Result {

            LESS = -1,

            EQUAL = 0,

            MORE = 1

        };

 

        Result operator()(floatingType a, floatingType b, unsigned int maxUlps) const {

            if (a > b) {

                return a - b <= maxUlps ? EQUAL : LESS;

            }

            return b - a  <= maxUlps ? EQUAL : MORE;

        }

    };

 

    struct voronoi_ctype_traits {

        typedef boost::int64_t int_type;

        typedef boost::multiprecision::int128_t int_x2_type;

        typedef boost::multiprecision::uint128_t uint_x2_type;

        typedef boost::multiprecision::int512_t big_int_type;

        typedef floatingType fpt_type;

        typedef floatingType efpt_type;

        typedef compareFloatingType ulp_cmp_type;

        typedef FloatingConverter to_fpt_converter_type;

        typedef FloatingConverter to_efpt_converter_type;

    };

 

    struct vcell_vd_traits{

        typedef voronoi_ctype_traits::fpt_type coordinate_type;

        typedef voronoi_cell<coordinate_type> cell_type;

        typedef voronoi_vertex<coordinate_type> vertex_type;

        typedef voronoi_edge<coordinate_type> edge_type;

        typedef struct {

        public:

            enum { ULPS = 128 };

            bool operator()(const vertex_type &v1, const vertex_type &v2) const {

                return (ulp_cmp(v1.x(), v2.x(), ULPS) == compareFloatingType::EQUAL &&

                    ulp_cmp(v1.y(), v2.y(), ULPS) == compareFloatingType::EQUAL);

            }

        private:

            compareFloatingType ulp_cmp;

        } vertex_equality_predicate_type;

 

 

    };

}

 

using namespace vcellVoronoiImpl;

 

TEST(highv,build) {

    voronoi_builder<boost::int64_t, vcellVoronoiImpl::voronoi_ctype_traits> vb;

    voronoi_diagram<boost::int64_t,vcell_vd_traits> vd;

    vb.construct(&vd);

}

 

 

 

Gerard Weatherby

Appllication Architect

Virtual Cell, Center for Cell Analysis and Modeling (CCAM)

University of Connecticut Health Center

860-679-2065