mirror of https://github.com/CGAL/cgal
add tests
This commit is contained in:
parent
5f1a01118f
commit
c19dae7287
|
|
@ -26,23 +26,9 @@
|
||||||
#include <CGAL/Linear_cell_complex_min_items.h>
|
#include <CGAL/Linear_cell_complex_min_items.h>
|
||||||
#include <CGAL/Linear_cell_complex_traits.h>
|
#include <CGAL/Linear_cell_complex_traits.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Cartesian_d.h>
|
|
||||||
#include <CGAL/predicates_d.h>
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template <unsigned int d>
|
|
||||||
struct Default_template_argument
|
|
||||||
{ typedef Linear_cell_complex_traits<d,Cartesian_d<double> > 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
|
/** @file Linear_cell_complex.h
|
||||||
* Definition of a linear cell complex, i.e. a combinatorial map with points
|
* Definition of a linear cell complex, i.e. a combinatorial map with points
|
||||||
* associated to all vertices.
|
* associated to all vertices.
|
||||||
|
|
@ -53,7 +39,7 @@ namespace CGAL {
|
||||||
* an nD combinatorial map with point associated to each vertex.
|
* an nD combinatorial map with point associated to each vertex.
|
||||||
*/
|
*/
|
||||||
template < unsigned int d_, unsigned int ambient_dim = d_,
|
template < unsigned int d_, unsigned int ambient_dim = d_,
|
||||||
class Traits_ = typename Default_template_argument<d_>::type,
|
class Traits_ = Linear_cell_complex_traits<d_>,
|
||||||
class Items_ = Linear_cell_complex_min_items<d_>,
|
class Items_ = Linear_cell_complex_min_items<d_>,
|
||||||
class Alloc_ = CGAL_ALLOCATOR(int),
|
class Alloc_ = CGAL_ALLOCATOR(int),
|
||||||
template<unsigned int,class,class,class>
|
template<unsigned int,class,class,class>
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,27 @@
|
||||||
#ifndef CGAL_LINEAR_CELL_COMPLEX_TRAITS_H
|
#ifndef CGAL_LINEAR_CELL_COMPLEX_TRAITS_H
|
||||||
#define CGAL_LINEAR_CELL_COMPLEX_TRAITS_H 1
|
#define CGAL_LINEAR_CELL_COMPLEX_TRAITS_H 1
|
||||||
|
|
||||||
#include <CGAL/Cartesian.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Cartesian_d.h>
|
#include <CGAL/Cartesian_d.h>
|
||||||
|
#include <CGAL/predicates_d.h>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
|
template <unsigned int d>
|
||||||
|
struct LCC_default_kernel
|
||||||
|
{ typedef Cartesian_d<double> 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.
|
/** Trait class for Linear_cell_complex class.
|
||||||
* dD version (for the moment there is only one dD kernel in CGAL).
|
* dD version (for the moment there is only one dD kernel in CGAL).
|
||||||
*/
|
*/
|
||||||
template <unsigned int d_, class Kernel>
|
template <unsigned int d_,
|
||||||
|
class Kernel=typename LCC_default_kernel<d_>::type >
|
||||||
struct Linear_cell_complex_traits : public Kernel
|
struct Linear_cell_complex_traits : public Kernel
|
||||||
{
|
{
|
||||||
static const unsigned int ambient_dimension = d_;
|
static const unsigned int ambient_dimension = d_;
|
||||||
|
|
|
||||||
|
|
@ -2,26 +2,112 @@
|
||||||
#include "Linear_cell_complex_3_test.h"
|
#include "Linear_cell_complex_3_test.h"
|
||||||
#include "Linear_cell_complex_4_test.h"
|
#include "Linear_cell_complex_4_test.h"
|
||||||
|
|
||||||
|
struct Sum_functor
|
||||||
|
{
|
||||||
|
template<class Cell_attribute>
|
||||||
|
void operator()(Cell_attribute& ca1,Cell_attribute& ca2)
|
||||||
|
{ ca1.info()=ca1.info()+ca2.info(); }
|
||||||
|
};
|
||||||
|
struct Divide_by_two_functor
|
||||||
|
{
|
||||||
|
template<class Cell_attribute>
|
||||||
|
void operator()(Cell_attribute& ca1,Cell_attribute& ca2)
|
||||||
|
{
|
||||||
|
ca1.info()=(ca1.info()/2);
|
||||||
|
ca2.info()=(ca1.info());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Myitems_2
|
||||||
|
{
|
||||||
|
template <class LCC>
|
||||||
|
struct Dart_wrapper
|
||||||
|
{
|
||||||
|
typedef CGAL::Dart<2, LCC> Dart;
|
||||||
|
|
||||||
|
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_true,Sum_functor,
|
||||||
|
Divide_by_two_functor> myattrib;
|
||||||
|
typedef CGAL::cpp0x::tuple<myattrib, myattrib, myattrib>
|
||||||
|
Attributes;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Myitems_3
|
||||||
|
{
|
||||||
|
template <class LCC>
|
||||||
|
struct Dart_wrapper
|
||||||
|
{
|
||||||
|
typedef CGAL::Dart<3, LCC> Dart;
|
||||||
|
|
||||||
|
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_true,Sum_functor,
|
||||||
|
Divide_by_two_functor> myattrib;
|
||||||
|
typedef CGAL::cpp0x::tuple<myattrib, myattrib, myattrib, myattrib>
|
||||||
|
Attributes;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Myitems_4
|
||||||
|
{
|
||||||
|
template <class LCC>
|
||||||
|
struct Dart_wrapper
|
||||||
|
{
|
||||||
|
typedef CGAL::Dart<4, LCC> Dart;
|
||||||
|
|
||||||
|
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_true,Sum_functor,
|
||||||
|
Divide_by_two_functor> myattrib;
|
||||||
|
typedef CGAL::cpp0x::tuple<myattrib, myattrib, myattrib, myattrib,myattrib>
|
||||||
|
Attributes;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
typedef CGAL::Linear_cell_complex<2> LCC1;
|
typedef CGAL::Linear_cell_complex<2> LCC2;
|
||||||
if ( !test_LCC_2<LCC1>() )
|
if ( !test_LCC_2<LCC2>() )
|
||||||
{
|
{
|
||||||
std::cout<<"ERROR during Test_LCC_2<LCC1>."<<std::endl;
|
std::cout<<"ERROR during Test_LCC_2<LCC2>."<<std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef CGAL::Linear_cell_complex<3> LCC2;
|
typedef CGAL::Linear_cell_complex<3> LCC3;
|
||||||
if ( !test_LCC_3<LCC2>() )
|
if ( !test_LCC_3<LCC3>() )
|
||||||
{
|
{
|
||||||
std::cout<<"ERROR during Test_LCC_3<LCC2>."<<std::endl;
|
std::cout<<"ERROR during Test_LCC_3<LCC3>."<<std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef CGAL::Linear_cell_complex<4> LCC3;
|
typedef CGAL::Linear_cell_complex<4> LCC4;
|
||||||
if ( !test_LCC_4<LCC3>() )
|
if ( !test_LCC_4<LCC4>() )
|
||||||
{
|
{
|
||||||
std::cout<<"ERROR during Test_LCC_4<LCC3>."<<std::endl;
|
std::cout<<"ERROR during Test_LCC_4<LCC4>."<<std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef CGAL::Linear_cell_complex<2,2,
|
||||||
|
CGAL::Linear_cell_complex_traits<2>,
|
||||||
|
Myitems_2> LCC2b;
|
||||||
|
if ( !test_LCC_2<LCC2b>() )
|
||||||
|
{
|
||||||
|
std::cout<<"ERROR during Test_LCC_2<LCC2b>."<<std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef CGAL::Linear_cell_complex<3,3,
|
||||||
|
CGAL::Linear_cell_complex_traits<3>,
|
||||||
|
Myitems_3> LCC3b;
|
||||||
|
if ( !test_LCC_3<LCC3b>() )
|
||||||
|
{
|
||||||
|
std::cout<<"ERROR during Test_LCC_3<LCC3b>."<<std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef CGAL::Linear_cell_complex<4,4,
|
||||||
|
CGAL::Linear_cell_complex_traits<4>,
|
||||||
|
Myitems_4> LCC4b;
|
||||||
|
if ( !test_LCC_4<LCC4b>() )
|
||||||
|
{
|
||||||
|
std::cout<<"ERROR during Test_LCC_4<LCC4b>."<<std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue