From b29fdaeddff34ec9bb22c03f85284df7960b1589 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 25 Mar 2013 09:37:16 +0100 Subject: [PATCH] don't use GMP if it is not installed --- Nef_3/include/CGAL/OFF_to_nef_3.h | 20 +++--- .../Nef_3/Nef_3_problematic_construction.cpp | 61 ++++++------------- 2 files changed, 29 insertions(+), 52 deletions(-) diff --git a/Nef_3/include/CGAL/OFF_to_nef_3.h b/Nef_3/include/CGAL/OFF_to_nef_3.h index f2d562ed0e4..62509d80f47 100644 --- a/Nef_3/include/CGAL/OFF_to_nef_3.h +++ b/Nef_3/include/CGAL/OFF_to_nef_3.h @@ -23,26 +23,26 @@ #include + + // --- begin preliminary number type converter ----------------- #ifndef CGAL_NUMBER_TYPE_CONVERTER_NEF_3_H #define CGAL_NUMBER_TYPE_CONVERTER_NEF_3_H #include -#include -#include +#include #include #include #include #include -#ifdef CGAL_USE_LEDA -#include -#include -#endif // CGAL_USE_LEDA - namespace CGAL { + +typedef CGAL::Arithmetic_kernel::Integer Integer; +typedef CGAL::Arithmetic_kernel::Rational Rational; + class Homogeneous_tag; class Cartesian_tag; template class number_type_converter_nef_3; @@ -56,10 +56,10 @@ class number_type_converter_nef_3 { typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::RT RT; - CGAL::Gmpq x(d.x()), y(d.y()), z(d.z()); + Rational x(d.x()), y(d.y()), z(d.z()); - CGAL::Homogeneous::Point_3 b = - normalized ( CGAL::Homogeneous::Point_3 ( + CGAL::Homogeneous::Point_3 b = + normalized ( CGAL::Homogeneous::Point_3 ( x.numerator() * y.denominator() * z.denominator(), x.denominator() * y.numerator() * z.denominator(), x.denominator() * y.denominator() * z.numerator(), diff --git a/Nef_3/test/Nef_3/Nef_3_problematic_construction.cpp b/Nef_3/test/Nef_3/Nef_3_problematic_construction.cpp index 0aa9ba3ecad..1b88a1ac2d9 100644 --- a/Nef_3/test/Nef_3/Nef_3_problematic_construction.cpp +++ b/Nef_3/test/Nef_3/Nef_3_problematic_construction.cpp @@ -28,23 +28,9 @@ #define CGAL_NEF3_SORT_OUTPUT 1 -#include -#include -#include +#include #include #include -typedef CGAL::Gmpz NT; -typedef CGAL::Gmpq FNT; -typedef CGAL::Quotient FNT2; - -#ifdef CGAL_USE_LEDA -#include -#include -typedef leda_integer LNT; -typedef leda_rational LFNT; -typedef CGAL::Quotient LFNT2; -#endif - #include #include #include @@ -52,6 +38,11 @@ typedef CGAL::Quotient LFNT2; #include #include + +typedef CGAL::Arithmetic_kernel::Integer NT; +typedef CGAL::Arithmetic_kernel::Rational FNT; + + template class test { @@ -135,36 +126,22 @@ int main() { CGAL::Timer t; t.start(); -#ifndef CGAL_USE_LEDA - { typedef CGAL::Homogeneous H_kernel; - typedef CGAL::Cartesian C_kernel; - // typedef CGAL::Cartesian Q_kernel; +#if defined( CGAL_USE_LEDA ) || defined ( CGAL_USE_GMP ) + typedef CGAL::Homogeneous H_kernel; + typedef CGAL::Cartesian C_kernel; + + test test_H; + test test_C; - test test_H; - test test_C; - // test test_Q; - - test_H.run_test(true,".H"); - test_C.run_test(false,".C"); - // test_Q.run_test(); - } - -#else - { typedef CGAL::Homogeneous LH_kernel; - typedef CGAL::Cartesian LC_kernel; - // typedef CGAL::Cartesian LQ_kernel; - - test test_LH; - test test_LC; - // test test_LQ; - - test_LH.run_test(true,".H"); - test_LC.run_test(false,".LC"); - // test_LQ.run_test(); - } + test_H.run_test(true,".H"); +# ifdef CGAL_USE_GMP + test_C.run_test(false,".C"); +# else + test_C.run_test(false,".LC"); +# endif #endif - t.stop(); std::cout << "Time " << t.time() << std::endl; + return 0; }