diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex.h index 740453d7208..e4150f0262e 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex.h @@ -26,23 +26,9 @@ #include #include #include -#include -#include namespace CGAL { - template - struct Default_template_argument - { typedef Linear_cell_complex_traits > type; }; - template <> - struct Default_template_argument<2> - { typedef Linear_cell_complex_traits - <2,Exact_predicates_inexact_constructions_kernel> type; }; - template <> - struct Default_template_argument<3> - { typedef Linear_cell_complex_traits - <3,Exact_predicates_inexact_constructions_kernel> type; }; - /** @file Linear_cell_complex.h * Definition of a linear cell complex, i.e. a combinatorial map with points * associated to all vertices. @@ -53,7 +39,7 @@ namespace CGAL { * an nD combinatorial map with point associated to each vertex. */ template < unsigned int d_, unsigned int ambient_dim = d_, - class Traits_ = typename Default_template_argument::type, + class Traits_ = Linear_cell_complex_traits, class Items_ = Linear_cell_complex_min_items, class Alloc_ = CGAL_ALLOCATOR(int), template diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_traits.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_traits.h index fe76f9b710b..edff0db943c 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_traits.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_traits.h @@ -20,15 +20,27 @@ #ifndef CGAL_LINEAR_CELL_COMPLEX_TRAITS_H #define CGAL_LINEAR_CELL_COMPLEX_TRAITS_H 1 -#include +#include #include +#include namespace CGAL { + template + struct LCC_default_kernel + { typedef Cartesian_d type; }; + template <> + struct LCC_default_kernel<2> + { typedef Exact_predicates_inexact_constructions_kernel type; }; + template <> + struct LCC_default_kernel<3> + { typedef Exact_predicates_inexact_constructions_kernel type; }; + /** Trait class for Linear_cell_complex class. * dD version (for the moment there is only one dD kernel in CGAL). */ - template + template ::type > struct Linear_cell_complex_traits : public Kernel { static const unsigned int ambient_dimension = d_; diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp index 5499c39d422..00540cbd2d4 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_test.cpp @@ -2,26 +2,112 @@ #include "Linear_cell_complex_3_test.h" #include "Linear_cell_complex_4_test.h" +struct Sum_functor +{ + template + void operator()(Cell_attribute& ca1,Cell_attribute& ca2) + { ca1.info()=ca1.info()+ca2.info(); } +}; +struct Divide_by_two_functor +{ + template + void operator()(Cell_attribute& ca1,Cell_attribute& ca2) + { + ca1.info()=(ca1.info()/2); + ca2.info()=(ca1.info()); + } +}; + +struct Myitems_2 +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<2, LCC> Dart; + + typedef CGAL::Cell_attribute_with_point myattrib; + typedef CGAL::cpp0x::tuple + Attributes; + }; +}; + +struct Myitems_3 +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<3, LCC> Dart; + + typedef CGAL::Cell_attribute_with_point myattrib; + typedef CGAL::cpp0x::tuple + Attributes; + }; +}; + +struct Myitems_4 +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<4, LCC> Dart; + + typedef CGAL::Cell_attribute_with_point myattrib; + typedef CGAL::cpp0x::tuple + Attributes; + }; +}; + + int main() { - typedef CGAL::Linear_cell_complex<2> LCC1; - if ( !test_LCC_2() ) + typedef CGAL::Linear_cell_complex<2> LCC2; + if ( !test_LCC_2() ) { - std::cout<<"ERROR during Test_LCC_2."<."< LCC2; - if ( !test_LCC_3() ) + typedef CGAL::Linear_cell_complex<3> LCC3; + if ( !test_LCC_3() ) { - std::cout<<"ERROR during Test_LCC_3."<."< LCC3; - if ( !test_LCC_4() ) + typedef CGAL::Linear_cell_complex<4> LCC4; + if ( !test_LCC_4() ) { - std::cout<<"ERROR during Test_LCC_4."<."<, + Myitems_2> LCC2b; + if ( !test_LCC_2() ) + { + std::cout<<"ERROR during Test_LCC_2."<, + Myitems_3> LCC3b; + if ( !test_LCC_3() ) + { + std::cout<<"ERROR during Test_LCC_3."<, + Myitems_4> LCC4b; + if ( !test_LCC_4() ) + { + std::cout<<"ERROR during Test_LCC_4."<