Test lexicographic comparison.

Make kernel constructors more uniform.
This commit is contained in:
Marc Glisse 2012-08-23 11:50:46 +00:00
parent 18193f1298
commit e067f7fcdf
6 changed files with 90 additions and 30 deletions

View File

@ -10,21 +10,44 @@
namespace CGAL { namespace CGAL {
template<int d_> #define CGAL_BASE \
struct Epick_d_help1 Cartesian_filter_K< \
: Cartesian_filter_K< Cartesian_base_d<double, Dim>, \
Cartesian_base_d<double, Dimension_tag<d_> >, Cartesian_base_d<Interval_nt_advanced, Dim>, \
Cartesian_base_d<Interval_nt_advanced, Dimension_tag<d_> >, Cartesian_base_d<Gmpq, Dim> \
Cartesian_base_d<Gmpq, Dimension_tag<d_> >
> >
{}; template<class Dim>
template<int d_> struct Epick_d_help1
: CGAL_BASE
{
CGAL_CONSTEXPR Epick_d_help1(){}
CGAL_CONSTEXPR Epick_d_help1(int d):CGAL_BASE(d){}
};
#undef CGAL_BASE
#define CGAL_BASE \
Cartesian_static_filters<Dim,Epick_d_help1<Dim>,Epick_d_help2<Dim> >
template<class Dim>
struct Epick_d_help2 struct Epick_d_help2
: Cartesian_static_filters<Dimension_tag<d_>,Epick_d_help1<d_>,Epick_d_help2<d_> > : CGAL_BASE
{}; {
CGAL_CONSTEXPR Epick_d_help2(){}
CGAL_CONSTEXPR Epick_d_help2(int d):CGAL_BASE(d){}
};
#undef CGAL_BASE
#define CGAL_BASE \
Kernel_d_interface< Cartesian_wrap< Epick_d_help2< \
typename boost::conditional< d_==UNKNOWN_DIMENSION, \
Dynamic_dimension_tag, \
Dimension_tag<d_> \
>::type \
> > >
template<int d_> template<int d_>
struct Epick_d struct Epick_d
: Kernel_d_interface<Cartesian_wrap<Epick_d_help2<d_> > > : CGAL_BASE
{}; {
CGAL_CONSTEXPR Epick_d(){}
CGAL_CONSTEXPR Epick_d(int d):CGAL_BASE(d){}
};
#undef CGAL_BASE
} }
#endif #endif

View File

