don't use GMP if it is not installed

This commit is contained in:
Andreas Fabri 2013-03-25 09:37:16 +01:00
parent 069d618eb6
commit b29fdaeddf
2 changed files with 29 additions and 52 deletions

View File

@ -23,26 +23,26 @@
#include <CGAL/Nef_polyhedron_3.h>
// --- begin preliminary number type converter -----------------
#ifndef CGAL_NUMBER_TYPE_CONVERTER_NEF_3_H
#define CGAL_NUMBER_TYPE_CONVERTER_NEF_3_H
#include<sstream>
#include<CGAL/Gmpz.h>
#include<CGAL/Gmpq.h>
#include <CGAL/Arithmetic_kernel.h>
#include<CGAL/Cartesian.h>
#include<CGAL/Homogeneous.h>
#include<CGAL/Nef_S2/Normalizing.h>
#include<CGAL/Nef_nary_union_3.h>
#ifdef CGAL_USE_LEDA
#include<CGAL/leda_integer.h>
#include<CGAL/leda_rational.h>
#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<typename Tag, typename Kernel> class number_type_converter_nef_3;
@ -56,10 +56,10 @@ class number_type_converter_nef_3<Homogeneous_tag, Kernel> {
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<CGAL::Gmpz>::Point_3 b =
normalized ( CGAL::Homogeneous<CGAL::Gmpz>::Point_3 (
CGAL::Homogeneous<Integer>::Point_3 b =
normalized ( CGAL::Homogeneous<Integer>::Point_3 (
x.numerator() * y.denominator() * z.denominator(),
x.denominator() * y.numerator() * z.denominator(),
x.denominator() * y.denominator() * z.numerator(),

View File

@ -28,23 +28,9 @@
#define CGAL_NEF3_SORT_OUTPUT 1
#include <CGAL/Gmpz.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Quotient.h>
#include <CGAL/Arithmetic_kernel.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Homogeneous.h>
typedef CGAL::Gmpz NT;
typedef CGAL::Gmpq FNT;
typedef CGAL::Quotient<NT> FNT2;
#ifdef CGAL_USE_LEDA
#include <CGAL/leda_integer.h>
#include <CGAL/leda_rational.h>
typedef leda_integer LNT;
typedef leda_rational LFNT;
typedef CGAL::Quotient<LNT> LFNT2;
#endif
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <CGAL/OFF_to_nef_3.h>
@ -52,6 +38,11 @@ typedef CGAL::Quotient<LNT> LFNT2;
#include <fstream>
#include <cassert>
typedef CGAL::Arithmetic_kernel::Integer NT;
typedef CGAL::Arithmetic_kernel::Rational FNT;
template<typename Kernel>
class test {
@ -135,36 +126,22 @@ int main() {
CGAL::Timer t;
t.start();
#ifndef CGAL_USE_LEDA
{ typedef CGAL::Homogeneous<NT> H_kernel;
#if defined( CGAL_USE_LEDA ) || defined ( CGAL_USE_GMP )
typedef CGAL::Homogeneous<NT> H_kernel;
typedef CGAL::Cartesian<FNT> C_kernel;
// typedef CGAL::Cartesian<FNT2> Q_kernel;
test<H_kernel> test_H;
test<C_kernel> test_C;
// test<Q_kernel> test_Q;
test_H.run_test(true,".H");
# ifdef CGAL_USE_GMP
test_C.run_test(false,".C");
// test_Q.run_test();
}
#else
{ typedef CGAL::Homogeneous<LNT> LH_kernel;
typedef CGAL::Cartesian<LFNT> LC_kernel;
// typedef CGAL::Cartesian<LFNT2> LQ_kernel;
test<LH_kernel> test_LH;
test<LC_kernel> test_LC;
// test<LQ_kernel> test_LQ;
test_LH.run_test(true,".H");
test_LC.run_test(false,".LC");
// test_LQ.run_test();
}
# else
test_C.run_test(false,".LC");
# endif
#endif
t.stop();
std::cout << "Time " << t.time() << std::endl;
return 0;
}