From a031abe9a0ceec67373886c8e7acc28febe9b66a Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Wed, 16 May 2012 14:49:32 +0000 Subject: [PATCH] minor preps for dynamic dimension --- NewKernel_d/include/CGAL/Dimension.h | 9 ++++++++- .../include/CGAL/Kernel_d/Cartesian_LA_functors.h | 11 +++++------ NewKernel_d/include/CGAL/Kernel_d/Dimension_base.h | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/NewKernel_d/include/CGAL/Dimension.h b/NewKernel_d/include/CGAL/Dimension.h index 06be888abb4..514b41b5020 100644 --- a/NewKernel_d/include/CGAL/Dimension.h +++ b/NewKernel_d/include/CGAL/Dimension.h @@ -35,10 +35,17 @@ const int UNKNOWN_DIMENSION=Eigen::Dynamic; const int UNKNOWN_DIMENSION=std::numeric_limits::max(); #endif -inline bool check_dimension(int d1, int d2){ +inline bool check_dimension_lt(int d1, int d2){ + //return (d2==UNKNOWN_DIMENSION)||(d1 struct Construct_LA_vector typedef typename R_::Default_ambient_dimension Dimension; static const int dim=Dimension::value; result_type operator()(int d)const{ - CGAL_assertion(d==dim); + CGAL_assertion(check_dimension_eq(d,dim)); return typename Constructor::Dimension()(d); } result_type operator()()const{ @@ -86,8 +86,8 @@ template struct Construct_LA_vector (Iter f,Iter g,Cartesian_tag)const { int d=std::distance(f,g); - CGAL_assertion(d==dim); - return typename Constructor::Iterator()(dim,f,g); + CGAL_assertion(check_dimension_eq(d,dim)); + return typename Constructor::Iterator()(d,f,g); } template typename boost::enable_if,result_type>::type operator() (Iter f,Iter g,Homogeneous_tag)const @@ -104,9 +104,9 @@ template struct Construct_LA_vector (Iter f,Iter g,NT const&l)const { int d=std::distance(f,g); - CGAL_assertion(d==dim); + CGAL_assertion(check_dimension_eq(d,dim)); // RT? better be safe for now - return typename Constructor::Iterator()(dim,CGAL::make_transforming_iterator(f,Divide(l)),CGAL::make_transforming_iterator(g,Divide(l))); + return typename Constructor::Iterator()(d,CGAL::make_transforming_iterator(f,Divide(l)),CGAL::make_transforming_iterator(g,Divide(l))); } }; @@ -269,7 +269,6 @@ template struct PV_dimension { template result_type operator()(T const& v) const { - //FIXME: size_of_vector comes from Vector, not LA return LA::size_of_vector(v); } }; diff --git a/NewKernel_d/include/CGAL/Kernel_d/Dimension_base.h b/NewKernel_d/include/CGAL/Kernel_d/Dimension_base.h index 9788ee1867e..fb01403a14f 100644 --- a/NewKernel_d/include/CGAL/Kernel_d/Dimension_base.h +++ b/NewKernel_d/include/CGAL/Kernel_d/Dimension_base.h @@ -6,7 +6,7 @@ namespace CGAL { template struct Dimension_base { //TODO: add some assertions - Dimension_base(int dim=-1):dim_(dim){} + Dimension_base(int dim=UNKNOWN_DIMENSION):dim_(dim){} int dimension()const{return dim_;} void set_dimension(int dim){dim_=dim;} private: