Merge pull request #8103 from sloriot/CGAL-exact_backend_checks

Improve information on exact nt backend
This commit is contained in:
Laurent Rineau 2024-04-05 14:25:08 +02:00
commit 568bacad91
3 changed files with 60 additions and 0 deletions

View File

@ -317,6 +317,25 @@ template < typename ET >
struct Exact_type_selector : Exact_field_selector< ET > {};
#endif
constexpr const char* exact_nt_backend_string()
{
switch(Default_exact_nt_backend)
{
case GMP_BACKEND:
return "GMP_BACKEND";
case GMPXX_BACKEND:
return "GMPXX_BACKEND";
case BOOST_GMP_BACKEND:
return "BOOST_GMP_BACKEND";
case BOOST_BACKEND:
return "BOOST_BACKEND";
case LEDA_BACKEND:
return "LEDA_BACKEND";
default:
return "MP_FLOAT_BACKEND";
}
}
} } // namespace CGAL::internal
#undef CGAL_EXACT_SELECTORS_SPECS

View File

@ -61,6 +61,7 @@ create_single_source_cgal_program("unsigned.cpp")
create_single_source_cgal_program("utilities.cpp")
create_single_source_cgal_program("Exact_rational.cpp")
create_single_source_cgal_program("Mpzf_new.cpp")
create_single_source_cgal_program("check_exact_backend.cpp")
if( CGAL_Core_FOUND )
create_single_source_cgal_program( "CORE_Expr_ticket_4296.cpp" )

View File

@ -0,0 +1,40 @@
#include <CGAL/config.h>
#include <CGAL/Exact_integer.h>
#include <CGAL/Exact_rational.h>
#include <type_traits>
using namespace CGAL::internal;
int main()
{
static_assert(
#ifdef CGAL_USE_GMP
( Default_exact_nt_backend!=GMP_BACKEND || (std::is_same_v<CGAL::Exact_integer,CGAL::Gmpz> && std::is_same_v<CGAL::Exact_rational,CGAL::Gmpq>) ) &&
#endif
#ifdef CGAL_USE_GMPXX
( Default_exact_nt_backend!=GMPXX_BACKEND || (std::is_same_v<CGAL::Exact_integer,mpz_class> && std::is_same_v<CGAL::Exact_rational,mpq_class>) ) &&
#endif
#if defined(CGAL_USE_BOOST_MP) && defined(CGAL_USE_GMP)
( Default_exact_nt_backend!=BOOST_GMP_BACKEND || (std::is_same_v<CGAL::Exact_integer,boost::multiprecision::mpz_int> && std::is_same_v<CGAL::Exact_rational,boost::multiprecision::mpq_rational>) ) &&
#endif
#if defined(CGAL_USE_BOOST_MP)
( Default_exact_nt_backend!=BOOST_BACKEND || (std::is_same_v<CGAL::Exact_integer,boost::multiprecision::cpp_int> && std::is_same_v<CGAL::Exact_rational,boost::multiprecision::cpp_rational>) ) &&
#endif
#if defined(CGAL_USE_LEDA)
( Default_exact_nt_backend!=LEDA_BACKEND || (std::is_same_v<CGAL::Exact_integer,leda_integer> && std::is_same_v<CGAL::Exact_rational,leda_rational>) ) &&
#endif
( Default_exact_nt_backend!=MP_FLOAT_BACKEND || (std::is_same_v<CGAL::Exact_integer,CGAL::MP_Float> && std::is_same_v<CGAL::Exact_rational,CGAL::Quotient<CGAL::MP_Float>>) )
);
std::cout << "Exact backend is " << exact_nt_backend_string() << "\n";
#ifdef CGAL_USE_CORE
#ifdef CGAL_CORE_USE_GMP_BACKEND
std::cout << "CGAL_CORE_USE_GMP_BACKEND is defined, using gmp backend in BigInt and BigRat\n";
#else
std::cout << "CGAL_CORE_USE_GMP_BACKEND is NOT defined, using boost-mp backend in BigInt and BigRat\n";
#endif
#else
std::cout << "CGAL_USE_CORE is not defined\n";
#endif
}