- Sign_at/Sign_at_homogeneous/Compare are Null_functor if

ICoeff is not RealEmbeddable
- simplified layout for tests
This commit is contained in:
Michael Hemmer 2008-07-22 08:25:53 +00:00
parent 92a0d3cc1d
commit b67232dc3d
2 changed files with 1268 additions and 1289 deletions

View File

@ -135,10 +135,8 @@ public:
// Multivariate_content; // Multivariate_content;
struct Multivariate_content struct Multivariate_content
: public Unary_function< Polynomial_d , Innermost_coefficient >{ : public Unary_function< Polynomial_d , Innermost_coefficient >{
Innermost_coefficient Innermost_coefficient operator()(const Polynomial_d& p) const {
operator()(const Polynomial_d& p) const { if( CGAL::is_zero(p) )
typename PT::Compare compare;
if( compare( p, Polynomial_d(0) ) == EQUAL )
return Innermost_coefficient(0); return Innermost_coefficient(0);
else else
return Innermost_coefficient(1); return Innermost_coefficient(1);
@ -933,15 +931,18 @@ public:
} }
}; };
// Sign_at; // Sign_at, Sign_at_homogeneous, Compare
struct Sign_at { // define XXX_ even though ICoeff may not be Real_embeddable
// select propoer XXX among XXX_ or Null_functor using ::boost::mpl::if_
private:
struct Sign_at_ {
private: private:
typedef Real_embeddable_traits<Innermost_coefficient> RT; typedef Real_embeddable_traits<Innermost_coefficient> RT;
typedef typename RT::Sign::result_type SIGN; typedef typename RT::Sign::result_type SIGN;
public: public:
typedef SIGN result_type; typedef SIGN result_type;
template< class Input_iterator >
template< class Input_iterator >
SIGN operator()( SIGN operator()(
const Polynomial_d& p, const Polynomial_d& p,
Input_iterator begin, Input_iterator begin,
@ -952,7 +953,7 @@ public:
} }
}; };
struct Sign_at_homogeneous { struct Sign_at_homogeneous_ {
typedef Real_embeddable_traits<Innermost_coefficient> RT; typedef Real_embeddable_traits<Innermost_coefficient> RT;
typedef typename RT::Sign::result_type SIGN; typedef typename RT::Sign::result_type SIGN;
public: public:
@ -969,7 +970,7 @@ public:
}; };
// Compare; // Compare;
struct Compare struct Compare_
: public Binary_function< Comparison_result, Polynomial_d, Polynomial_d > { : public Binary_function< Comparison_result, Polynomial_d, Polynomial_d > {
Comparison_result operator() Comparison_result operator()
( const Polynomial_d& p1, const Polynomial_d& p2 ) const { ( const Polynomial_d& p1, const Polynomial_d& p2 ) const {
@ -977,6 +978,15 @@ public:
} }
}; };
typedef Real_embeddable_traits<Innermost_coefficient> RET_IC;
typedef typename RET_IC::Is_real_embeddable IC_is_real_embeddable;
public:
typedef typename ::boost::mpl::if_<IC_is_real_embeddable,Sign_at_,Null_functor>::type Sign_at;
typedef typename ::boost::mpl::if_<IC_is_real_embeddable,Sign_at_homogeneous_,Null_functor>::type Sign_at_homogeneous;
typedef typename ::boost::mpl::if_<IC_is_real_embeddable,Compare_,Null_functor>::type Compare;
// This is going to be in PolynomialToolBox // This is going to be in PolynomialToolBox
struct Coefficient_begin struct Coefficient_begin
: public Unary_function< Polynomial_d, Coefficient_iterator > { : public Unary_function< Polynomial_d, Coefficient_iterator > {

File diff suppressed because it is too large Load Diff