@ -6,24 +6,25 @@
#include <CGAL/Kernel_d/Cartesian_LA_base.h> #include <CGAL/Kernel_d/Cartesian_LA_base.h>
namespace CGAL { namespace CGAL {
#define CGAL_BASE \
template < typename FT_, typename Dim_, typename Derived_=Default> Cartesian_complete_predicates< \
struct Cartesian_base_d : public Cartesian_complete_constructors< \
Cartesian_complete_predicates< Cartesian_complete_computes< \
Cartesian_complete_constructors< Cartesian_complete_types< \
Cartesian_complete_computes< Cartesian_LA_base_d< \
Cartesian_complete_types< FT_, Dim_ \
Cartesian_LA_base_d< >, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type \
FT_, Dim_ >, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type \
>, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type >, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type \
>, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type >, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type \
>, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type
>, false, typename Default::Get<Derived_,Cartesian_base_d<FT_,Dim_> >::type
> >
template < typename FT_, typename Dim_, typename Derived_=Default>
struct Cartesian_base_d : public CGAL_BASE
{ {
CGAL_CONSTEXPR Cartesian_base_d(){} CGAL_CONSTEXPR Cartesian_base_d(){}
CGAL_CONSTEXPR Cartesian_base_d(int d):Dimension_base<Dim_>(d){} CGAL_CONSTEXPR Cartesian_base_d(int d):CGAL_BASE(d){}
}; };
#undef CGAL_BASE
} //namespace CGAL } //namespace CGAL

View File

@ -49,6 +49,9 @@ template<class R_,class Derived_> struct Cartesian_define_all_functors
template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_types template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_types
: public R_ : public R_
{ {
CGAL_CONSTEXPR Cartesian_complete_types(){}
CGAL_CONSTEXPR Cartesian_complete_types(int d):R_(d){}
typedef R_ Kernel_base; typedef R_ Kernel_base;
typedef typename Default::Get<Derived_,Cartesian_complete_types>::type Derived; typedef typename Default::Get<Derived_,Cartesian_complete_types>::type Derived;
#if 0 #if 0
@ -73,6 +76,9 @@ template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_com
template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_constructors template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_constructors
: public R_ : public R_
{ {
CGAL_CONSTEXPR Cartesian_complete_constructors(){}
CGAL_CONSTEXPR Cartesian_complete_constructors(int d):R_(d){}
typedef R_ Kernel_base; typedef R_ Kernel_base;
typedef typename Default::Get<Derived_,Cartesian_complete_constructors>::type Derived; typedef typename Default::Get<Derived_,Cartesian_complete_constructors>::type Derived;
template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor : template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor :
@ -89,6 +95,9 @@ template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_com
template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_predicates template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_predicates
: public R_ : public R_
{ {
CGAL_CONSTEXPR Cartesian_complete_predicates(){}
CGAL_CONSTEXPR Cartesian_complete_predicates(int d):R_(d){}
// TODO: this doesn't look like the right place for this typedef... // TODO: this doesn't look like the right place for this typedef...
typedef CartesianDKernelFunctors::Flat_orientation Flat_orientation; typedef CartesianDKernelFunctors::Flat_orientation Flat_orientation;
@ -108,6 +117,9 @@ template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_com
template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_computes template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_computes
: public R_ : public R_
{ {
CGAL_CONSTEXPR Cartesian_complete_computes(){}
CGAL_CONSTEXPR Cartesian_complete_computes(int d):R_(d){}
typedef R_ Kernel_base; typedef R_ Kernel_base;
typedef typename Default::Get<Derived_,Cartesian_complete_computes>::type Derived; typedef typename Default::Get<Derived_,Cartesian_complete_computes>::type Derived;
template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor : template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor :

View File

@ -47,9 +47,16 @@ template <class Base_,class R_> struct Orientation_of_points_2 : private Store_k
}; };
} }
template <class Dim_ /* should be implicit */, class R_, class Derived_=Default> struct Cartesian_static_filters : public R_ {}; template <class Dim_ /* should be implicit */, class R_, class Derived_=Default>
struct Cartesian_static_filters : public R_ {
CGAL_CONSTEXPR Cartesian_static_filters(){}
CGAL_CONSTEXPR Cartesian_static_filters(int d):R_(d){}
};
template <class R_, class Derived_> struct Cartesian_static_filters<Dimension_tag<2>, R_, Derived_> : public R_ { template <class R_, class Derived_>
struct Cartesian_static_filters<Dimension_tag<2>, R_, Derived_> : public R_ {
CGAL_CONSTEXPR Cartesian_static_filters(){}
CGAL_CONSTEXPR Cartesian_static_filters(int d):R_(d){}
typedef Cartesian_static_filters<Dimension_tag<2>, R_, Derived_> Self; typedef Cartesian_static_filters<Dimension_tag<2>, R_, Derived_> Self;
typedef typename Default::Get<Derived_,Self>::type Derived; typedef typename Default::Get<Derived_,Self>::type Derived;
template <class T, class=void> struct Functor : R_::template Functor<T> {}; template <class T, class=void> struct Functor : R_::template Functor<T> {};

View File

@ -9,6 +9,9 @@
namespace CGAL { namespace CGAL {
template <class Base_> struct Kernel_d_interface : public Base_ { template <class Base_> struct Kernel_d_interface : public Base_ {
CGAL_CONSTEXPR Kernel_d_interface(){}
CGAL_CONSTEXPR Kernel_d_interface(int d):Base_(d){}
typedef Base_ Base; typedef Base_ Base;
typedef Kernel_d_interface<Base> Kernel; typedef Kernel_d_interface<Base> Kernel;
typedef Base_ R_; // for the macros typedef Base_ R_; // for the macros

View File

@ -91,11 +91,17 @@ void test2(){
typedef typename K1::In_flat_orientation_d IFO; typedef typename K1::In_flat_orientation_d IFO;
typedef typename K1::In_flat_side_of_oriented_sphere_d IFSOS; typedef typename K1::In_flat_side_of_oriented_sphere_d IFSOS;
typedef typename K1::Contained_in_affine_hull_d CAH; typedef typename K1::Contained_in_affine_hull_d CAH;
typedef typename K1::Compare_lexicographically_d CL;
USE_TYPE(V); USE_TYPE(V);
USE_TYPE(CV); USE_TYPE(CV);
USE_TYPE(FO); USE_TYPE(FO);
Ker k; USE_TYPE(CL);
Ker k
#if 0
(2)
#endif
;
CP cp Kinit(construct_point_d_object); CP cp Kinit(construct_point_d_object);
CCI ci Kinit(construct_cartesian_const_iterator_d_object); CCI ci Kinit(construct_cartesian_const_iterator_d_object);
CC cc Kinit(compute_coordinate_d_object); CC cc Kinit(compute_coordinate_d_object);
@ -148,14 +154,20 @@ void test3(){
typedef typename K1::In_flat_orientation_d IFO; typedef typename K1::In_flat_orientation_d IFO;
typedef typename K1::In_flat_side_of_oriented_sphere_d IFSOS; typedef typename K1::In_flat_side_of_oriented_sphere_d IFSOS;
typedef typename K1::Contained_in_affine_hull_d CAH; typedef typename K1::Contained_in_affine_hull_d CAH;
typedef typename K1::Compare_lexicographically_d CL;
USE_TYPE(V); USE_TYPE(V);
USE_TYPE(CV); USE_TYPE(CV);
USE_TYPE(FO); USE_TYPE(FO);
Ker k; Ker k
#if 0
(3)
#endif
;
CP cp Kinit(construct_point_d_object); CP cp Kinit(construct_point_d_object);
CCI ci Kinit(construct_cartesian_const_iterator_d_object); CCI ci Kinit(construct_cartesian_const_iterator_d_object);
CC cc Kinit(compute_coordinate_d_object); CC cc Kinit(compute_coordinate_d_object);
CL cl Kinit(compare_lexicographically_d_object);
PO po Kinit(orientation_d_object); PO po Kinit(orientation_d_object);
CS cs Kinit(construct_segment_d_object); CS cs Kinit(construct_segment_d_object);
CSE cse (k); CSE cse (k);
@ -210,6 +222,8 @@ void test3(){
std::cout << sos(buf+0,buf+5) << '\n'; std::cout << sos(buf+0,buf+5) << '\n';
assert(cah(y+0,y+3,y[3])); assert(cah(y+0,y+3,y[3]));
assert(!cah(y+0,y+3,buf[0])); assert(!cah(y+0,y+3,buf[0]));
assert(cl(a,a)==CGAL::EQUAL);
assert(cl(a,b)==CGAL::LARGER);
} }
int main(){ int main(){