mirror of https://github.com/CGAL/cgal
renaming:
AlgebraicStructureTraits::Algebraic_structure -> ..::Type RealEmbeddableTraits::Real_emebddable -> ..::Type CoercionTraits::Coercion_type -> ..::Type FractionTraits::Fraction -> ..::Type
This commit is contained in:
parent
f1eced21ab
commit
f002c6fd13
|
|
@ -49,10 +49,10 @@ struct Field_with_root_of_tag : public Field_with_kth_root_tag {};
|
|||
|
||||
// The algebraic structure traits template
|
||||
// =========================================================================
|
||||
template< class Algebraic_structure_ >
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Null_tag Algebraic_structure_tag;
|
||||
typedef Null_tag Is_exact;
|
||||
|
||||
|
|
@ -75,24 +75,24 @@ class Algebraic_structure_traits {
|
|||
|
||||
// The algebraic structure traits base class
|
||||
// =========================================================================
|
||||
template< class Algebraic_structure, class Algebra_type >
|
||||
template< class Type, class Algebra_type >
|
||||
class Algebraic_structure_traits_base;
|
||||
|
||||
//! The template specialization that can be used for types that are not any
|
||||
//! of the number type concepts. All functors are set to \c Null_functor
|
||||
//! or suitable defaults. The \c Simplify functor does nothing by default.
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_, Null_tag > {
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_, Null_tag > {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Null_tag Algebraic_structure_tag;
|
||||
typedef Tag_false Is_exact;
|
||||
|
||||
// does nothing by default
|
||||
class Simplify
|
||||
: public Unary_function< Algebraic_structure&, void > {
|
||||
: public Unary_function< Type&, void > {
|
||||
public:
|
||||
void operator()( Algebraic_structure& ) const {}
|
||||
void operator()( Type& ) const {}
|
||||
};
|
||||
|
||||
typedef Null_functor Unit_part;
|
||||
|
|
@ -113,48 +113,48 @@ class Algebraic_structure_traits_base< Algebraic_structure_, Null_tag > {
|
|||
//! The template specialization that is used if the number type is
|
||||
//! a model of the \c IntegralDomainWithoutDiv concept. The \c Simplify
|
||||
//! does nothing by default and the \c Unit_part is equal to
|
||||
//! \c Algebraic_structure(-1) for negative numbers and
|
||||
//! \c Algebraic_structure(1) otherwise
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
//! \c Type(-1) for negative numbers and
|
||||
//! \c Type(1) otherwise
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_,
|
||||
Integral_domain_without_division_tag >
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Null_tag > {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Integral_domain_without_division_tag Algebraic_structure_tag;
|
||||
|
||||
// returns Algebraic_structure(1) by default
|
||||
// returns Type(1) by default
|
||||
class Unit_part
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
return( x < Algebraic_structure(0)) ?
|
||||
Algebraic_structure(-1) : Algebraic_structure(1);
|
||||
Type operator()( const Type& x ) const {
|
||||
return( x < Type(0)) ?
|
||||
Type(-1) : Type(1);
|
||||
}
|
||||
};
|
||||
|
||||
class Square
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return x*x;
|
||||
}
|
||||
};
|
||||
|
||||
class Is_zero
|
||||
: public Unary_function< Algebraic_structure, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Algebraic_structure& x ) const {
|
||||
return x == Algebraic_structure(0);
|
||||
bool operator()( const Type& x ) const {
|
||||
return x == Type(0);
|
||||
}
|
||||
};
|
||||
|
||||
class Is_one
|
||||
: public Unary_function< Algebraic_structure, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Algebraic_structure& x ) const {
|
||||
return x == Algebraic_structure(1);
|
||||
bool operator()( const Type& x ) const {
|
||||
return x == Type(1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -167,13 +167,13 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
//! for the \c IntegralDomainWithoutDiv concept. The additionally required
|
||||
//! \c Integral_division functor needs to be implemented in the
|
||||
//! \c Algebraic_structure_traits itself.
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_,
|
||||
Integral_domain_tag >
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Integral_domain_without_division_tag > {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Integral_domain_tag Algebraic_structure_tag;
|
||||
};
|
||||
|
||||
|
|
@ -184,37 +184,37 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
//! \c Integral_div functor
|
||||
//! and \c Gcd functor need to be implemented in the
|
||||
//! \c Algebraic_structure_traits itself.
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_,
|
||||
Unique_factorization_domain_tag >
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Integral_domain_tag > {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Unique_factorization_domain_tag Algebraic_structure_tag;
|
||||
};
|
||||
|
||||
|
||||
//! The template specialization that is used if the number type is
|
||||
//! a model of the \c EuclideanRing concept.
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_,
|
||||
Euclidean_ring_tag >
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Unique_factorization_domain_tag > {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Euclidean_ring_tag Algebraic_structure_tag;
|
||||
|
||||
// maps to \c Div by default.
|
||||
class Integral_division
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
typedef Algebraic_structure_traits<Algebraic_structure> AST;
|
||||
Type operator()(
|
||||
const Type& x,
|
||||
const Type& y) const {
|
||||
typedef Algebraic_structure_traits<Type> AST;
|
||||
typedef typename AST::Is_exact Is_exact;
|
||||
typename AST::Div actual_div;
|
||||
|
||||
|
|
@ -224,37 +224,37 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
"Algebraic_structure_traits<...>::Integral_div()(x,y)" );
|
||||
return actual_div( x, y);
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure ) ;
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type ) ;
|
||||
};
|
||||
|
||||
// Algorithm from NiX/euclids_algorithm.h
|
||||
class Gcd
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
typedef Algebraic_structure_traits<Algebraic_structure> AST;
|
||||
Type operator()(
|
||||
const Type& x,
|
||||
const Type& y) const {
|
||||
typedef Algebraic_structure_traits<Type> AST;
|
||||
typename AST::Mod mod;
|
||||
typename AST::Unit_part unit_part;
|
||||
typename AST::Integral_division integral_div;
|
||||
// First: the extreme cases and negative sign corrections.
|
||||
if (x == Algebraic_structure(0)) {
|
||||
if (y == Algebraic_structure(0))
|
||||
return Algebraic_structure(0);
|
||||
if (x == Type(0)) {
|
||||
if (y == Type(0))
|
||||
return Type(0);
|
||||
return integral_div( y, unit_part(y) );
|
||||
}
|
||||
if (y == Algebraic_structure(0))
|
||||
if (y == Type(0))
|
||||
return integral_div(x, unit_part(x) );
|
||||
Algebraic_structure u = integral_div( x, unit_part(x) );
|
||||
Algebraic_structure v = integral_div( y, unit_part(y) );
|
||||
Type u = integral_div( x, unit_part(x) );
|
||||
Type v = integral_div( y, unit_part(y) );
|
||||
// Second: assuming mod is the most expensive op here,
|
||||
// we don't compute it unnecessarily if u < v
|
||||
if (u < v) {
|
||||
v = mod(v,u);
|
||||
// maintain invariant of v > 0 for the loop below
|
||||
if ( v == Algebraic_structure(0) )
|
||||
if ( v == Type(0) )
|
||||
return u;
|
||||
}
|
||||
// Third: generic case of two positive integer values and u >= v.
|
||||
|
|
@ -269,34 +269,34 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
// But we want to save us all the variable assignments and unroll
|
||||
// the loop. Before that, we transform it into a do {...} while()
|
||||
// loop to reduce branching statements.
|
||||
Algebraic_structure w;
|
||||
Type w;
|
||||
do {
|
||||
w = mod(u,v);
|
||||
if ( w == Algebraic_structure(0))
|
||||
if ( w == Type(0))
|
||||
return v;
|
||||
u = mod(v,w);
|
||||
if ( u == Algebraic_structure(0))
|
||||
if ( u == Type(0))
|
||||
return w;
|
||||
v = mod(w,u);
|
||||
} while (v != Algebraic_structure(0));
|
||||
} while (v != Type(0));
|
||||
return u;
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure );
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type );
|
||||
};
|
||||
|
||||
// based on \c Div and \c Mod.
|
||||
class Div_mod {
|
||||
public:
|
||||
typedef Algebraic_structure first_argument_type;
|
||||
typedef Algebraic_structure second_argument_type;
|
||||
typedef Algebraic_structure& third_argument_type;
|
||||
typedef Algebraic_structure& fourth_argument_type;
|
||||
typedef Type first_argument_type;
|
||||
typedef Type second_argument_type;
|
||||
typedef Type& third_argument_type;
|
||||
typedef Type& fourth_argument_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
typedef void result_type;
|
||||
void operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y,
|
||||
Algebraic_structure& q, Algebraic_structure& r) const {
|
||||
typedef Algebraic_structure_traits<Algebraic_structure> Traits;
|
||||
void operator()( const Type& x,
|
||||
const Type& y,
|
||||
Type& q, Type& r) const {
|
||||
typedef Algebraic_structure_traits<Type> Traits;
|
||||
typename Traits::Div actual_div;
|
||||
typename Traits::Mod actual_mod;
|
||||
q = actual_div( x, y );
|
||||
|
|
@ -308,12 +308,12 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
void operator()(
|
||||
const NT1& x,
|
||||
const NT2& y,
|
||||
Algebraic_structure& q,
|
||||
Algebraic_structure& r ) const {
|
||||
Type& q,
|
||||
Type& r ) const {
|
||||
typedef Coercion_traits< NT1, NT2 > CT;
|
||||
typedef typename CT::Coercion_type Coercion_type;
|
||||
typedef typename CT::Type Type;
|
||||
BOOST_STATIC_ASSERT((
|
||||
::boost::is_same<Coercion_type , Algebraic_structure >::value));
|
||||
::boost::is_same<Type , Type >::value));
|
||||
|
||||
typename Coercion_traits< NT1, NT2 >::Cast cast;
|
||||
operator()( cast(x), cast(y), q, r );
|
||||
|
|
@ -322,38 +322,38 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
|
||||
// based on \c Div_mod.
|
||||
class Div
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
typename Algebraic_structure_traits<Algebraic_structure>
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
typename Algebraic_structure_traits<Type>
|
||||
::Div_mod actual_div_mod;
|
||||
Algebraic_structure q;
|
||||
Algebraic_structure r;
|
||||
Type q;
|
||||
Type r;
|
||||
actual_div_mod( x, y, q, r );
|
||||
return q;
|
||||
};
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
// based on \c Div_mod.
|
||||
class Mod
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
typename Algebraic_structure_traits<Algebraic_structure>
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
typename Algebraic_structure_traits<Type>
|
||||
::Div_mod actual_div_mod;
|
||||
Algebraic_structure q;
|
||||
Algebraic_structure r;
|
||||
Type q;
|
||||
Type r;
|
||||
actual_div_mod( x, y, q, r );
|
||||
return r;
|
||||
};
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -366,37 +366,37 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
//! See also \link NiX_NT_traits_functors concept NT_traits \endlink .
|
||||
//! \ingroup NiX_NT_traits_bases
|
||||
//
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_, Field_tag >
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_, Field_tag >
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Integral_domain_tag > {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Field_tag Algebraic_structure_tag;
|
||||
|
||||
// returns the argument \a a by default
|
||||
class Unit_part
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
return( x == Algebraic_structure(0)) ? Algebraic_structure(1) : x;
|
||||
Type operator()( const Type& x ) const {
|
||||
return( x == Type(0)) ? Type(1) : x;
|
||||
}
|
||||
};
|
||||
// maps to \c operator/ by default.
|
||||
class Integral_division
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
typedef Algebraic_structure_traits<Algebraic_structure> AST;
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
typedef Algebraic_structure_traits<Type> AST;
|
||||
typedef typename AST::Is_exact Is_exact;
|
||||
CGAL_precondition_msg( !Is_exact::value || (x / y) * y == x,
|
||||
"'x' must be divisible by 'y' in "
|
||||
"Algebraic_structure_traits<...>::Integral_div()(x,y)" );
|
||||
return x / y;
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -408,23 +408,23 @@ class Algebraic_structure_traits_base< Algebraic_structure_, Field_tag >
|
|||
//! implemented in the \c NT_traits itself.
|
||||
//! \ingroup NiX_NT_traits_bases
|
||||
//
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_,
|
||||
Field_with_sqrt_tag>
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Field_tag> {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Field_with_sqrt_tag Algebraic_structure_tag;
|
||||
|
||||
struct Is_square
|
||||
:public Binary_function<Algebraic_structure,Algebraic_structure&,bool>
|
||||
:public Binary_function<Type,Type&,bool>
|
||||
{
|
||||
bool operator()(const Algebraic_structure& x) const {return true;}
|
||||
bool operator()(const Type& x) const {return true;}
|
||||
bool operator()(
|
||||
const Algebraic_structure& x,
|
||||
Algebraic_structure & result) const {
|
||||
typename Algebraic_structure_traits<Algebraic_structure>::Sqrt sqrt;
|
||||
const Type& x,
|
||||
Type & result) const {
|
||||
typename Algebraic_structure_traits<Type>::Sqrt sqrt;
|
||||
result = sqrt(x);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -438,16 +438,16 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
//! implemented in the \c Algebraic_structure_traits itself.
|
||||
//! \ingroup NiX_NT_traits_bases
|
||||
//
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_,
|
||||
Field_with_kth_root_tag>
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Field_with_sqrt_tag> {
|
||||
|
||||
|
||||
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Field_with_kth_root_tag Algebraic_structure_tag;
|
||||
};
|
||||
|
||||
|
|
@ -461,58 +461,58 @@ class Algebraic_structure_traits_base< Algebraic_structure_,
|
|||
//! implemented in the \c NT_traits itself.
|
||||
//! \ingroup NiX_NT_traits_bases
|
||||
//
|
||||
template< class Algebraic_structure_ >
|
||||
class Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
template< class Type_ >
|
||||
class Algebraic_structure_traits_base< Type_,
|
||||
Field_with_root_of_tag >
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure_,
|
||||
: public Algebraic_structure_traits_base< Type_,
|
||||
Field_with_kth_root_tag > {
|
||||
public:
|
||||
typedef Algebraic_structure_ Algebraic_structure;
|
||||
typedef Type_ Type;
|
||||
typedef Field_with_root_of_tag Algebraic_structure_tag;
|
||||
};
|
||||
|
||||
// Some common functors to be used by AST specializations
|
||||
namespace INTERN_AST {
|
||||
template< class Algebraic_structure >
|
||||
template< class Type >
|
||||
class Div_per_operator
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return x / y;
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
template< class Type >
|
||||
class Mod_per_operator
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return x % y;
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
template< class Type >
|
||||
class Is_square_per_sqrt
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure&,
|
||||
: public Binary_function< Type, Type&,
|
||||
bool > {
|
||||
public:
|
||||
bool operator()( const Algebraic_structure& x,
|
||||
Algebraic_structure& y ) const {
|
||||
typename Algebraic_structure_traits< Algebraic_structure >::Sqrt
|
||||
bool operator()( const Type& x,
|
||||
Type& y ) const {
|
||||
typename Algebraic_structure_traits< Type >::Sqrt
|
||||
actual_sqrt;
|
||||
y = actual_sqrt( x );
|
||||
return y * y == x;
|
||||
}
|
||||
bool operator()( const Algebraic_structure& x) const {
|
||||
Algebraic_structure dummy;
|
||||
bool operator()( const Type& x) const {
|
||||
Type dummy;
|
||||
return operator()(x,dummy);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
template < class NT1, class NT2 > \
|
||||
Result_type operator()( const NT1& x, const NT2& y ) const { \
|
||||
BOOST_STATIC_ASSERT((::boost::is_same< \
|
||||
typename Coercion_traits< NT1, NT2 >::Coercion_type, NT \
|
||||
typename Coercion_traits< NT1, NT2 >::Type, NT \
|
||||
>::value)); \
|
||||
\
|
||||
typename Coercion_traits< NT1, NT2 >::Cast cast; \
|
||||
|
|
@ -54,24 +54,24 @@ CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, NT )
|
|||
struct Coercion_traits< FROM , TO >{ \
|
||||
typedef Tag_true Are_explicit_interoperable; \
|
||||
typedef Tag_true Are_implicit_interoperable; \
|
||||
typedef TO Coercion_type; \
|
||||
typedef TO Type; \
|
||||
struct Cast{ \
|
||||
typedef Coercion_type result_type; \
|
||||
Coercion_type operator()(const TO& x) const { return x;} \
|
||||
Coercion_type operator()(const FROM& x) const { \
|
||||
return Coercion_type(x);} \
|
||||
typedef Type result_type; \
|
||||
Type operator()(const TO& x) const { return x;} \
|
||||
Type operator()(const FROM& x) const { \
|
||||
return Type(x);} \
|
||||
}; \
|
||||
}; \
|
||||
template <> \
|
||||
struct Coercion_traits< TO , FROM >{ \
|
||||
typedef Tag_true Are_explicit_interoperable; \
|
||||
typedef Tag_true Are_implicit_interoperable; \
|
||||
typedef TO Coercion_type; \
|
||||
typedef TO Type; \
|
||||
struct Cast{ \
|
||||
typedef Coercion_type result_type; \
|
||||
Coercion_type operator()(const TO& x) const { return x;} \
|
||||
Coercion_type operator()(const FROM& x) const { \
|
||||
return Coercion_type(x);} \
|
||||
typedef Type result_type; \
|
||||
Type operator()(const TO& x) const { return x;} \
|
||||
Type operator()(const FROM& x) const { \
|
||||
return Type(x);} \
|
||||
}; \
|
||||
};
|
||||
|
||||
|
|
@ -80,24 +80,24 @@ CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, NT )
|
|||
struct Coercion_traits< FROM , TO >{ \
|
||||
typedef Tag_true Are_explicit_interoperable; \
|
||||
typedef Tag_true Are_implicit_interoperable; \
|
||||
typedef TO Coercion_type; \
|
||||
typedef TO Type; \
|
||||
struct Cast{ \
|
||||
typedef Coercion_type result_type; \
|
||||
Coercion_type operator()(const TO& x) const { return x;} \
|
||||
Coercion_type operator()(const FROM& x) const { \
|
||||
return Coercion_type(x);} \
|
||||
typedef Type result_type; \
|
||||
Type operator()(const TO& x) const { return x;} \
|
||||
Type operator()(const FROM& x) const { \
|
||||
return Type(x);} \
|
||||
}; \
|
||||
}; \
|
||||
template <TEM> \
|
||||
struct Coercion_traits< TO , FROM >{ \
|
||||
typedef Tag_true Are_explicit_interoperable; \
|
||||
typedef Tag_true Are_implicit_interoperable; \
|
||||
typedef TO Coercion_type; \
|
||||
typedef TO Type; \
|
||||
struct Cast{ \
|
||||
typedef Coercion_type result_type; \
|
||||
Coercion_type operator()(const TO& x) const { return x;} \
|
||||
Coercion_type operator()(const FROM& x) const { \
|
||||
return Coercion_type(x);} \
|
||||
typedef Type result_type; \
|
||||
Type operator()(const TO& x) const { return x;} \
|
||||
Type operator()(const FROM& x) const { \
|
||||
return Type(x);} \
|
||||
}; \
|
||||
};
|
||||
|
||||
|
|
@ -108,10 +108,10 @@ CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, NT )
|
|||
struct Coercion_traits< A , A >{ \
|
||||
typedef Tag_true Are_explicit_interoperable; \
|
||||
typedef Tag_true Are_implicit_interoperable; \
|
||||
typedef A Coercion_type; \
|
||||
typedef A Type; \
|
||||
struct Cast{ \
|
||||
typedef Coercion_type result_type; \
|
||||
Coercion_type operator()(const A& x) const { return x;} \
|
||||
typedef Type result_type; \
|
||||
Type operator()(const A& x) const { return x;} \
|
||||
}; \
|
||||
};
|
||||
|
||||
|
|
@ -120,10 +120,10 @@ CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, NT )
|
|||
struct Coercion_traits< A , A >{ \
|
||||
typedef Tag_true Are_explicit_interoperable; \
|
||||
typedef Tag_true Are_implicit_interoperable; \
|
||||
typedef A Coercion_type; \
|
||||
typedef A Type; \
|
||||
struct Cast{ \
|
||||
typedef Coercion_type result_type; \
|
||||
Coercion_type operator()(const A& x) const {return x;} \
|
||||
typedef Type result_type; \
|
||||
Type operator()(const A& x) const {return x;} \
|
||||
}; \
|
||||
};
|
||||
|
||||
|
|
@ -181,10 +181,10 @@ template <class A>
|
|||
struct Coercion_traits<A,A>{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_false Are_implicit_interoperable;
|
||||
typedef A Coercion_type;
|
||||
typedef A Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type inline operator()(const A& x) const {
|
||||
typedef Type result_type;
|
||||
Type inline operator()(const A& x) const {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
|
@ -213,7 +213,7 @@ template <class A, class B>
|
|||
struct Coercion_traits_for_level<A,B,0> {
|
||||
typedef Tag_false Are_explicit_interoperable;
|
||||
typedef Tag_false Are_implicit_interoperable;
|
||||
typedef void Coercion_type;
|
||||
typedef void Type;
|
||||
typedef Null_functor Cast;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ CGAL_BEGIN_NAMESPACE
|
|||
|
||||
/*! \ingroup NiX_Fraction_traits_spec
|
||||
* \brief Traits class for accessing numerator and denominator.\n
|
||||
* It is a model of the concept FractionTraits.
|
||||
* It is a model of the concept TypeTraits.
|
||||
*
|
||||
* This is the default version of NiX::Fraction_traits.
|
||||
* It typedefs NiX::Fraction_traits::Is_decomposable
|
||||
|
|
@ -41,10 +41,10 @@ CGAL_BEGIN_NAMESPACE
|
|||
* \see module NiX_Fraction_traits
|
||||
* \see module NiX_Cofraction_traits
|
||||
*/
|
||||
template <class Fraction_ >
|
||||
template <class Type_ >
|
||||
class Fraction_traits {
|
||||
public:
|
||||
typedef Fraction_ Fraction;
|
||||
typedef Type_ Type;
|
||||
typedef Tag_false Is_fraction;
|
||||
typedef Null_tag Numerator;
|
||||
typedef Null_tag Denominator;
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
template< class Real_embeddable_ ,
|
||||
template< class Type_ ,
|
||||
typename Is_real_embeddable_ = Tag_false >
|
||||
class Real_embeddable_traits {
|
||||
public:
|
||||
typedef Real_embeddable_ Real_embeddable;
|
||||
typedef Type_ Type;
|
||||
typedef Tag_false Is_real_embeddable;
|
||||
|
||||
typedef Null_functor Abs;
|
||||
|
|
@ -36,67 +36,67 @@ class Real_embeddable_traits {
|
|||
};
|
||||
|
||||
namespace INTERN_RET {
|
||||
template< class Real_embeddable, class AST_is_zero >
|
||||
template< class Type, class AST_is_zero >
|
||||
class Is_zero_selector
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
//! the function call.
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return AST_is_zero()(x);
|
||||
}
|
||||
};
|
||||
|
||||
template< class Real_embeddable >
|
||||
class Is_zero_selector< Real_embeddable, Null_functor >
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
template< class Type >
|
||||
class Is_zero_selector< Type, Null_functor >
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
//! the function call.
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
return x == Real_embeddable(0);
|
||||
bool operator()( const Type& x ) const {
|
||||
return x == Type(0);
|
||||
}
|
||||
};
|
||||
|
||||
} // INTERN_RET
|
||||
|
||||
template< class Real_embeddable_ >
|
||||
template< class Type_ >
|
||||
class Real_embeddable_traits_base {
|
||||
public:
|
||||
typedef Real_embeddable_ Real_embeddable;
|
||||
typedef Type_ Type;
|
||||
typedef Tag_true Is_real_embeddable;
|
||||
|
||||
//! The generic \c Is_zero functor implementation uses one comparison
|
||||
typedef INTERN_RET::Is_zero_selector< Real_embeddable,
|
||||
typename Algebraic_structure_traits< Real_embeddable >::Is_zero
|
||||
typedef INTERN_RET::Is_zero_selector< Type,
|
||||
typename Algebraic_structure_traits< Type >::Is_zero
|
||||
> Is_zero;
|
||||
|
||||
//! The generic \c Is_finite functor returns true
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& ) const {
|
||||
bool operator()( const Type& ) const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
//! The generic \c Abs functor implementation
|
||||
//! uses one comparisons and the unary minus if necessary.
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
//! the function call.
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
return( x < Real_embeddable(0) ) ? -x : x;
|
||||
Type operator()( const Type& x ) const {
|
||||
return( x < Type(0) ) ? -x : x;
|
||||
}
|
||||
};
|
||||
|
||||
//! The generic \c Sign functor implementation uses two comparisons.
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
//! the function call.
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
if ( x < Real_embeddable(0))
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
if ( x < Type(0))
|
||||
return NEGATIVE;
|
||||
if ( x > Real_embeddable(0))
|
||||
if ( x > Type(0))
|
||||
return POSITIVE;
|
||||
return ZERO;
|
||||
}
|
||||
|
|
@ -104,32 +104,32 @@ class Real_embeddable_traits_base {
|
|||
|
||||
//! The generic \c Is_positive functor implementation uses one comparison.
|
||||
class Is_positive
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
//! the function call.
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
return x > Real_embeddable(0);
|
||||
bool operator()( const Type& x ) const {
|
||||
return x > Type(0);
|
||||
}
|
||||
};
|
||||
|
||||
//! The generic \c Is_negative functor implementation uses one comparison.
|
||||
class Is_negative
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
//! the function call.
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
return x < Real_embeddable(0);
|
||||
bool operator()( const Type& x ) const {
|
||||
return x < Type(0);
|
||||
}
|
||||
};
|
||||
|
||||
//! The generic \c Compare functor implementation uses two comparisons.
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
//! the function call.
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
if( x < y )
|
||||
return SMALLER;
|
||||
if( x > y )
|
||||
|
|
@ -137,7 +137,7 @@ class Real_embeddable_traits_base {
|
|||
return EQUAL;
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Real_embeddable,
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
|
||||
Comparison_result );
|
||||
};
|
||||
|
||||
|
|
@ -147,33 +147,33 @@ class Real_embeddable_traits_base {
|
|||
|
||||
// Some common functors to be used by RET specializations
|
||||
namespace INTERN_RET {
|
||||
template< class Real_embeddable, class Is_real_embeddable >
|
||||
template< class Type, class Is_real_embeddable >
|
||||
class Real_embeddable_traits_base_selector;
|
||||
|
||||
template< class Real_embeddable >
|
||||
class Real_embeddable_traits_base_selector< Real_embeddable, Tag_false >
|
||||
template< class Type >
|
||||
class Real_embeddable_traits_base_selector< Type, Tag_false >
|
||||
: public Real_embeddable_traits< Null_tag > {};
|
||||
|
||||
template< class Real_embeddable >
|
||||
class Real_embeddable_traits_base_selector< Real_embeddable, Tag_true >
|
||||
: public Real_embeddable_traits_base< Real_embeddable > {};
|
||||
template< class Type >
|
||||
class Real_embeddable_traits_base_selector< Type, Tag_true >
|
||||
: public Real_embeddable_traits_base< Type > {};
|
||||
|
||||
template< class Real_embeddable >
|
||||
template< class Type >
|
||||
class To_double_by_conversion
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
//! the function call.
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return static_cast<double>(x);
|
||||
}
|
||||
};
|
||||
|
||||
template< class Real_embeddable >
|
||||
template< class Type >
|
||||
class To_interval_by_conversion
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
//! the function call.
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
return std::pair<double,double>( x, x );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,57 +96,57 @@ sqrt( const AS& x ) {
|
|||
|
||||
template< class A, class B >
|
||||
inline
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Coercion_type>
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type>
|
||||
::Integral_division::result_type
|
||||
integral_division( const A& x, const B& y ) {
|
||||
typedef typename Coercion_traits<A,B>::Coercion_type Coercion_type;
|
||||
typename Algebraic_structure_traits< Coercion_type >::Integral_division
|
||||
typedef typename Coercion_traits<A,B>::Type Type;
|
||||
typename Algebraic_structure_traits< Type >::Integral_division
|
||||
integral_division;
|
||||
return integral_division( x, y );
|
||||
}
|
||||
|
||||
template< class A, class B >
|
||||
inline
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Coercion_type >
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
|
||||
::Gcd::result_type
|
||||
gcd( const A& x, const B& y ) {
|
||||
typedef typename Coercion_traits<A,B>::Coercion_type Coercion_type;
|
||||
typename Algebraic_structure_traits< Coercion_type >::Gcd gcd;
|
||||
typedef typename Coercion_traits<A,B>::Type Type;
|
||||
typename Algebraic_structure_traits< Type >::Gcd gcd;
|
||||
return gcd( x, y );
|
||||
}
|
||||
|
||||
|
||||
template< class A, class B >
|
||||
inline
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Coercion_type >
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
|
||||
::Mod::result_type
|
||||
mod( const A& x, const B& y ) {
|
||||
typedef typename Coercion_traits<A,B>::Coercion_type Coercion_type;
|
||||
typename Algebraic_structure_traits<Coercion_type >::Mod mod;
|
||||
typedef typename Coercion_traits<A,B>::Type Type;
|
||||
typename Algebraic_structure_traits<Type >::Mod mod;
|
||||
return mod( x, y );
|
||||
}
|
||||
|
||||
template< class A, class B >
|
||||
inline
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Coercion_type >
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
|
||||
::Div::result_type
|
||||
div( const A& x, const B& y ) {
|
||||
typedef typename Coercion_traits<A,B>::Coercion_type Coercion_type;
|
||||
typename Algebraic_structure_traits<Coercion_type >::Div div;
|
||||
typedef typename Coercion_traits<A,B>::Type Type;
|
||||
typename Algebraic_structure_traits<Type >::Div div;
|
||||
return div( x, y );
|
||||
}
|
||||
|
||||
template< class A, class B >
|
||||
inline
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Coercion_type >
|
||||
typename Algebraic_structure_traits< typename Coercion_traits<A,B>::Type >
|
||||
::Div_mod::result_type
|
||||
div_mod(
|
||||
const A& x,
|
||||
const B& y,
|
||||
typename Coercion_traits<A,B>::Coercion_type& q,
|
||||
typename Coercion_traits<A,B>::Coercion_type& r ) {
|
||||
typedef typename Coercion_traits<A,B>::Coercion_type Coercion_type;
|
||||
typename Algebraic_structure_traits< Coercion_type >::Div_mod div_mod;
|
||||
typename Coercion_traits<A,B>::Type& q,
|
||||
typename Coercion_traits<A,B>::Type& r ) {
|
||||
typedef typename Coercion_traits<A,B>::Type Type;
|
||||
typename Algebraic_structure_traits< Type >::Div_mod div_mod;
|
||||
div_mod( x, y, q, r );
|
||||
}
|
||||
|
||||
|
|
@ -196,12 +196,12 @@ return is_zero( x );
|
|||
|
||||
template <class A, class B>
|
||||
inline
|
||||
typename Real_embeddable_traits< typename Coercion_traits<A,B>::Coercion_type >
|
||||
typename Real_embeddable_traits< typename Coercion_traits<A,B>::Type >
|
||||
::Compare::result_type
|
||||
compare(const A& a, const B& b)
|
||||
{
|
||||
typedef typename Coercion_traits<A,B>::Coercion_type Coercion_type;
|
||||
typename Real_embeddable_traits<Coercion_type>::Compare compare;
|
||||
typedef typename Coercion_traits<A,B>::Type Type;
|
||||
typename Real_embeddable_traits<Type>::Compare compare;
|
||||
return compare (a,b);
|
||||
// return (a < b) ? SMALLER : (b < a) ? LARGER : EQUAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
int main(){
|
||||
typedef CGAL::Algebraic_structure_traits<void> AST;
|
||||
|
||||
typedef AST::Algebraic_structure Algebraic_structure;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<void,Algebraic_structure>::value));
|
||||
typedef AST::Type Type;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<void,Type>::value));
|
||||
|
||||
typedef AST::Algebraic_structure_tag Algebraic_structure_tag;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<CGAL::Null_tag,Algebraic_structure_tag>::value));
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
int main(){
|
||||
{
|
||||
typedef CGAL::Coercion_traits<int,int> CT;
|
||||
BOOST_STATIC_ASSERT(( boost::is_same<CT::Type,int>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
( boost::is_same<CT::Are_implicit_interoperable,CGAL::Tag_true>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
|
|
@ -12,6 +13,7 @@ int main(){
|
|||
}
|
||||
{
|
||||
typedef CGAL::Coercion_traits<CGAL::Tag_true,CGAL::Tag_false> CT;
|
||||
BOOST_STATIC_ASSERT(( boost::is_same<CT::Type,void>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
( boost::is_same<CT::Are_implicit_interoperable,CGAL::Tag_false>::value));
|
||||
BOOST_STATIC_ASSERT(
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
int main(){
|
||||
typedef CGAL::Real_embeddable_traits<void> RET;
|
||||
|
||||
typedef RET::Real_embeddable Real_embeddable;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<void,Real_embeddable>::value));
|
||||
typedef RET::Type Type;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<void,Type>::value));
|
||||
|
||||
typedef RET::Is_real_embeddable Is_real_embeddable;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<CGAL::Tag_false,Is_real_embeddable>::value));
|
||||
|
|
|
|||
|
|
@ -32,27 +32,27 @@ template <> class Algebraic_structure_traits< CORE::BigFloat >
|
|||
typedef Tag_false Is_exact;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CORE::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Kth_root
|
||||
: public Binary_function<int, Algebraic_structure, Algebraic_structure> {
|
||||
: public Binary_function<int, Type, Type> {
|
||||
public:
|
||||
Algebraic_structure operator()( int k,
|
||||
const Algebraic_structure& x) const {
|
||||
Type operator()( int k,
|
||||
const Type& x) const {
|
||||
CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
|
||||
// CORE::radical isn't implemented for negative values of x, so we
|
||||
// have to handle this case separately
|
||||
if( x < 0 && k%2 != 0) {
|
||||
return Algebraic_structure(-CORE::radical( -x, k ) );
|
||||
return Type(-CORE::radical( -x, k ) );
|
||||
}
|
||||
|
||||
|
||||
return Algebraic_structure( CORE::radical( x, k ) );
|
||||
return Type( CORE::radical( x, k ) );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -65,35 +65,35 @@ template <> class Real_embeddable_traits< CORE::BigFloat >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CORE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CORE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return (Comparison_result) CORE::cmp( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
// this call is required to get reasonable values for the double
|
||||
// approximation
|
||||
return x.doubleValue();
|
||||
|
|
@ -101,9 +101,9 @@ template <> class Real_embeddable_traits< CORE::BigFloat >
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
Real_embeddable_traits<CORE::Expr>::To_interval to_interval;
|
||||
CORE::Expr temp(x);
|
||||
|
|
|
|||
|
|
@ -31,18 +31,18 @@ template <> class Algebraic_structure_traits< CORE::BigInt >
|
|||
public:
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
typedef INTERN_AST::Is_square_per_sqrt< Algebraic_structure >
|
||||
typedef INTERN_AST::Is_square_per_sqrt< Type >
|
||||
Is_square;
|
||||
|
||||
typedef INTERN_AST::Div_per_operator< Algebraic_structure > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Algebraic_structure > Mod;
|
||||
typedef INTERN_AST::Div_per_operator< Type > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Type > Mod;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
//! computes the largest NT not larger than the square root of \a a.
|
||||
Algebraic_structure operator()( const Algebraic_structure& x) const {
|
||||
Algebraic_structure result;
|
||||
Type operator()( const Type& x) const {
|
||||
Type result;
|
||||
mpz_sqrt(result.get_mp(), x.get_mp());
|
||||
return result;
|
||||
}
|
||||
|
|
@ -50,14 +50,14 @@ template <> class Algebraic_structure_traits< CORE::BigInt >
|
|||
|
||||
|
||||
class Gcd
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
if ( x == Algebraic_structure(0) && y == Algebraic_structure(0) )
|
||||
return Algebraic_structure(0);
|
||||
Algebraic_structure result;
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
if ( x == Type(0) && y == Type(0) )
|
||||
return Type(0);
|
||||
Type result;
|
||||
mpz_gcd(result.get_mp(), x.get_mp(), y.get_mp());
|
||||
return result;
|
||||
}
|
||||
|
|
@ -73,36 +73,36 @@ template <> class Real_embeddable_traits< CORE::BigInt >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CORE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CORE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
typedef Real_embeddable_traits<int> Int_traits;
|
||||
return Int_traits::Sign()( ::CORE::cmp(x,y));
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
// this call is required to get reasonable values for the double
|
||||
// approximation
|
||||
return x.doubleValue();
|
||||
|
|
@ -110,9 +110,9 @@ template <> class Real_embeddable_traits< CORE::BigInt >
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
Real_embeddable_traits<CORE::Expr>::To_interval to_interval;
|
||||
CORE::Expr temp(x);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,36 +59,36 @@ template <> class Real_embeddable_traits< CORE::BigRat >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CORE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CORE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
typedef Real_embeddable_traits<int> Int_traits;
|
||||
return Int_traits::Sign()( ::CORE::cmp(x,y));
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
// this call is required to get reasonable values for the double
|
||||
// approximation
|
||||
return x.doubleValue();
|
||||
|
|
@ -96,9 +96,9 @@ template <> class Real_embeddable_traits< CORE::BigRat >
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
Real_embeddable_traits<CORE::Expr>::To_interval to_interval;
|
||||
CORE::Expr temp(x);
|
||||
|
|
@ -114,7 +114,7 @@ template <> class Real_embeddable_traits< CORE::BigRat >
|
|||
template <>
|
||||
class Fraction_traits< CORE::BigRat > {
|
||||
public:
|
||||
typedef CORE::BigRat Fraction;
|
||||
typedef CORE::BigRat Type;
|
||||
typedef ::CGAL::Tag_true Is_fraction;
|
||||
typedef CORE::BigInt Numerator;
|
||||
typedef Numerator Denominator;
|
||||
|
|
@ -123,11 +123,11 @@ public:
|
|||
|
||||
class Decompose {
|
||||
public:
|
||||
typedef Fraction first_argument_type;
|
||||
typedef Type first_argument_type;
|
||||
typedef Numerator& second_argument_type;
|
||||
typedef Numerator& third_argument_type;
|
||||
void operator () (
|
||||
const Fraction& rat,
|
||||
const Type& rat,
|
||||
Numerator& num,
|
||||
Numerator& den) {
|
||||
num = CGAL_CORE_NUMERATOR(rat);
|
||||
|
|
@ -139,11 +139,11 @@ public:
|
|||
public:
|
||||
typedef Numerator first_argument_type;
|
||||
typedef Numerator second_argument_type;
|
||||
typedef Fraction result_type;
|
||||
Fraction operator ()(
|
||||
typedef Type result_type;
|
||||
Type operator ()(
|
||||
const Numerator& num ,
|
||||
const Numerator& den ) {
|
||||
return Fraction(num, den);
|
||||
return Type(num, den);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,18 +41,18 @@ template <> class Algebraic_structure_traits< CORE::Expr >
|
|||
typedef Tag_true Is_exact;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CORE::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Kth_root
|
||||
: public Binary_function<int, Algebraic_structure, Algebraic_structure> {
|
||||
: public Binary_function<int, Type, Type> {
|
||||
public:
|
||||
Algebraic_structure operator()( int k,
|
||||
const Algebraic_structure& x) const {
|
||||
Type operator()( int k,
|
||||
const Type& x) const {
|
||||
CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
|
||||
// CORE::radical isn't implemented for negative values of x, so we
|
||||
// have to handle this case separately
|
||||
|
|
@ -66,7 +66,7 @@ template <> class Algebraic_structure_traits< CORE::Expr >
|
|||
class Root_of {
|
||||
public:
|
||||
// typedef CORE::BigRat Boundary;
|
||||
typedef Algebraic_structure result_type;
|
||||
typedef Type result_type;
|
||||
|
||||
typedef Arity_tag< 3 > Arity;
|
||||
|
||||
|
|
@ -74,30 +74,30 @@ template <> class Algebraic_structure_traits< CORE::Expr >
|
|||
// constructs the kth roots of the polynomial
|
||||
// given by the iterator range, starting from 0.
|
||||
template< class ForwardIterator >
|
||||
Algebraic_structure operator()( int k,
|
||||
Type operator()( int k,
|
||||
ForwardIterator begin,
|
||||
ForwardIterator end) const {
|
||||
std::vector<Algebraic_structure> coeffs;
|
||||
std::vector<Type> coeffs;
|
||||
for(ForwardIterator it = begin; it != end; it++){
|
||||
coeffs.push_back(*it);
|
||||
}
|
||||
CORE::Polynomial<Algebraic_structure> polynomial(coeffs);
|
||||
return Algebraic_structure(polynomial,k);
|
||||
CORE::Polynomial<Type> polynomial(coeffs);
|
||||
return Type(polynomial,k);
|
||||
};
|
||||
|
||||
// TODO: Need to be fixed: polynomial<CORE::Expr>.eval() cannot return
|
||||
// CORE::BigFloat, so this does not compile.
|
||||
|
||||
/* template <class ForwardIterator>
|
||||
Algebraic_structure operator()( CORE::BigRat lower,
|
||||
Type operator()( CORE::BigRat lower,
|
||||
CORE::BigRat upper,
|
||||
ForwardIterator begin,
|
||||
ForwardIterator end) const {
|
||||
std::vector<Algebraic_structure> coeffs;
|
||||
std::vector<Type> coeffs;
|
||||
for(ForwardIterator it = begin; it != end; it++){
|
||||
coeffs.push_back(*it);
|
||||
}
|
||||
CORE::Polynomial<Algebraic_structure> polynomial(coeffs);
|
||||
CORE::Polynomial<Type> polynomial(coeffs);
|
||||
CORE::BigFloat lower_bf, upper_bf;
|
||||
CORE::BigFloat eval_at_lower(0), eval_at_upper(0);
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ template <> class Algebraic_structure_traits< CORE::Expr >
|
|||
}
|
||||
CORE::BFInterval interval(lower_bf,upper_bf);
|
||||
|
||||
return Algebraic_structure(polynomial,interval);
|
||||
return Type(polynomial,interval);
|
||||
}; */
|
||||
};
|
||||
|
||||
|
|
@ -130,39 +130,39 @@ template <> class Real_embeddable_traits< CORE::Expr >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CORE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CORE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return (Comparison_result) CORE::cmp( x, y );
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Real_embeddable,
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
|
||||
Comparison_result );
|
||||
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
// this call is required to get reasonable values for the double
|
||||
// approximation
|
||||
x.approx( 53, 1 );
|
||||
|
|
@ -171,9 +171,9 @@ template <> class Real_embeddable_traits< CORE::Expr >
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
std::pair<double,double> result;
|
||||
x.doubleInterval(result.first, result.second);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
//
|
||||
// Author(s) : Sylvain Pion
|
||||
|
||||
#ifndef CGAL_EXACT_TYPE_SELECTER_H
|
||||
#define CGAL_EXACT_TYPE_SELECTER_H
|
||||
#ifndef CGAL_EXACT_Type_SELECTER_H
|
||||
#define CGAL_EXACT_Type_SELECTER_H
|
||||
|
||||
// This is an undocumented private helper for Filtered_kernel.
|
||||
|
||||
|
|
@ -113,4 +113,4 @@ struct Exact_type_selecter<Lazy_exact_nt<ET> >
|
|||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_EXACT_TYPE_SELECTER_H
|
||||
#endif // CGAL_EXACT_Type_SELECTER_H
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
// Author(s) : Andreas Fabri, Sylvain Pion
|
||||
|
||||
|
||||
#ifndef CGAL_GMPQ_TYPE_H
|
||||
#define CGAL_GMPQ_TYPE_H
|
||||
#ifndef CGAL_GMPQ_Type_H
|
||||
#define CGAL_GMPQ_Type_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/GMP/Gmpz_type.h>
|
||||
|
|
@ -418,4 +418,4 @@ operator>>(std::istream& is, Gmpq &z)
|
|||
CGAL_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // CGAL_GMPQ_TYPE_H
|
||||
#endif // CGAL_GMPQ_Type_H
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
// Author(s) : Andreas Fabri, Stefan Schirra, Sylvain Pion
|
||||
|
||||
|
||||
#ifndef CGAL_GMPZ_TYPE_H
|
||||
#define CGAL_GMPZ_TYPE_H
|
||||
#ifndef CGAL_GMPZ_Type_H
|
||||
#define CGAL_GMPZ_Type_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <gmp.h>
|
||||
|
|
@ -477,4 +477,4 @@ operator>>(std::istream& is, Gmpz &z)
|
|||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_GMPZ_TYPE_H
|
||||
#endif // CGAL_GMPZ_Type_H
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
//
|
||||
// Author(s) : Bernd Gaertner <gaertner@inf.ethz.ch>
|
||||
|
||||
#ifndef CGAL_GMPZF_TYPE_H
|
||||
#define CGAL_GMPZF_TYPE_H
|
||||
#ifndef CGAL_GMPZF_Type_H
|
||||
#define CGAL_GMPZF_Type_H
|
||||
|
||||
// includes
|
||||
#include <CGAL/basic.h>
|
||||
|
|
@ -531,6 +531,6 @@ bool operator>(const Gmpzf &a, int b)
|
|||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_GMPZF_TYPE_H
|
||||
#endif // CGAL_GMPZF_Type_H
|
||||
|
||||
// ===== EOF ==================================================================
|
||||
|
|
|
|||
|
|
@ -39,27 +39,27 @@ template <> class Algebraic_structure_traits< Gmpq >
|
|||
typedef Tag_true Is_exact;
|
||||
|
||||
class Is_square
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure&,
|
||||
: public Binary_function< Type, Type&,
|
||||
bool > {
|
||||
public:
|
||||
bool operator()( const Algebraic_structure& x_, Algebraic_structure& y ) const {
|
||||
bool operator()( const Type& x_, Type& y ) const {
|
||||
Gmpq x( x_ );
|
||||
mpq_canonicalize( x.mpq() );
|
||||
Algebraic_structure_traits< Gmpz >::Sqrt sqrt;
|
||||
y = Gmpq( sqrt( x.numerator() ), sqrt( x.denominator() ) );
|
||||
return y*y == x;
|
||||
}
|
||||
bool operator()( const Algebraic_structure& x) const {
|
||||
Algebraic_structure y;
|
||||
bool operator()( const Type& x) const {
|
||||
Type y;
|
||||
return operator()(x,y);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class Simplify
|
||||
: public Unary_function< Algebraic_structure&, void > {
|
||||
: public Unary_function< Type&, void > {
|
||||
public:
|
||||
void operator()( Algebraic_structure& x) const {
|
||||
void operator()( Type& x) const {
|
||||
mpq_canonicalize( x.mpq() );
|
||||
}
|
||||
};
|
||||
|
|
@ -73,25 +73,25 @@ template <> class Real_embeddable_traits< Gmpq >
|
|||
public:
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return x.sign();
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return x.to_double();
|
||||
}
|
||||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
mpfr_t y;
|
||||
mpfr_init2 (y, 53); /* Assume IEEE-754 */
|
||||
mpfr_set_q (y, x.mpq(), GMP_RNDD);
|
||||
|
|
@ -110,7 +110,7 @@ template <> class Real_embeddable_traits< Gmpq >
|
|||
template <>
|
||||
class Fraction_traits< Gmpq > {
|
||||
public:
|
||||
typedef Gmpq Fraction;
|
||||
typedef Gmpq Type;
|
||||
typedef ::CGAL::Tag_true Is_fraction;
|
||||
typedef Gmpz Numerator;
|
||||
typedef Gmpz Denominator;
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ template <> class Algebraic_structure_traits< Gmpz >
|
|||
public:
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
typedef INTERN_AST::Is_square_per_sqrt< Algebraic_structure >
|
||||
typedef INTERN_AST::Is_square_per_sqrt< Type >
|
||||
Is_square;
|
||||
class Integral_division
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
Gmpz result;
|
||||
mpz_divexact(result.mpz(), x.mpz(), y.mpz());
|
||||
CGAL_postcondition_msg(result * y == x, "exact_division failed\n");
|
||||
|
|
@ -63,18 +63,18 @@ public:
|
|||
};
|
||||
|
||||
class Gcd
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
Gmpz result;
|
||||
mpz_gcd(result.mpz(), x.mpz(), y.mpz());
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
Type operator()( const Type& x,
|
||||
const int& y ) const {
|
||||
if (y > 0)
|
||||
{
|
||||
|
|
@ -85,19 +85,19 @@ public:
|
|||
return CGAL_NTS gcd(x, Gmpz(y));
|
||||
}
|
||||
|
||||
Algebraic_structure operator()( const int& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const int& x,
|
||||
const Type& y ) const {
|
||||
return CGAL_NTS gcd(Gmpz(x), y );
|
||||
}
|
||||
};
|
||||
|
||||
typedef INTERN_AST::Div_per_operator< Algebraic_structure > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Algebraic_structure > Mod;
|
||||
typedef INTERN_AST::Div_per_operator< Type > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Type > Mod;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
Gmpz result;
|
||||
mpz_sqrt(result.mpz(), x.mpz());
|
||||
return result;
|
||||
|
|
@ -110,25 +110,25 @@ template <> class Real_embeddable_traits< Gmpz >
|
|||
public:
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return x.sign();
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return x.to_double();
|
||||
}
|
||||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
mpfr_t y;
|
||||
mpfr_init2 (y, 53); /* Assume IEEE-754 */
|
||||
|
|
@ -145,7 +145,7 @@ public:
|
|||
template<> class Algebraic_structure_traits< Quotient<Gmpz> >
|
||||
: public INTERN_QUOTIENT::Algebraic_structure_traits_quotient_base<Quotient<Gmpz> >{
|
||||
// specialization of to double functor
|
||||
typedef Quotient<Gmpz> Algebraic_structure;
|
||||
typedef Quotient<Gmpz> Type;
|
||||
|
||||
struct To_double: public Unary_function<Quotient<Gmpz>, double>{
|
||||
double operator()(const Quotient<Gmpz>& quot){
|
||||
|
|
|
|||
|
|
@ -36,48 +36,48 @@ public:
|
|||
typedef Tag_true Is_exact;
|
||||
|
||||
struct Is_zero
|
||||
: public Unary_function< Algebraic_structure, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Algebraic_structure& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return x.is_zero();
|
||||
}
|
||||
};
|
||||
|
||||
struct Integral_division
|
||||
: public Binary_function< Algebraic_structure,
|
||||
Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()(
|
||||
const Type& x,
|
||||
const Type& y ) const {
|
||||
return x.integral_division(y);
|
||||
}
|
||||
};
|
||||
|
||||
struct Gcd
|
||||
: public Binary_function< Algebraic_structure,
|
||||
Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()(
|
||||
const Type& x,
|
||||
const Type& y ) const {
|
||||
return x.gcd(y);
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR(int);
|
||||
};
|
||||
|
||||
typedef INTERN_AST::Div_per_operator< Algebraic_structure > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Algebraic_structure > Mod;
|
||||
typedef INTERN_AST::Div_per_operator< Type > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Type > Mod;
|
||||
|
||||
struct Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
: public Unary_function< Type, Type > {
|
||||
Type operator()( const Type& x ) const {
|
||||
return x.sqrt();
|
||||
}
|
||||
};
|
||||
typedef INTERN_AST::Is_square_per_sqrt<Algebraic_structure> Is_square;
|
||||
typedef INTERN_AST::Is_square_per_sqrt<Type> Is_square;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -92,37 +92,37 @@ public:
|
|||
typedef AST::Is_zero Is_zero;
|
||||
|
||||
struct Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return x.sign();
|
||||
}
|
||||
};
|
||||
|
||||
struct Compare
|
||||
: public Binary_function< Real_embeddable,
|
||||
Real_embeddable,
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()(
|
||||
const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
const Type& x,
|
||||
const Type& y ) const {
|
||||
return x.compare(y);
|
||||
}
|
||||
};
|
||||
|
||||
struct To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return x.to_double();
|
||||
}
|
||||
};
|
||||
|
||||
struct To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
// dummy
|
||||
return std::pair<double,double>(0.0,0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -907,73 +907,73 @@ namespace INTERN_INTERVAL_NT {
|
|||
template< bool B > class Real_embeddable_traits< Interval_nt<B> >
|
||||
: public Real_embeddable_traits_base< Interval_nt<B> > {
|
||||
public:
|
||||
typedef Interval_nt<B> Real_embeddable;
|
||||
typedef Interval_nt<B> Type;
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, Uncertain< ::CGAL::Sign > > {
|
||||
: public Unary_function< Type, Uncertain< ::CGAL::Sign > > {
|
||||
public:
|
||||
Uncertain< ::CGAL::Sign > operator()( const Real_embeddable& x ) const {
|
||||
Uncertain< ::CGAL::Sign > operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Is_positive
|
||||
: public Unary_function< Real_embeddable, Uncertain<bool> > {
|
||||
: public Unary_function< Type, Uncertain<bool> > {
|
||||
public:
|
||||
Uncertain<bool> operator()( const Real_embeddable& x ) const {
|
||||
Uncertain<bool> operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::is_positive( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Is_negative
|
||||
: public Unary_function< Real_embeddable, Uncertain<bool> > {
|
||||
: public Unary_function< Type, Uncertain<bool> > {
|
||||
public:
|
||||
Uncertain<bool> operator()( const Real_embeddable& x ) const {
|
||||
Uncertain<bool> operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::is_negative( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Uncertain<Comparison_result> > {
|
||||
public:
|
||||
Uncertain<Comparison_result> operator()(
|
||||
const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
const Type& x,
|
||||
const Type& y ) const {
|
||||
return INTERN_INTERVAL_NT::compare( x, y );
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Real_embeddable,
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
|
||||
Comparison_result );
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::to_double( x );
|
||||
}
|
||||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::to_interval( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public :
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return CGAL_NTS is_finite( x.inf() ) && CGAL_NTS is_finite( x.sup() );
|
||||
}
|
||||
};
|
||||
|
|
@ -986,37 +986,37 @@ class Algebraic_structure_traits< Interval_nt<B> >
|
|||
: public Algebraic_structure_traits_base< Interval_nt<B>,
|
||||
Field_with_sqrt_tag > {
|
||||
public:
|
||||
typedef Interval_nt<B> Algebraic_structure;
|
||||
typedef Interval_nt<B> Type;
|
||||
typedef Tag_false Is_exact;
|
||||
|
||||
class Is_zero
|
||||
: public Unary_function< Algebraic_structure, Uncertain<bool> > {
|
||||
: public Unary_function< Type, Uncertain<bool> > {
|
||||
public:
|
||||
Uncertain<bool> operator()( const Algebraic_structure& x ) const {
|
||||
Uncertain<bool> operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::is_zero( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Is_one
|
||||
: public Unary_function< Algebraic_structure, Uncertain<bool> > {
|
||||
: public Unary_function< Type, Uncertain<bool> > {
|
||||
public:
|
||||
Uncertain<bool> operator()( const Algebraic_structure& x ) const {
|
||||
Uncertain<bool> operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::is_one( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Square
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::square( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return INTERN_INTERVAL_NT::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
|
@ -1067,7 +1067,7 @@ template<class A , bool P>
|
|||
struct Coercion_traits_interval_nt<A, Interval_nt<P>, Tag_true>{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_false Are_implicit_interoperable;
|
||||
typedef Interval_nt<P> Coercion_type;
|
||||
typedef Interval_nt<P> Type;
|
||||
struct Cast {
|
||||
typedef Interval_nt<P> result_type;
|
||||
Interval_nt<P> inline operator()(const Interval_nt<P>& x ) const {
|
||||
|
|
|
|||
|
|
@ -791,39 +791,39 @@ operator==(const Lazy_exact_nt<ET>& a, int b)
|
|||
|
||||
|
||||
template <typename ET1, typename ET2>
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Coercion_type >
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
|
||||
operator+(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
|
||||
{
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
return new Lazy_exact_Add<typename Coercion_traits<ET1, ET2>::Coercion_type,
|
||||
return new Lazy_exact_Add<typename Coercion_traits<ET1, ET2>::Type,
|
||||
ET1, ET2>(a, b);
|
||||
}
|
||||
|
||||
template <typename ET1, typename ET2>
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Coercion_type >
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
|
||||
operator-(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
|
||||
{
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
return new Lazy_exact_Sub<typename Coercion_traits<ET1, ET2>::Coercion_type,
|
||||
return new Lazy_exact_Sub<typename Coercion_traits<ET1, ET2>::Type,
|
||||
ET1, ET2>(a, b);
|
||||
}
|
||||
|
||||
template <typename ET1, typename ET2>
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Coercion_type >
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
|
||||
operator*(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
|
||||
{
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
return new Lazy_exact_Mul<typename Coercion_traits<ET1, ET2>::Coercion_type,
|
||||
return new Lazy_exact_Mul<typename Coercion_traits<ET1, ET2>::Type,
|
||||
ET1, ET2>(a, b);
|
||||
}
|
||||
|
||||
template <typename ET1, typename ET2>
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Coercion_type >
|
||||
Lazy_exact_nt< typename Coercion_traits<ET1, ET2>::Type >
|
||||
operator/(const Lazy_exact_nt<ET1>& a, const Lazy_exact_nt<ET2>& b)
|
||||
{
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
CGAL_precondition(b != 0);
|
||||
return new Lazy_exact_Div<typename Coercion_traits<ET1, ET2>::Coercion_type,
|
||||
return new Lazy_exact_Div<typename Coercion_traits<ET1, ET2>::Type,
|
||||
ET1, ET2>(a, b);
|
||||
}
|
||||
|
||||
|
|
@ -1078,7 +1078,7 @@ struct Div_mod_selector {
|
|||
NT& q,
|
||||
NT& r ) const {
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<
|
||||
typename Coercion_traits< NT1, NT2 >::Coercion_type, NT
|
||||
typename Coercion_traits< NT1, NT2 >::Type, NT
|
||||
>::value));
|
||||
|
||||
typename Coercion_traits< NT1, NT2 >::Cast cast;
|
||||
|
|
@ -1162,21 +1162,21 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
|
|||
::Is_real_embeddable, Tag_true >::value));
|
||||
|
||||
public:
|
||||
typedef Lazy_exact_nt<ET> Real_embeddable;
|
||||
typedef Lazy_exact_nt<ET> Type;
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& a ) const {
|
||||
Type operator()( const Type& a ) const {
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
return new Lazy_exact_Abs<ET>(a);
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& a ) const {
|
||||
::CGAL::Sign operator()( const Type& a ) const {
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
Uncertain< ::CGAL::Sign> res = CGAL_NTS sign(a.approx());
|
||||
if (is_singleton(res))
|
||||
|
|
@ -1187,11 +1187,11 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
|
|||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& a,
|
||||
const Real_embeddable& b ) const {
|
||||
Comparison_result operator()( const Type& a,
|
||||
const Type& b ) const {
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
if (a.identical(b))
|
||||
return EQUAL;
|
||||
|
|
@ -1202,15 +1202,15 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
|
|||
return CGAL_NTS compare(a.exact(), b.exact());
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Real_embeddable,
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
|
||||
Comparison_result );
|
||||
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& a ) const {
|
||||
double operator()( const Type& a ) const {
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
|
||||
const Interval_nt<false>& app = a.approx();
|
||||
|
|
@ -1233,18 +1233,18 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt<ET> >
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& a ) const {
|
||||
std::pair<double, double> operator()( const Type& a ) const {
|
||||
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
|
||||
return a.approx().pair();
|
||||
}
|
||||
};
|
||||
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return CGAL_NTS is_finite(x.approx()) || CGAL_NTS is_finite(x.exact());
|
||||
}
|
||||
};
|
||||
|
|
@ -1255,7 +1255,7 @@ template <class ET1, class ET2, class F>
|
|||
class Lazy_exact_nt_coercion_traits_base{
|
||||
typedef Tag_false Are_explicit_interoperable;
|
||||
typedef Tag_false Are_implicit_interoperable;
|
||||
//typedef Null_type Coercion_type
|
||||
//typedef Null_type Type
|
||||
typedef Null_functor Cast;
|
||||
};
|
||||
|
||||
|
|
@ -1266,19 +1266,19 @@ class Lazy_exact_nt_coercion_traits_base
|
|||
typedef Lazy_exact_nt<ET1> A;
|
||||
typedef Lazy_exact_nt<ET2> B;
|
||||
public:
|
||||
typedef Lazy_exact_nt<typename CT::Coercion_type> Coercion_type;
|
||||
typedef Lazy_exact_nt<typename CT::Type> Type;
|
||||
typedef typename CT::Are_implicit_interoperable Are_explicit_interoperable;
|
||||
typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable;
|
||||
|
||||
class Cast{
|
||||
private:
|
||||
template <class T>
|
||||
inline Coercion_type cast(const T& x) const{ return Coercion_type(x); }
|
||||
inline Coercion_type cast(const Coercion_type& x) const{ return x; }
|
||||
inline Type cast(const T& x) const{ return Type(x); }
|
||||
inline Type cast(const Type& x) const{ return x; }
|
||||
public:
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const A& x) const { return cast(x);}
|
||||
Coercion_type operator()(const B& x) const { return cast(x);}
|
||||
typedef Type result_type;
|
||||
Type operator()(const A& x) const { return cast(x);}
|
||||
Type operator()(const B& x) const { return cast(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -1308,7 +1308,7 @@ struct Coercion_traits< Lazy_exact_nt<ET1>, Lazy_exact_nt<ET2> >
|
|||
=boost::is_same< Are_implicit_interoperable, Tag_false>::value; \
|
||||
public: \
|
||||
typedef typename boost::mpl::if_c <interoperable,Null_tag,NT> \
|
||||
::type Coercion_type; \
|
||||
::type Type; \
|
||||
typedef typename boost::mpl::if_c <interoperable, Null_functor, \
|
||||
INTERN_CT::Cast_from_to<NTX,NT> >::type Cast; \
|
||||
}; \
|
||||
|
|
@ -1332,7 +1332,7 @@ template < class ET >
|
|||
class Fraction_traits_base <Lazy_exact_nt<ET> , CGAL::Tag_false>
|
||||
: public Fraction_traits<ET> {
|
||||
public:
|
||||
typedef Lazy_exact_nt<ET> Fraction;
|
||||
typedef Lazy_exact_nt<ET> Type;
|
||||
};
|
||||
|
||||
template < class ET >
|
||||
|
|
@ -1341,7 +1341,7 @@ class Fraction_traits_base <Lazy_exact_nt<ET> , CGAL::Tag_true>{
|
|||
typedef typename ETT::Numerator ET_numerator;
|
||||
typedef typename ETT::Denominator ET_denominator;
|
||||
public:
|
||||
typedef Lazy_exact_nt<ET> Fraction;
|
||||
typedef Lazy_exact_nt<ET> Type;
|
||||
typedef Tag_true Is_fraction;
|
||||
typedef Lazy_exact_nt<ET_numerator> Numerator;
|
||||
typedef Lazy_exact_nt<ET_denominator> Denominator;
|
||||
|
|
@ -1352,18 +1352,18 @@ public:
|
|||
return Denominator(common_factor(a.exact(),b.exact()));
|
||||
}
|
||||
};
|
||||
struct Compose : Binary_function<Fraction,Numerator,Denominator>{
|
||||
Fraction operator()(const Numerator& n, const Denominator& d) const {
|
||||
struct Compose : Binary_function<Type,Numerator,Denominator>{
|
||||
Type operator()(const Numerator& n, const Denominator& d) const {
|
||||
typename ETT::Compose compose;
|
||||
return Fraction(compose(n.exact(),d.exact()));
|
||||
return Type(compose(n.exact(),d.exact()));
|
||||
}
|
||||
};
|
||||
struct Decompose {
|
||||
typedef void result_type;
|
||||
typedef Fraction first_argument_type;
|
||||
typedef Type first_argument_type;
|
||||
typedef Numerator second_argument_type;
|
||||
typedef Denominator third_argument_type;
|
||||
void operator()(const Fraction& f, Numerator& n, Denominator& d) const {
|
||||
void operator()(const Type& f, Numerator& n, Denominator& d) const {
|
||||
typename ETT::Decompose decompose;
|
||||
ET_numerator nn;
|
||||
ET_denominator dd;
|
||||
|
|
|
|||
|
|
@ -376,13 +376,13 @@ template <> class Algebraic_structure_traits< MP_Float >
|
|||
#endif
|
||||
|
||||
struct Integral_division
|
||||
: public Binary_function< Algebraic_structure,
|
||||
Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()(
|
||||
const Type& x,
|
||||
const Type& y ) const {
|
||||
#ifdef CGAL_MP_FLOAT_ALLOW_INEXACT // inexact
|
||||
return x/y;
|
||||
#else // exact
|
||||
|
|
@ -396,44 +396,44 @@ template <> class Algebraic_structure_traits< MP_Float >
|
|||
|
||||
|
||||
class Square
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return INTERN_MP_FLOAT::square(x);
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CGAL_MP_FLOAT_ALLOW_INEXACT
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return approximate_sqrt( x );
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
class Gcd
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return INTERN_MP_FLOAT::gcd( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
class Div
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return INTERN_MP_FLOAT::div( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
typedef INTERN_AST::Mod_per_operator< Algebraic_structure > Mod;
|
||||
typedef INTERN_AST::Mod_per_operator< Type > Mod;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -444,35 +444,35 @@ template <> class Real_embeddable_traits< MP_Float >
|
|||
public:
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return x.sign();
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return INTERN_MP_FLOAT::compare( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return INTERN_MP_FLOAT::to_double( x );
|
||||
}
|
||||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
return INTERN_MP_FLOAT::to_interval( x );
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
//
|
||||
// Author(s) : Sylvain Pion, Michael Hemmer
|
||||
|
||||
#ifndef CGAL_NUMBER_TYPE_CHECKER_H
|
||||
#define CGAL_NUMBER_TYPE_CHECKER_H
|
||||
#ifndef CGAL_NUMBER_Type_CHECKER_H
|
||||
#define CGAL_NUMBER_Type_CHECKER_H
|
||||
|
||||
#include <CGAL/number_type_basic.h>
|
||||
|
||||
|
|
@ -445,14 +445,14 @@ class NTC_AST_base
|
|||
private:
|
||||
typedef Algebraic_structure_traits<NT1> AST1;
|
||||
typedef Algebraic_structure_traits<NT2> AST2;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Algebraic_structure;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Type;
|
||||
|
||||
public:
|
||||
//CGAL::Algebraic_structure_traits<>::Simplify
|
||||
class Simplify
|
||||
: public Unary_function< Algebraic_structure& , void > {
|
||||
: public Unary_function< Type& , void > {
|
||||
public:
|
||||
void operator()( Algebraic_structure& a) const {
|
||||
void operator()( Type& a) const {
|
||||
typename AST1::Simplify()(a.n1());
|
||||
typename AST2::Simplify()(a.n2());
|
||||
CGAL_assertion(a.is_valid());
|
||||
|
|
@ -461,9 +461,9 @@ public:
|
|||
|
||||
//CGAL::Algebraic_structure_traits< >::Is_zero
|
||||
class Is_zero
|
||||
: public Unary_function< Algebraic_structure, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()(const Algebraic_structure& a ) const {
|
||||
bool operator()(const Type& a ) const {
|
||||
bool b1 = typename AST1::Is_zero()(a.n1());
|
||||
bool b2 = typename AST2::Is_zero()(a.n2());
|
||||
CGAL_assertion(b1 == b2 );
|
||||
|
|
@ -474,9 +474,9 @@ public:
|
|||
|
||||
// CGAL::Algebraic_structure_traits< >::Is_one
|
||||
class Is_one
|
||||
: public Unary_function< Algebraic_structure, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()(const Algebraic_structure& a) const {
|
||||
bool operator()(const Type& a) const {
|
||||
bool b1 = typename AST1::Is_one()(a.n1());
|
||||
bool b2 = typename AST2::Is_one()(a.n2());
|
||||
CGAL_assertion(b1 == b2 );
|
||||
|
|
@ -486,10 +486,10 @@ public:
|
|||
};
|
||||
// CGAL::Algebraic_structure_traits< >::Square
|
||||
class Square
|
||||
: public Unary_function< Algebraic_structure , Algebraic_structure > {
|
||||
: public Unary_function< Type , Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(const Algebraic_structure& a) const {
|
||||
return Algebraic_structure(
|
||||
Type operator()(const Type& a) const {
|
||||
return Type(
|
||||
typename AST1::Square()(a.n1()),
|
||||
typename AST2::Square()(a.n2()));
|
||||
}
|
||||
|
|
@ -498,11 +498,11 @@ public:
|
|||
|
||||
// CGAL::Algebraic_structure_traits< >::Unit_part
|
||||
class Unit_part
|
||||
: public Unary_function< Algebraic_structure , Algebraic_structure > {
|
||||
: public Unary_function< Type , Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(const Algebraic_structure& a) const {
|
||||
Type operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("AST::Unit_part");
|
||||
return Algebraic_structure(
|
||||
return Type(
|
||||
typename AST1::Unit_part()(a.n1()),
|
||||
typename AST2::Unit_part()(a.n2()));
|
||||
}
|
||||
|
|
@ -518,21 +518,21 @@ class NTC_AST_base
|
|||
private:
|
||||
typedef Algebraic_structure_traits<NT1> AST1;
|
||||
typedef Algebraic_structure_traits<NT2> AST2;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Algebraic_structure;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Type;
|
||||
|
||||
public:
|
||||
|
||||
// CGAL::Algebraic_structure_traits< >::Integral_division
|
||||
class Integral_division
|
||||
: public Binary_function< Algebraic_structure,
|
||||
Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& a,
|
||||
const Algebraic_structure& b) const {
|
||||
Type operator()(
|
||||
const Type& a,
|
||||
const Type& b) const {
|
||||
CGAL_NT_CHECK_DEBUG("AST::Integral_division");
|
||||
return Algebraic_structure(
|
||||
return Type(
|
||||
typename AST1::Integral_division()(a.n1(),b.n1()),
|
||||
typename AST2::Integral_division()(a.n2(),b.n2()));
|
||||
}
|
||||
|
|
@ -549,19 +549,19 @@ class NTC_AST_base
|
|||
private:
|
||||
typedef Algebraic_structure_traits<NT1> AST1;
|
||||
typedef Algebraic_structure_traits<NT2> AST2;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Algebraic_structure;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Type;
|
||||
public:
|
||||
// CGAL::Algebraic_structure_traits< >::Gcd
|
||||
class Gcd
|
||||
: public Binary_function< Algebraic_structure,
|
||||
Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& a,
|
||||
const Algebraic_structure& b) const {
|
||||
Type operator()(
|
||||
const Type& a,
|
||||
const Type& b) const {
|
||||
CGAL_NT_CHECK_DEBUG("AST::Gcd");
|
||||
return Algebraic_structure(
|
||||
return Type(
|
||||
typename AST1::Gcd()(a.n1(),b.n1()),
|
||||
typename AST2::Gcd()(a.n2(),b.n2()));
|
||||
}
|
||||
|
|
@ -577,34 +577,34 @@ class NTC_AST_base
|
|||
private:
|
||||
typedef Algebraic_structure_traits<NT1> AST1;
|
||||
typedef Algebraic_structure_traits<NT2> AST2;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Algebraic_structure;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Type;
|
||||
public:
|
||||
// CGAL::Algebraic_structure_traits< >::Div
|
||||
class Div
|
||||
: public Binary_function< Algebraic_structure,
|
||||
Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& a,
|
||||
const Algebraic_structure& b) const {
|
||||
Type operator()(
|
||||
const Type& a,
|
||||
const Type& b) const {
|
||||
CGAL_NT_CHECK_DEBUG("AST::Div");
|
||||
return Algebraic_structure(
|
||||
return Type(
|
||||
typename AST1::Div()(a.n1(),b.n1()),
|
||||
typename AST2::Div()(a.n2(),b.n2()));
|
||||
}
|
||||
};
|
||||
// CGAL::Algebraic_structure_traits< >::Mod
|
||||
class Mod
|
||||
: public Binary_function< Algebraic_structure,
|
||||
Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(
|
||||
const Algebraic_structure& a,
|
||||
const Algebraic_structure& b) const {
|
||||
Type operator()(
|
||||
const Type& a,
|
||||
const Type& b) const {
|
||||
CGAL_NT_CHECK_DEBUG("AST::Mod");
|
||||
return Algebraic_structure(
|
||||
return Type(
|
||||
typename AST1::Mod()(a.n1(),b.n1()),
|
||||
typename AST2::Mod()(a.n2(),b.n2()));
|
||||
}
|
||||
|
|
@ -613,25 +613,25 @@ public:
|
|||
// CGAL::Algebraic_structure_traits< >::Div_mod
|
||||
class Div_mod {
|
||||
public:
|
||||
typedef Algebraic_structure first_argument_type;
|
||||
typedef Algebraic_structure second_argument_type;
|
||||
typedef Algebraic_structure& third_argument_type;
|
||||
typedef Algebraic_structure& fourth_argument_type;
|
||||
typedef Type first_argument_type;
|
||||
typedef Type second_argument_type;
|
||||
typedef Type& third_argument_type;
|
||||
typedef Type& fourth_argument_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
typedef void result_type;
|
||||
|
||||
void operator()(
|
||||
const Algebraic_structure& a,
|
||||
const Algebraic_structure& b,
|
||||
Algebraic_structure& q,
|
||||
Algebraic_structure& r) const {
|
||||
const Type& a,
|
||||
const Type& b,
|
||||
Type& q,
|
||||
Type& r) const {
|
||||
CGAL_NT_CHECK_DEBUG("AST::Div_mod");
|
||||
NT1 q1,r1;
|
||||
NT2 q2,r2;
|
||||
typename AST1::Div_mod()(a.n1(),b.n1(),q1,r1);
|
||||
typename AST1::Div_mod()(a.n2(),b.n2(),q2,r2);
|
||||
q = Algebraic_structure(q1,q2);
|
||||
r = Algebraic_structure(r1,r2);
|
||||
q = Type(q1,q2);
|
||||
r = Type(r1,r2);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -653,17 +653,17 @@ class NTC_AST_base
|
|||
private:
|
||||
typedef Algebraic_structure_traits<NT1> AST1;
|
||||
typedef Algebraic_structure_traits<NT2> AST2;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Algebraic_structure;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Type;
|
||||
|
||||
public:
|
||||
|
||||
// CGAL::Algebraic_structure_traits< >::Sqrt
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure , Algebraic_structure > {
|
||||
: public Unary_function< Type , Type > {
|
||||
public:
|
||||
Algebraic_structure operator()(const Algebraic_structure& a) const {
|
||||
Type operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("AST::Sqrt");
|
||||
return Algebraic_structure(
|
||||
return Type(
|
||||
typename AST1::Sqrt()(a.n1()),
|
||||
typename AST2::Sqrt()(a.n2()));
|
||||
}
|
||||
|
|
@ -681,7 +681,7 @@ class Algebraic_structure_traits <Number_type_checker<NT1, NT2, Cmp> >
|
|||
{
|
||||
typedef Algebraic_structure_traits<NT1> AST1;
|
||||
public:
|
||||
typedef Number_type_checker< NT1, NT2, Cmp> Algebraic_structure;
|
||||
typedef Number_type_checker< NT1, NT2, Cmp> Type;
|
||||
typedef typename AST1::Algebraic_structure_tag Algebraic_structure_tag;
|
||||
typedef typename AST1::Is_exact Is_exact;
|
||||
|
||||
|
|
@ -705,16 +705,16 @@ class NTC_RET_base
|
|||
private:
|
||||
typedef Real_embeddable_traits<NT1> RET1;
|
||||
typedef Real_embeddable_traits<NT2> RET2;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Real_embeddable;
|
||||
typedef Number_type_checker<NT1, NT2, Cmp> Type;
|
||||
public:
|
||||
|
||||
// CGAL::Real_embeddable_traits< >::Abs
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable , Real_embeddable > {
|
||||
: public Unary_function< Type , Type > {
|
||||
public:
|
||||
Real_embeddable operator()(const Real_embeddable& a) const {
|
||||
Type operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::Abs");
|
||||
return Real_embeddable(
|
||||
return Type(
|
||||
typename RET1::Abs()(a.n1()),
|
||||
typename RET2::Abs()(a.n2()));
|
||||
}
|
||||
|
|
@ -722,9 +722,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::Sign
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable , ::CGAL::Sign > {
|
||||
: public Unary_function< Type , ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()(const Real_embeddable& a) const {
|
||||
::CGAL::Sign operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::Sign");
|
||||
::CGAL::Sign r1 = typename RET1::Sign()(a.n1());
|
||||
::CGAL::Sign r2 = typename RET2::Sign()(a.n2());
|
||||
|
|
@ -735,9 +735,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::Is_finite
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable , bool > {
|
||||
: public Unary_function< Type , bool > {
|
||||
public:
|
||||
bool operator()(const Real_embeddable& a) const {
|
||||
bool operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::Is_finite");
|
||||
bool r1 = typename RET1::Is_finite()(a.n1());
|
||||
bool r2 = typename RET2::Is_finite()(a.n2());
|
||||
|
|
@ -748,9 +748,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::Is_positive
|
||||
class Is_positive
|
||||
: public Unary_function< Real_embeddable , bool > {
|
||||
: public Unary_function< Type , bool > {
|
||||
public:
|
||||
bool operator()(const Real_embeddable& a) const {
|
||||
bool operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::Is_positive");
|
||||
bool r1 = typename RET1::Is_positive()(a.n1());
|
||||
bool r2 = typename RET2::Is_positive()(a.n2());
|
||||
|
|
@ -761,9 +761,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::Is_negative
|
||||
class Is_negative
|
||||
: public Unary_function< Real_embeddable , bool > {
|
||||
: public Unary_function< Type , bool > {
|
||||
public:
|
||||
bool operator()(const Real_embeddable& a) const {
|
||||
bool operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::Is_negative");
|
||||
bool r1 = typename RET1::Is_negative()(a.n1());
|
||||
bool r2 = typename RET2::Is_negative()(a.n2());
|
||||
|
|
@ -774,9 +774,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::Is_zero
|
||||
class Is_zero
|
||||
: public Unary_function< Real_embeddable , bool > {
|
||||
: public Unary_function< Type , bool > {
|
||||
public:
|
||||
bool operator()(const Real_embeddable& a) const {
|
||||
bool operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::Is_zero");
|
||||
bool r1 = typename RET1::Is_zero()(a.n1());
|
||||
bool r2 = typename RET2::Is_zero()(a.n2());
|
||||
|
|
@ -787,9 +787,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::Compare
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable , Real_embeddable, Comparison_result > {
|
||||
: public Binary_function< Type , Type, Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()(const Real_embeddable& a, const Real_embeddable& b) const {
|
||||
Comparison_result operator()(const Type& a, const Type& b) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::Compare");
|
||||
Comparison_result r1 = typename RET1::Compare()(a.n1(),b.n1());
|
||||
Comparison_result r2 = typename RET2::Compare()(a.n2(),b.n2());
|
||||
|
|
@ -800,9 +800,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::To_double
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable , double > {
|
||||
: public Unary_function< Type , double > {
|
||||
public:
|
||||
double operator()(const Real_embeddable& a) const {
|
||||
double operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::To_double");
|
||||
double r1 = typename RET1::To_double()(a.n1());
|
||||
double r2 = typename RET2::To_double()(a.n2());
|
||||
|
|
@ -813,9 +813,9 @@ public:
|
|||
|
||||
// CGAL::Real_embeddable_traits< >::To_interval
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable , std::pair<double, double> > {
|
||||
: public Unary_function< Type , std::pair<double, double> > {
|
||||
public:
|
||||
std::pair<double, double> operator()(const Real_embeddable& a) const {
|
||||
std::pair<double, double> operator()(const Type& a) const {
|
||||
CGAL_NT_CHECK_DEBUG("RET::To_interval");
|
||||
std::pair<double, double> r1 = typename RET1::To_interval()(a.n1());
|
||||
std::pair<double, double> r2 = typename RET2::To_interval()(a.n2());
|
||||
|
|
@ -835,7 +835,7 @@ class Real_embeddable_traits
|
|||
{
|
||||
typedef Real_embeddable_traits<NT1> RET1;
|
||||
public:
|
||||
typedef Number_type_checker< NT1, NT2, Cmp > Real_embeddable;
|
||||
typedef Number_type_checker< NT1, NT2, Cmp > Type;
|
||||
typedef typename RET1::Is_real_embeddable Is_real_embeddable;
|
||||
};
|
||||
|
||||
|
|
@ -844,10 +844,10 @@ struct Coercion_traits< Number_type_checker<NT1,NT2,Cmp>,
|
|||
Number_type_checker<NT1,NT2,Cmp> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Number_type_checker<NT1,NT2,Cmp> Coercion_type;
|
||||
typedef Number_type_checker<NT1,NT2,Cmp> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Coercion_type& x) const { return x;}
|
||||
typedef Type result_type;
|
||||
Type operator()(const Type& x) const { return x;}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -855,11 +855,11 @@ template < typename NT1, typename NT2, typename Cmp >
|
|||
struct Coercion_traits< Number_type_checker<NT1,NT2,Cmp>, int >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Number_type_checker<NT1,NT2,Cmp> Coercion_type;
|
||||
typedef Number_type_checker<NT1,NT2,Cmp> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Coercion_type& x) const { return x;}
|
||||
Coercion_type operator()(int x) const { return Coercion_type(x);}
|
||||
typedef Type result_type;
|
||||
Type operator()(const Type& x) const { return x;}
|
||||
Type operator()(int x) const { return Type(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -874,7 +874,7 @@ template < typename NT_checker, typename Tag = Tag_false >
|
|||
struct Coercion_traits_double{
|
||||
typedef Tag_false Are_explicit_interoperable;
|
||||
typedef Tag_false Are_implicit_interoperable;
|
||||
typedef Null_tag Coercion_type;
|
||||
typedef Null_tag Type;
|
||||
};
|
||||
|
||||
template < typename NT1, typename NT2, typename Cmp>
|
||||
|
|
@ -882,12 +882,12 @@ struct Coercion_traits_double< Number_type_checker<NT1,NT2,Cmp> ,
|
|||
Tag_true >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Number_type_checker<NT1,NT2,Cmp> Coercion_type;
|
||||
typedef Number_type_checker<NT1,NT2,Cmp> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Coercion_type& x) const { return x;}
|
||||
Coercion_type operator()(const double& x) const {
|
||||
return Coercion_type(x);
|
||||
typedef Type result_type;
|
||||
Type operator()(const Type& x) const { return x;}
|
||||
Type operator()(const double& x) const {
|
||||
return Type(x);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -926,4 +926,4 @@ operator>> (std::istream & is, Number_type_checker<NT1, NT2, Cmp> &b)
|
|||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_NUMBER_TYPE_CHECKER_H
|
||||
#endif // CGAL_NUMBER_Type_CHECKER_H
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
// Author(s) : Sylvain Pion, Monique Teillaud, Athanasios Kakargias
|
||||
// Olivier Devillers
|
||||
|
||||
#ifndef CGAL_NUMBER_TYPES_ROOT_OF_COMPARISON_FUNCTIONS_22_H
|
||||
#define CGAL_NUMBER_TYPES_ROOT_OF_COMPARISON_FUNCTIONS_22_H
|
||||
#ifndef CGAL_NUMBER_TypeS_ROOT_OF_COMPARISON_FUNCTIONS_22_H
|
||||
#define CGAL_NUMBER_TypeS_ROOT_OF_COMPARISON_FUNCTIONS_22_H
|
||||
|
||||
#include <CGAL/enum.h>
|
||||
#include <CGAL/kernel_assertions.h>
|
||||
|
|
@ -221,4 +221,4 @@ inline FT calcD(const FT& A1, const FT& I1, const FT& A2, const FT& I2)
|
|||
} // namespace CGALi
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_NUMBER_TYPES_ROOT_OF_COMPARISON_FUNCTIONS_22_H
|
||||
#endif // CGAL_NUMBER_TypeS_ROOT_OF_COMPARISON_FUNCTIONS_22_H
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ template<class NT> class Algebraic_structure_traits_quotient_base;
|
|||
template< class NT > class Algebraic_structure_traits_quotient_base< Quotient<NT> >
|
||||
: public Algebraic_structure_traits_base< Quotient<NT>, Field_tag > {
|
||||
public:
|
||||
typedef Quotient<NT> Algebraic_structure;
|
||||
typedef Quotient<NT> Type;
|
||||
|
||||
typedef typename Algebraic_structure_traits<NT>::Is_exact Is_exact;
|
||||
|
||||
|
|
@ -555,15 +555,15 @@ public:
|
|||
typedef typename boost::mpl::if_c<
|
||||
!boost::is_same< typename Algebraic_structure_traits<NT>::Sqrt,
|
||||
Null_functor >::value,
|
||||
typename INTERN_QUOTIENT::Sqrt_selector< Algebraic_structure,
|
||||
typename INTERN_QUOTIENT::Sqrt_selector< Type,
|
||||
Is_exact >::Sqrt,
|
||||
Null_functor
|
||||
>::type Sqrt;
|
||||
|
||||
class Simplify
|
||||
: public Unary_function< Algebraic_structure&, void > {
|
||||
: public Unary_function< Type&, void > {
|
||||
public:
|
||||
void operator()( Algebraic_structure& x) const {
|
||||
void operator()( Type& x) const {
|
||||
x.normalize();
|
||||
}
|
||||
};
|
||||
|
|
@ -576,22 +576,22 @@ template < class NT > class Real_embeddable_traits_quotient_base< Quotient<NT> >
|
|||
: public INTERN_RET::Real_embeddable_traits_base_selector< Quotient<NT>,
|
||||
typename Real_embeddable_traits< NT >::Is_real_embeddable > {
|
||||
public:
|
||||
typedef Quotient<NT> Real_embeddable;
|
||||
typedef Quotient<NT> Type;
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return quotient_cmp(x, y);
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
// Original global function was marked with an TODO!!
|
||||
if (x.num == 0 )
|
||||
return 0;
|
||||
|
|
@ -621,9 +621,9 @@ template < class NT > class Real_embeddable_traits_quotient_base< Quotient<NT> >
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
Interval_nt<> quot =
|
||||
Interval_nt<>(CGAL_NTS to_interval(x.numerator())) /
|
||||
Interval_nt<>(CGAL_NTS to_interval(x.denominator()));
|
||||
|
|
@ -632,9 +632,9 @@ template < class NT > class Real_embeddable_traits_quotient_base< Quotient<NT> >
|
|||
};
|
||||
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return CGAL_NTS is_finite(x.num) && CGAL_NTS is_finite(x.den);
|
||||
}
|
||||
};
|
||||
|
|
@ -659,13 +659,13 @@ struct Coercion_traits<typename First_if_different<int, NT>::Type,Quotient<NT> >
|
|||
{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Quotient<NT> Coercion_type;
|
||||
typedef Quotient<NT> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Quotient<NT>& x) const { return x;}
|
||||
Coercion_type operator()(
|
||||
typedef Type result_type;
|
||||
Type operator()(const Quotient<NT>& x) const { return x;}
|
||||
Type operator()(
|
||||
const typename First_if_different<int, NT>::Type& x) const {
|
||||
return Coercion_type(x);}
|
||||
return Type(x);}
|
||||
};
|
||||
};
|
||||
template <class NT>
|
||||
|
|
@ -679,13 +679,13 @@ struct Coercion_traits<typename First_if_different<double, NT>::Type,
|
|||
Quotient<NT> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Quotient<NT> Coercion_type;
|
||||
typedef Quotient<NT> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Quotient<NT>& x) const { return x;}
|
||||
Coercion_type operator()(
|
||||
typedef Type result_type;
|
||||
Type operator()(const Quotient<NT>& x) const { return x;}
|
||||
Type operator()(
|
||||
const typename First_if_different<double, NT>::Type& x) const {
|
||||
return Coercion_type(x);}
|
||||
return Type(x);}
|
||||
};
|
||||
};
|
||||
template <class NT>
|
||||
|
|
@ -704,7 +704,7 @@ CGAL_DEFINE_COERCION_TRAITS_FROM_TO_TEM ( NT, Quotient<NT>, class NT);
|
|||
template <class NT>
|
||||
class Fraction_traits< Quotient<NT> > {
|
||||
public:
|
||||
typedef Quotient<NT> Fraction;
|
||||
typedef Quotient<NT> Type;
|
||||
typedef ::CGAL::Tag_true Is_fraction;
|
||||
typedef NT Numerator;
|
||||
typedef Numerator Denominator;
|
||||
|
|
@ -716,11 +716,11 @@ public:
|
|||
|
||||
class Decompose {
|
||||
public:
|
||||
typedef Fraction first_argument_type;
|
||||
typedef Type first_argument_type;
|
||||
typedef Numerator& second_argument_type;
|
||||
typedef Numerator& third_argument_type;
|
||||
void operator () (
|
||||
const Fraction& rat,
|
||||
const Type& rat,
|
||||
Numerator& num,
|
||||
Numerator& den) {
|
||||
num = rat.numerator();
|
||||
|
|
@ -732,11 +732,11 @@ public:
|
|||
public:
|
||||
typedef Numerator first_argument_type;
|
||||
typedef Numerator second_argument_type;
|
||||
typedef Fraction result_type;
|
||||
Fraction operator ()(
|
||||
typedef Type result_type;
|
||||
Type operator ()(
|
||||
const Numerator& num ,
|
||||
const Numerator& den ) {
|
||||
Fraction result(num, den);
|
||||
Type result(num, den);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -305,12 +305,12 @@ template <class RT>
|
|||
struct Coercion_traits< RT , Root_of_2<RT> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Root_of_2<RT> Coercion_type;
|
||||
typedef Root_of_2<RT> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Root_of_2<RT>& x) const { return x;}
|
||||
Coercion_type operator()(const RT& x) const {
|
||||
return Coercion_type(x);}
|
||||
typedef Type result_type;
|
||||
Type operator()(const Root_of_2<RT>& x) const { return x;}
|
||||
Type operator()(const RT& x) const {
|
||||
return Type(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -318,12 +318,12 @@ template <class RT>
|
|||
struct Coercion_traits< CGAL_int(RT) , Root_of_2<RT> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Root_of_2<RT> Coercion_type;
|
||||
typedef Root_of_2<RT> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Root_of_2<RT>& x) const { return x;}
|
||||
Coercion_type operator()(CGAL_int(RT) x) const {
|
||||
return Coercion_type(x);}
|
||||
typedef Type result_type;
|
||||
Type operator()(const Root_of_2<RT>& x) const { return x;}
|
||||
Type operator()(CGAL_int(RT) x) const {
|
||||
return Type(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -331,12 +331,12 @@ template <class RT>
|
|||
struct Coercion_traits< typename Root_of_traits<RT>::RootOf_1 , Root_of_2<RT> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef Root_of_2<RT> Coercion_type;
|
||||
typedef Root_of_2<RT> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const Root_of_2<RT>& x) const { return x;}
|
||||
Coercion_type operator()(const RT& x) const {
|
||||
return Coercion_type(x);}
|
||||
typedef Type result_type;
|
||||
Type operator()(const Root_of_2<RT>& x) const { return x;}
|
||||
Type operator()(const RT& x) const {
|
||||
return Type(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ class Algebraic_structure_traits<Root_of_2<RT> >
|
|||
:public Algebraic_structure_traits_base<Root_of_2<RT> , Null_tag >{
|
||||
public:
|
||||
|
||||
typedef Root_of_2<RT> Algebraic_structure;
|
||||
typedef Root_of_2<RT> Type;
|
||||
typedef typename Algebraic_structure_traits<RT>::Is_exact Is_exact;
|
||||
struct Square
|
||||
: public Unary_function< Root_of_2<RT> , Root_of_2<RT> >{
|
||||
|
|
@ -433,21 +433,21 @@ class Real_embeddable_traits<Root_of_2<RT> >
|
|||
typedef typename Root_of_traits<RT>::RootOf_1 Root_of_1;
|
||||
public:
|
||||
|
||||
typedef Root_of_2<RT> Real_embeddable;
|
||||
typedef Root_of_2<RT> Type;
|
||||
typedef Tag_true Is_real_embeddable;
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable >{
|
||||
: public Unary_function< Type, Type >{
|
||||
public:
|
||||
Real_embeddable operator()(const Real_embeddable& x) const {
|
||||
Type operator()(const Type& x) const {
|
||||
return (x>=0)?x:-x;
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign >{
|
||||
: public Unary_function< Type, ::CGAL::Sign >{
|
||||
public:
|
||||
::CGAL::Sign operator()(const Real_embeddable& a) const {
|
||||
::CGAL::Sign operator()(const Type& a) const {
|
||||
const ::CGAL::Sign sign_alpha = CGAL_NTS sign(a.alpha());
|
||||
if (a.is_rational()) return (sign_alpha);
|
||||
// If alpha and beta have the same sign, return this sign.
|
||||
|
|
@ -465,13 +465,13 @@ public:
|
|||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable,
|
||||
Real_embeddable,
|
||||
: public Binary_function< Type,
|
||||
Type,
|
||||
Comparison_result >{
|
||||
public:
|
||||
Comparison_result operator()(
|
||||
const Real_embeddable& a,
|
||||
const Real_embeddable& b) const{
|
||||
const Type& a,
|
||||
const Type& b) const{
|
||||
typedef typename Root_of_traits< RT >::RootOf_1 FT;
|
||||
typedef typename First_if_different<FT, RT>::Type WhatType;
|
||||
typedef typename boost::is_same< WhatType, RT > do_not_filter;
|
||||
|
|
@ -585,7 +585,7 @@ public:
|
|||
Comparison_result
|
||||
inline
|
||||
operator()(
|
||||
const Real_embeddable& a,
|
||||
const Type& a,
|
||||
const Root_of_1& b
|
||||
) const{
|
||||
typedef typename Root_of_traits< RT >::RootOf_1 FT;
|
||||
|
|
@ -614,13 +614,13 @@ public:
|
|||
inline
|
||||
operator()(
|
||||
const Root_of_1& a,
|
||||
const Real_embeddable& b
|
||||
const Type& b
|
||||
) const{ return opposite(this->operator()(b,a) ); }
|
||||
|
||||
Comparison_result
|
||||
inline
|
||||
operator()(
|
||||
const Real_embeddable& a,
|
||||
const Type& a,
|
||||
const RT& b
|
||||
) const{
|
||||
typedef typename Root_of_traits< RT >::RootOf_1 FT;
|
||||
|
|
@ -668,9 +668,9 @@ public:
|
|||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double >{
|
||||
: public Unary_function< Type, double >{
|
||||
public:
|
||||
double operator()(const Real_embeddable& x) const {
|
||||
double operator()(const Type& x) const {
|
||||
typedef typename Root_of_traits<RT>::RootOf_1 FT;
|
||||
typedef Rational_traits< FT > Rational;
|
||||
Rational r;
|
||||
|
|
@ -692,9 +692,9 @@ public:
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > >{
|
||||
: public Unary_function< Type, std::pair< double, double > >{
|
||||
public:
|
||||
std::pair<double,double> operator()(const Real_embeddable& x) const {
|
||||
std::pair<double,double> operator()(const Type& x) const {
|
||||
|
||||
if(x.is_rational()) return CGAL_NTS to_interval(x.alpha());
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct Root_of_traits_helper < FT, Field_tag >
|
|||
typedef FT Root_of_1;
|
||||
private:
|
||||
typedef Fraction_traits<FT> FrT;
|
||||
// Field must be a Fraction (Decomposable)
|
||||
// Field must be a Type (Decomposable)
|
||||
BOOST_STATIC_ASSERT((FrT::Is_fraction::value));
|
||||
|
||||
typedef typename FrT::Numerator RT;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
template \< class ArithmeticTraitsSqrtExtension \>
|
||||
class my_class {
|
||||
public:
|
||||
NiX_SNAP_ARITHMETIC_TRAITS_SQRT_EXTENSION_TYPEDEFS(ArithmeticTraitsSqrtExtension);
|
||||
NiX_SNAP_ARITHMETIC_TRAITS_SQRT_EXTENSION_TypeDEFS(ArithmeticTraitsSqrtExtension);
|
||||
// ...
|
||||
};
|
||||
</PRE>
|
||||
|
|
@ -62,8 +62,8 @@
|
|||
of your class and saves typing the lengthy ArithmeticTraits::
|
||||
prefix.
|
||||
*/
|
||||
#define CGAL_SNAP_ARITHMETIC_TRAITS_SQRT_EXTENSION_TYPEDEFS(AT) \
|
||||
CGAL_SNAP_ARITHMETIC_TRAITS_TYPEDEFS(AT) \
|
||||
#define CGAL_SNAP_ARITHMETIC_TRAITS_SQRT_EXTENSION_TypeDEFS(AT) \
|
||||
CGAL_SNAP_ARITHMETIC_TRAITS_TypeDEFS(AT) \
|
||||
typedef typename AT::Extn Extn; \
|
||||
typedef typename AT::Nested_extn Nested_extn; \
|
||||
typedef typename AT::Poly_extn1 Poly_extn1; \
|
||||
|
|
@ -558,104 +558,104 @@ template <class NT,class ROOT> bool operator >=
|
|||
{ return ( (p-Sqrt_extension<NT,ROOT>(num)).sign() >= 0 );}
|
||||
|
||||
// Algebraic structure traits
|
||||
template< class Algebraic_structure, class Algebraic_type >
|
||||
template< class Type, class Algebraic_type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base;
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Integral_domain_without_division_tag >
|
||||
: public Algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Algebraic_structure_traits_base< Type,
|
||||
CGAL::Integral_domain_without_division_tag > {
|
||||
public:
|
||||
typedef CGAL::Integral_domain_without_division_tag Algebraic_structure_tag;
|
||||
|
||||
class Simplify
|
||||
: public Unary_function< Algebraic_structure&, void > {
|
||||
: public Unary_function< Type&, void > {
|
||||
public:
|
||||
typedef void result_type;
|
||||
typedef Algebraic_structure& argument_type;
|
||||
typedef Type& argument_type;
|
||||
|
||||
void operator()( Algebraic_structure& x ) const {
|
||||
void operator()( Type& x ) const {
|
||||
x.simplify();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Integral_domain_tag >
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Integral_domain_without_division_tag > {
|
||||
public:
|
||||
typedef CGAL::Integral_domain_tag Algebraic_structure_tag;
|
||||
|
||||
class Integral_division
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return x/y;
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Unique_factorization_domain_tag >
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Integral_domain_tag > {
|
||||
// Nothing new
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Euclidean_ring_tag >
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Integral_domain_tag > {
|
||||
// Nothing new
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Field_tag >
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Integral_domain_tag > {
|
||||
public:
|
||||
typedef Field_tag Algebraic_structure_tag;
|
||||
|
||||
class Unit_part
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
return( x == Algebraic_structure(0) ? Algebraic_structure(1) : x );
|
||||
Type operator()( const Type& x ) const {
|
||||
return( x == Type(0) ? Type(1) : x );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Field_with_sqrt_tag >
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Field_tag > {
|
||||
// Nothing new
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Field_with_kth_root_tag >
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
// TODO: Why not Fiel_tag?
|
||||
CGAL::Field_with_sqrt_tag > {
|
||||
// Nothing new
|
||||
};
|
||||
|
||||
template< class Algebraic_structure >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
template< class Type >
|
||||
class Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
CGAL::Field_with_root_of_tag >
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Algebraic_structure,
|
||||
: public Sqrt_extension_algebraic_structure_traits_base< Type,
|
||||
// TODO: Why not Fiel_tag?
|
||||
CGAL::Field_with_sqrt_tag > {
|
||||
// Nothing new
|
||||
|
|
@ -667,7 +667,7 @@ class Algebraic_structure_traits< Sqrt_extension< COEFF, ROOT > >
|
|||
Sqrt_extension< COEFF, ROOT >,
|
||||
typename Algebraic_structure_traits< COEFF >::Algebraic_structure_tag > {
|
||||
public:
|
||||
typedef Sqrt_extension< COEFF, ROOT > Algebraic_structure;
|
||||
typedef Sqrt_extension< COEFF, ROOT > Type;
|
||||
|
||||
// Tag_true if COEFF and ROOT are exact
|
||||
typedef typename ::boost::mpl::if_c<
|
||||
|
|
@ -687,14 +687,14 @@ class Real_embeddable_traits< Sqrt_extension<COEFF, ROOT> >
|
|||
Sqrt_extension<COEFF, ROOT>,
|
||||
typename Real_embeddable_traits<COEFF>::Is_real_embeddable > {
|
||||
public:
|
||||
typedef Sqrt_extension<COEFF, ROOT> Real_embeddable;
|
||||
typedef Sqrt_extension<COEFF, ROOT> Type;
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
private:
|
||||
typedef boost::numeric::interval<double> Double_interval;
|
||||
public:
|
||||
std::pair<double,double> operator()(const Real_embeddable& x) const {
|
||||
std::pair<double,double> operator()(const Type& x) const {
|
||||
if(x.is_extended()){
|
||||
std::pair<double, double> pair_a0 = CGAL_NTS to_interval( x.a0() );
|
||||
std::pair<double, double> pair_a1_root = CGAL_NTS to_interval(
|
||||
|
|
@ -713,17 +713,17 @@ class Real_embeddable_traits< Sqrt_extension<COEFF, ROOT> >
|
|||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
// The main problem here is, that even tough the total
|
||||
// expression fits into double, one of the coefficients
|
||||
// or the root may not. ?? !
|
||||
double operator()(const Real_embeddable& x) const {
|
||||
double operator()(const Type& x) const {
|
||||
if(x.is_extended()){
|
||||
return CGAL_NTS to_double(x.a0())
|
||||
+ int(CGAL_NTS sign(x.a1()))
|
||||
* CGAL_NTS sqrt(CGAL_NTS to_double(x.a1()*x.a1() *
|
||||
Real_embeddable(x.root())));
|
||||
Type(x.root())));
|
||||
}else{
|
||||
return CGAL_NTS to_double(x.a0());
|
||||
}
|
||||
|
|
@ -737,7 +737,7 @@ class Real_embeddable_traits< Sqrt_extension<COEFF, ROOT> >
|
|||
|
||||
|
||||
// ############## initializing for NT_traits_comparable_base
|
||||
/*template <class EXT, class TYPETAG>
|
||||
/*template <class EXT, class TypeTAG>
|
||||
class Sqrt_ext_NTtr_comp_base;
|
||||
|
||||
template <class NT, class ROOT >
|
||||
|
|
@ -1036,13 +1036,13 @@ Extension to_Sqrt_extension(AlgebraicReal x, bool simplify_radicant = false) {
|
|||
switch (p.degree()) {
|
||||
case 2: {
|
||||
typedef NiX::Coercion_traits< NT, Coefficient > CT;
|
||||
typedef typename CT::Coercion_type Coercion_type;
|
||||
typename CGAL::Algebraic_structure_traits<Coercion_type>::Integral_div idiv;
|
||||
typedef typename CT::Type Type;
|
||||
typename CGAL::Algebraic_structure_traits<Type>::Integral_div idiv;
|
||||
typename CT::Cast cast;
|
||||
|
||||
Coercion_type den(Coercion_type(2) * cast(p[2]));
|
||||
Type den(Type(2) * cast(p[2]));
|
||||
NiX_assert(NiX::sign(den) == CGAL::POSITIVE);
|
||||
Coercion_type mid = idiv(cast(-p[1]), den);
|
||||
Type mid = idiv(cast(-p[1]), den);
|
||||
NiX::simplify(mid);
|
||||
ROOT rad = p[1]*p[1] - ROOT(4)*p[0]*p[2];
|
||||
NiX_assert(rad != ROOT(0)); // double root of algebraic real polynomial
|
||||
|
|
@ -1052,7 +1052,7 @@ Extension to_Sqrt_extension(AlgebraicReal x, bool simplify_radicant = false) {
|
|||
typename CGAL::Algebraic_structure_traits< ROOT >::Sqrt isqrt;
|
||||
ROOT root = isqrt(rad);
|
||||
if (root * root == rad) {
|
||||
Coercion_type c = idiv(f, den);
|
||||
Type c = idiv(f, den);
|
||||
switch (x.compare(mid)) {
|
||||
case CGAL::LARGER: break;
|
||||
case CGAL::SMALLER: c = -c; break;
|
||||
|
|
@ -1075,7 +1075,7 @@ Extension to_Sqrt_extension(AlgebraicReal x, bool simplify_radicant = false) {
|
|||
i += 1;
|
||||
}
|
||||
}
|
||||
Coercion_type c = idiv(f, den);
|
||||
Type c = idiv(f, den);
|
||||
switch (x.compare(mid)) {
|
||||
case CGAL::LARGER: break;
|
||||
case CGAL::SMALLER: c = -c; break;
|
||||
|
|
@ -1163,7 +1163,7 @@ public:
|
|||
|
||||
//################################# NiX::Fraction_traits ##################
|
||||
// Select the right alternative as Fraction_traits
|
||||
// The actual Fraction traits is Inter::Sqrt_ext_Ftr_base_2
|
||||
// The actual Type traits is Inter::Sqrt_ext_Ftr_base_2
|
||||
// The selction is done in two steps:
|
||||
// 1. Inter::Sqrt_ext_Ftr_base_1 selects by the BOOL_TAG whether the COEFF type
|
||||
// Is_decomposable
|
||||
|
|
@ -1284,7 +1284,7 @@ template <class COEFF, class ROOT_NT>
|
|||
class Sqrt_ext_Ftr_base_1< Sqrt_extension<COEFF,ROOT_NT >, CGAL::Tag_true >
|
||||
: public Sqrt_ext_Ftr_base_2<
|
||||
Sqrt_extension<COEFF,ROOT_NT >,
|
||||
::boost::is_same< typename NiX::Coercion_traits<ROOT_NT,typename NiX::Fraction_traits<COEFF>::Numerator>::Coercion_type,
|
||||
::boost::is_same< typename NiX::Coercion_traits<ROOT_NT,typename NiX::Fraction_traits<COEFF>::Numerator>::Type,
|
||||
typename NiX::Fraction_traits<COEFF>::Numerator>::value >
|
||||
{
|
||||
//nothing new
|
||||
|
|
@ -1307,7 +1307,7 @@ namespace Intern{
|
|||
typedef SqrtExt Numerator;
|
||||
typedef ::CGAL::Tag_false Is_composable;
|
||||
typedef ::LiS::Null_tag Denominator;
|
||||
typedef ::LiS::Null_tag Fraction;
|
||||
typedef ::LiS::Null_tag Type;
|
||||
typedef ::LiS::Null_tag Compose;
|
||||
};
|
||||
template <class SqrtExt>
|
||||
|
|
@ -1315,13 +1315,13 @@ namespace Intern{
|
|||
typedef typename SqrtExt::NT Coeff;
|
||||
typedef typename SqrtExt::ROOT Root;
|
||||
typedef typename NiX::Cofraction_traits<Coeff> CFT;
|
||||
typedef typename CFT::Fraction Fraction_coeff;
|
||||
typedef typename CFT::Type Type_coeff;
|
||||
|
||||
public:
|
||||
typedef SqrtExt Numerator;
|
||||
typedef ::CGAL::Tag_true Is_composable;
|
||||
typedef typename CFT::Denominator Denominator;
|
||||
typedef NiX::Sqrt_extension<Fraction_coeff,Root> Fraction;
|
||||
typedef NiX::Sqrt_extension<Type_coeff,Root> Type;
|
||||
|
||||
class Compose {
|
||||
public:
|
||||
|
|
@ -1330,14 +1330,14 @@ namespace Intern{
|
|||
//! second argument type
|
||||
typedef Denominator second_argument_type;
|
||||
//! result type
|
||||
typedef Fraction result_type;
|
||||
typedef Type result_type;
|
||||
//! Compose fraction
|
||||
Fraction operator() (Numerator num,
|
||||
Type operator() (Numerator num,
|
||||
Denominator den){
|
||||
if(num.is_extended()){
|
||||
typename CFT::Compose compose_coeff;
|
||||
Fraction_coeff a0_new(compose_coeff(num.a0(),den));
|
||||
Fraction_coeff a1_new(compose_coeff(num.a1(),den));
|
||||
Type_coeff a0_new(compose_coeff(num.a0(),den));
|
||||
Type_coeff a1_new(compose_coeff(num.a1(),den));
|
||||
return result_type(a0_new, a1_new, num.root());
|
||||
}else{
|
||||
typename CFT::Compose compose_coeff;
|
||||
|
|
@ -1386,7 +1386,7 @@ public:
|
|||
typedef Arithmetic_traits Base;
|
||||
|
||||
// load the typedefs from the base class
|
||||
NiX_SNAP_ARITHMETIC_TRAITS_TYPEDEFS(Arithmetic_traits);
|
||||
NiX_SNAP_ARITHMETIC_TRAITS_TypeDEFS(Arithmetic_traits);
|
||||
|
||||
//! a number with one root
|
||||
typedef NiX::Sqrt_extension< Extn_NT, Extn_root_NT > Extn;
|
||||
|
|
@ -1448,14 +1448,14 @@ private:
|
|||
public:
|
||||
typedef CGAL::Tag_true Are_explicit_interoperable;
|
||||
typedef CGAL::Tag_false Are_implicit_interoperable;
|
||||
typedef Sqrt_extension<typename CT::Coercion_type, Root> Coercion_type;
|
||||
typedef Sqrt_extension<typename CT::Type, Root> Type;
|
||||
|
||||
struct Cast{
|
||||
private:
|
||||
inline Coercion_type cast(const Coercion_type& x) const{ return x; }
|
||||
inline Type cast(const Type& x) const{ return x; }
|
||||
|
||||
template <class T>
|
||||
inline Coercion_type cast(const T& x) const{
|
||||
inline Type cast(const T& x) const{
|
||||
typename CT::Cast cast;
|
||||
if (x.is_extended()) {
|
||||
return result_type(cast(x.a0()),cast(x.a1()),x.root());
|
||||
|
|
@ -1464,10 +1464,10 @@ public:
|
|||
}
|
||||
}
|
||||
public:
|
||||
typedef Coercion_type result_type;
|
||||
typedef Type result_type;
|
||||
// this is in order to allow A and B only
|
||||
Coercion_type operator()(const A& x) const { return cast(x);}
|
||||
Coercion_type operator()(const B& x) const { return cast(x);}
|
||||
Type operator()(const A& x) const { return cast(x);}
|
||||
Type operator()(const B& x) const { return cast(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -1483,12 +1483,12 @@ public:
|
|||
typedef CGAL::Tag_true Are_explicit_interoperable;
|
||||
typedef CGAL::Tag_false Are_implicit_interoperable;
|
||||
|
||||
// Coercion_type = A
|
||||
typedef Sqrt_extension<Sqrt_extension<Coeff,Root_1>, Root_2> Coercion_type;
|
||||
// Type = A
|
||||
typedef Sqrt_extension<Sqrt_extension<Coeff,Root_1>, Root_2> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const A& x) const { return x;}
|
||||
Coercion_type operator()(const B& x) const { return Coercion_type(x);}
|
||||
typedef Type result_type;
|
||||
Type operator()(const A& x) const { return x;}
|
||||
Type operator()(const B& x) const { return Type(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -1518,11 +1518,11 @@ public:
|
|||
typedef CGAL::Tag_true Are_explicit_interoperable;
|
||||
typedef CGAL::Tag_false Are_implicit_interoperable;
|
||||
|
||||
typedef Sqrt_extension<Sqrt_extension<Coeff,Root_1>, Root_1> Coercion_type;
|
||||
typedef Sqrt_extension<Sqrt_extension<Coeff,Root_1>, Root_1> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const A& x) const { return x;}
|
||||
Coercion_type operator()(const B& x) const { return Coercion_type(x);}
|
||||
typedef Type result_type;
|
||||
Type operator()(const A& x) const { return x;}
|
||||
Type operator()(const B& x) const { return Type(x);}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -1587,17 +1587,17 @@ public:
|
|||
typedef CGAL::Tag_true Are_explicit_interoperable;
|
||||
typedef CGAL::Tag_false Are_implicit_interoperable;
|
||||
|
||||
typedef FieldWithSqrt Coercion_type;
|
||||
typedef FieldWithSqrt Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const A& x) const {
|
||||
typedef Type result_type;
|
||||
Type operator()(const A& x) const {
|
||||
typedef Coercion_traits<Coeff,FieldWithSqrt> CT_coeff;
|
||||
typedef Coercion_traits<Root ,FieldWithSqrt> CT_root;
|
||||
typename CT_coeff::Cast coeff_cast;
|
||||
typename CT_root::Cast root_cast;
|
||||
if (x.is_extended()) {
|
||||
typename CGAL::Algebraic_structure_traits<
|
||||
typename CT_root::Coercion_type>::Sqrt sqrt;
|
||||
typename CT_root::Type>::Sqrt sqrt;
|
||||
return // a0+a1*sqrt(root)
|
||||
coeff_cast(x.a0())+
|
||||
coeff_cast(x.a1())*
|
||||
|
|
@ -1606,7 +1606,7 @@ public:
|
|||
return coeff_cast(x.a0());
|
||||
}
|
||||
}
|
||||
Coercion_type operator()(const B& x) const { return x;}
|
||||
Type operator()(const B& x) const { return x;}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -1620,20 +1620,20 @@ private:
|
|||
public:
|
||||
typedef CGAL::Tag_true Are_explicit_interoperable;
|
||||
typedef CGAL::Tag_false Are_implicit_interoperable;
|
||||
typedef Sqrt_extension<typename CT::Coercion_type,Root> Coercion_type;
|
||||
typedef Sqrt_extension<typename CT::Type,Root> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const A& x) const {
|
||||
typedef Type result_type;
|
||||
Type operator()(const A& x) const {
|
||||
typename CT::Cast cast;
|
||||
if (x.is_extended()) {
|
||||
return Coercion_type(cast(x.a0()),cast(x.a1()),x.root());
|
||||
return Type(cast(x.a0()),cast(x.a1()),x.root());
|
||||
} else {
|
||||
return Coercion_type(cast(x.a0()));
|
||||
return Type(cast(x.a0()));
|
||||
}
|
||||
}
|
||||
Coercion_type operator()(const B& x) const {
|
||||
Type operator()(const B& x) const {
|
||||
typename CT::Cast cast;
|
||||
return Coercion_type(cast(x));
|
||||
return Type(cast(x));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -140,18 +140,18 @@ template <> class Algebraic_structure_traits< double >
|
|||
typedef Tag_false Is_exact;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_CLIB_STD::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Kth_root
|
||||
: public Binary_function<int, Algebraic_structure, Algebraic_structure> {
|
||||
: public Binary_function<int, Type, Type> {
|
||||
public:
|
||||
Algebraic_structure operator()( int k,
|
||||
const Algebraic_structure& x) const {
|
||||
Type operator()( int k,
|
||||
const Type& x) const {
|
||||
CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
|
||||
return CGAL_CLIB_STD::pow(x, 1.0 / double(k));
|
||||
}
|
||||
|
|
@ -166,25 +166,25 @@ template <> class Real_embeddable_traits< double >
|
|||
// GCC is faster with std::fabs().
|
||||
#ifdef __GNUG__
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_CLIB_STD::fabs( x );
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef INTERN_RET::To_double_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_double_by_conversion< Type >
|
||||
To_double;
|
||||
typedef INTERN_RET::To_interval_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_interval_by_conversion< Type >
|
||||
To_interval;
|
||||
|
||||
// Is_finite depends on platform
|
||||
#ifdef __sgi
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public :
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
switch (fp_class_d(x)) {
|
||||
case FP_POS_NORM:
|
||||
case FP_NEG_NORM:
|
||||
|
|
@ -205,29 +205,29 @@ template <> class Real_embeddable_traits< double >
|
|||
|
||||
#elif defined CGAL_CFG_IEEE_754_BUG
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public :
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
Real_embeddable d = x;
|
||||
bool operator()( const Type& x ) const {
|
||||
Type d = x;
|
||||
IEEE_754_double* p = reinterpret_cast<IEEE_754_double*>(&d);
|
||||
return is_finite_by_mask_double( p->c.H );
|
||||
}
|
||||
};
|
||||
#elif defined CGAL_CFG_NUMERIC_LIMITS_BUG
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public :
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return (x == x) && (is_valid(x-x));
|
||||
}
|
||||
};
|
||||
#else
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public :
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
return (x != std::numeric_limits<Real_embeddable>::infinity())
|
||||
&& (-x != std::numeric_limits<Real_embeddable>::infinity())
|
||||
bool operator()( const Type& x ) const {
|
||||
return (x != std::numeric_limits<Type>::infinity())
|
||||
&& (-x != std::numeric_limits<Type>::infinity())
|
||||
&& is_valid(x);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -116,18 +116,18 @@ template <> class Algebraic_structure_traits< float >
|
|||
typedef Tag_false Is_exact;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_CLIB_STD::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Kth_root
|
||||
: public Binary_function<int, Algebraic_structure, Algebraic_structure> {
|
||||
: public Binary_function<int, Type, Type> {
|
||||
public:
|
||||
Algebraic_structure operator()( int k,
|
||||
const Algebraic_structure& x) const {
|
||||
Type operator()( int k,
|
||||
const Type& x) const {
|
||||
CGAL_precondition_msg( k > 0, "'k' must be positive for k-th roots");
|
||||
return CGAL_CLIB_STD::pow(double(x), 1.0 / double(k));
|
||||
};
|
||||
|
|
@ -139,17 +139,17 @@ template <> class Real_embeddable_traits< float >
|
|||
: public Real_embeddable_traits_base< float > {
|
||||
public:
|
||||
|
||||
typedef INTERN_RET::To_double_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_double_by_conversion< Type >
|
||||
To_double;
|
||||
typedef INTERN_RET::To_interval_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_interval_by_conversion< Type >
|
||||
To_interval;
|
||||
// Is_finite depends on platform
|
||||
#ifdef __sgi
|
||||
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
switch (fp_class_f(x)) {
|
||||
case FP_POS_NORM:
|
||||
case FP_NEG_NORM:
|
||||
|
|
@ -171,19 +171,19 @@ template <> class Real_embeddable_traits< float >
|
|||
#elif defined CGAL_CFG_IEEE_754_BUG
|
||||
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
Real_embeddable f = x;
|
||||
bool operator()( const Type& x ) const {
|
||||
Type f = x;
|
||||
IEEE_754_float* p = reinterpret_cast<IEEE_754_float*>(&f);
|
||||
return is_finite_by_mask_float( p->c );
|
||||
}
|
||||
};
|
||||
#else
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return (x == x) && (is_valid(x-x));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ struct Coercion_traits<
|
|||
::__gmp_expr< ::__gmpz_value , U>,::__gmp_expr< ::__gmpz_value , U> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef ::__gmp_expr< ::__gmpz_value , ::__gmpz_value> Coercion_type;
|
||||
typedef ::__gmp_expr< ::__gmpz_value , ::__gmpz_value> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
typedef Type result_type;
|
||||
template <class U3>
|
||||
Coercion_type operator()(const ::__gmp_expr< ::__gmpz_value , U3>& x) const {
|
||||
Type operator()(const ::__gmp_expr< ::__gmpz_value , U3>& x) const {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
|
@ -49,11 +49,11 @@ struct Coercion_traits<
|
|||
::__gmp_expr< ::__gmpz_value , U1>,::__gmp_expr< ::__gmpz_value , U2> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef ::__gmp_expr< ::__gmpz_value , ::__gmpz_value> Coercion_type;
|
||||
typedef ::__gmp_expr< ::__gmpz_value , ::__gmpz_value> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
typedef Type result_type;
|
||||
template <class U3>
|
||||
Coercion_type operator()(const ::__gmp_expr< ::__gmpz_value , U3>& x) const {
|
||||
Type operator()(const ::__gmp_expr< ::__gmpz_value , U3>& x) const {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
|
@ -67,11 +67,11 @@ struct Coercion_traits<
|
|||
::__gmp_expr< ::__gmpq_value , U>,::__gmp_expr< ::__gmpq_value , U> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef ::__gmp_expr< ::__gmpq_value , ::__gmpq_value> Coercion_type;
|
||||
typedef ::__gmp_expr< ::__gmpq_value , ::__gmpq_value> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
typedef Type result_type;
|
||||
template <class U3>
|
||||
Coercion_type operator()(const ::__gmp_expr< ::__gmpq_value , U3>& x) const {
|
||||
Type operator()(const ::__gmp_expr< ::__gmpq_value , U3>& x) const {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
|
@ -82,11 +82,11 @@ struct Coercion_traits<
|
|||
::__gmp_expr< ::__gmpq_value , U1>,::__gmp_expr< ::__gmpq_value , U2> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef ::__gmp_expr< ::__gmpq_value , ::__gmpq_value> Coercion_type;
|
||||
typedef ::__gmp_expr< ::__gmpq_value , ::__gmpq_value> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
typedef Type result_type;
|
||||
template <class U3>
|
||||
Coercion_type operator()(const ::__gmp_expr< ::__gmpq_value , U3>& x) const {
|
||||
Type operator()(const ::__gmp_expr< ::__gmpq_value , U3>& x) const {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
|
@ -100,16 +100,16 @@ struct Coercion_traits<
|
|||
::__gmp_expr< ::__gmpz_value , U1>,::__gmp_expr< ::__gmpq_value , U2> >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef ::__gmp_expr< ::__gmpq_value , ::__gmpq_value> Coercion_type;
|
||||
typedef ::__gmp_expr< ::__gmpq_value , ::__gmpq_value> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
typedef Type result_type;
|
||||
template <class U3>
|
||||
Coercion_type operator()(const ::__gmp_expr< ::__gmpq_value , U3>& x) const {
|
||||
Type operator()(const ::__gmp_expr< ::__gmpq_value , U3>& x) const {
|
||||
return x;
|
||||
}
|
||||
template <class U3>
|
||||
Coercion_type operator()(const ::__gmp_expr< ::__gmpz_value , U3>& x) const {
|
||||
return Coercion_type(x);
|
||||
Type operator()(const ::__gmp_expr< ::__gmpz_value , U3>& x) const {
|
||||
return Type(x);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -124,14 +124,14 @@ struct Coercion_traits<
|
|||
::__gmp_expr< GMPX_VALUE , U1>, int >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_true Are_implicit_interoperable;
|
||||
typedef ::__gmp_expr< GMPX_VALUE , GMPX_VALUE> Coercion_type;
|
||||
typedef ::__gmp_expr< GMPX_VALUE , GMPX_VALUE> Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
typedef Type result_type;
|
||||
template <class U3>
|
||||
Coercion_type operator()(const ::__gmp_expr< GMPX_VALUE , U3>& x) const {
|
||||
Type operator()(const ::__gmp_expr< GMPX_VALUE , U3>& x) const {
|
||||
return x;
|
||||
}
|
||||
Coercion_type operator()(int x) const { return Coercion_type(x); }
|
||||
Type operator()(int x) const { return Type(x); }
|
||||
};
|
||||
};
|
||||
// gmpz_class implicit interoperable with int
|
||||
|
|
|
|||
|
|
@ -30,19 +30,19 @@
|
|||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
namespace INTERN_INT {
|
||||
template< class Algebraic_structure >
|
||||
template< class Type >
|
||||
class Is_square_per_double_conversion
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure&,
|
||||
: public Binary_function< Type, Type&,
|
||||
bool > {
|
||||
public:
|
||||
bool operator()( const Algebraic_structure& x,
|
||||
Algebraic_structure& y ) const {
|
||||
y = (Algebraic_structure) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
bool operator()( const Type& x,
|
||||
Type& y ) const {
|
||||
y = (Type) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
return x == y * y;
|
||||
}
|
||||
bool operator()( const Algebraic_structure& x ) const {
|
||||
Algebraic_structure y =
|
||||
(Algebraic_structure) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
bool operator()( const Type& x ) const {
|
||||
Type y =
|
||||
(Type) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
return x == y * y;
|
||||
}
|
||||
|
||||
|
|
@ -56,20 +56,20 @@ template<> class Algebraic_structure_traits< int >
|
|||
public:
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
typedef INTERN_AST::Div_per_operator< Algebraic_structure > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Algebraic_structure > Mod;
|
||||
typedef INTERN_AST::Div_per_operator< Type > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Type > Mod;
|
||||
|
||||
typedef INTERN_INT::
|
||||
Is_square_per_double_conversion< Algebraic_structure > Is_square;
|
||||
Is_square_per_double_conversion< Type > Is_square;
|
||||
};
|
||||
|
||||
template <> class Real_embeddable_traits< int >
|
||||
: public Real_embeddable_traits_base< int > {
|
||||
public:
|
||||
|
||||
typedef INTERN_RET::To_double_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_double_by_conversion< Type >
|
||||
To_double;
|
||||
typedef INTERN_RET::To_interval_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_interval_by_conversion< Type >
|
||||
To_interval;
|
||||
};
|
||||
|
||||
|
|
@ -82,20 +82,20 @@ template<> class Algebraic_structure_traits< long int >
|
|||
public:
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
typedef INTERN_AST::Div_per_operator< Algebraic_structure > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Algebraic_structure > Mod;
|
||||
typedef INTERN_AST::Div_per_operator< Type > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Type > Mod;
|
||||
|
||||
typedef INTERN_INT::
|
||||
Is_square_per_double_conversion< Algebraic_structure > Is_square;
|
||||
Is_square_per_double_conversion< Type > Is_square;
|
||||
};
|
||||
|
||||
template <> class Real_embeddable_traits< long int >
|
||||
: public Real_embeddable_traits_base< long int > {
|
||||
public:
|
||||
|
||||
typedef INTERN_RET::To_double_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_double_by_conversion< Type >
|
||||
To_double;
|
||||
typedef INTERN_RET::To_interval_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_interval_by_conversion< Type >
|
||||
To_interval;
|
||||
};
|
||||
|
||||
|
|
@ -112,12 +112,12 @@ template<> class Algebraic_structure_traits< short int >
|
|||
// interoperability. This is nescessary because of the implicit conversion
|
||||
// to int for binary operations between short ints.
|
||||
class Integral_division
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
Algebraic_structure_traits<Algebraic_structure>::Div actual_div;
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
Algebraic_structure_traits<Type>::Div actual_div;
|
||||
CGAL_precondition_msg( actual_div( x, y) * y == x,
|
||||
"'x' must be divisible by 'y' in "
|
||||
"Algebraic_structure_traits<...>::Integral_div()(x,y)" );
|
||||
|
|
@ -126,58 +126,58 @@ template<> class Algebraic_structure_traits< short int >
|
|||
};
|
||||
|
||||
class Gcd
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
Algebraic_structure_traits<Algebraic_structure>::Mod mod;
|
||||
Algebraic_structure_traits<Algebraic_structure>::Unit_part unit_part;
|
||||
Algebraic_structure_traits<Algebraic_structure>::Integral_division integral_div;
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
Algebraic_structure_traits<Type>::Mod mod;
|
||||
Algebraic_structure_traits<Type>::Unit_part unit_part;
|
||||
Algebraic_structure_traits<Type>::Integral_division integral_div;
|
||||
// First: the extreme cases and negative sign corrections.
|
||||
if (x == Algebraic_structure(0)) {
|
||||
if (y == Algebraic_structure(0))
|
||||
return Algebraic_structure(0);
|
||||
if (x == Type(0)) {
|
||||
if (y == Type(0))
|
||||
return Type(0);
|
||||
return integral_div( y, unit_part(y) );
|
||||
}
|
||||
if (y == Algebraic_structure(0))
|
||||
if (y == Type(0))
|
||||
return integral_div(x, unit_part(x) );
|
||||
Algebraic_structure u = integral_div( x, unit_part(x) );
|
||||
Algebraic_structure v = integral_div( y, unit_part(y) );
|
||||
Type u = integral_div( x, unit_part(x) );
|
||||
Type v = integral_div( y, unit_part(y) );
|
||||
// Second: assuming mod is the most expensive op here, we don't compute it
|
||||
// unnecessarily if u < v
|
||||
if (u < v) {
|
||||
v = mod(v,u);
|
||||
// maintain invariant of v > 0 for the loop below
|
||||
if ( v == Algebraic_structure(0) )
|
||||
if ( v == Type(0) )
|
||||
return u;
|
||||
}
|
||||
|
||||
Algebraic_structure w;
|
||||
Type w;
|
||||
do {
|
||||
w = mod(u,v);
|
||||
if ( w == Algebraic_structure(0))
|
||||
if ( w == Type(0))
|
||||
return v;
|
||||
u = mod(v,w);
|
||||
if ( u == Algebraic_structure(0))
|
||||
if ( u == Type(0))
|
||||
return w;
|
||||
v = mod(w,u);
|
||||
} while (v != Algebraic_structure(0));
|
||||
} while (v != Type(0));
|
||||
return u;
|
||||
}
|
||||
};
|
||||
|
||||
class Div_mod {
|
||||
public:
|
||||
typedef Algebraic_structure first_argument_type;
|
||||
typedef Algebraic_structure second_argument_type;
|
||||
typedef Algebraic_structure& third_argument_type;
|
||||
typedef Algebraic_structure& fourth_argument_type;
|
||||
typedef Type first_argument_type;
|
||||
typedef Type second_argument_type;
|
||||
typedef Type& third_argument_type;
|
||||
typedef Type& fourth_argument_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
typedef void result_type;
|
||||
void operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y,
|
||||
Algebraic_structure& q, Algebraic_structure& r) const {
|
||||
void operator()( const Type& x,
|
||||
const Type& y,
|
||||
Type& q, Type& r) const {
|
||||
q = x / y;
|
||||
r = x % y;
|
||||
return;
|
||||
|
|
@ -186,37 +186,37 @@ template<> class Algebraic_structure_traits< short int >
|
|||
|
||||
// based on \c Div_mod.
|
||||
class Div
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
return x / y;
|
||||
};
|
||||
};
|
||||
|
||||
// based on \c Div_mod.
|
||||
class Mod
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y) const {
|
||||
return x % y;
|
||||
};
|
||||
};
|
||||
|
||||
typedef INTERN_INT::
|
||||
Is_square_per_double_conversion< Algebraic_structure > Is_square;
|
||||
Is_square_per_double_conversion< Type > Is_square;
|
||||
};
|
||||
|
||||
template <> class Real_embeddable_traits< short int >
|
||||
: public Real_embeddable_traits_base< short int > {
|
||||
public:
|
||||
|
||||
typedef INTERN_RET::To_double_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_double_by_conversion< Type >
|
||||
To_double;
|
||||
typedef INTERN_RET::To_interval_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_interval_by_conversion< Type >
|
||||
To_interval;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -51,18 +51,18 @@ template <> class Algebraic_structure_traits< leda_bigfloat >
|
|||
typedef Tag_false Is_exact;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_LEDA_SCOPE::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Kth_root
|
||||
: public Binary_function<int, Algebraic_structure, Algebraic_structure> {
|
||||
: public Binary_function<int, Type, Type> {
|
||||
public:
|
||||
Algebraic_structure operator()( int k,
|
||||
const Algebraic_structure& x) const {
|
||||
Type operator()( int k,
|
||||
const Type& x) const {
|
||||
CGAL_precondition_msg(k > 0, "'k' must be positive for k-th roots");
|
||||
// heuristic: we ask for as many precision as the argument has
|
||||
long d = x.get_significant_length();
|
||||
|
|
@ -79,43 +79,43 @@ template <> class Real_embeddable_traits< leda_bigfloat >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_LEDA_SCOPE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
|
||||
}
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return x.to_double();
|
||||
}
|
||||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
// assuming leda_bigfloat guarantee 1 bit error max
|
||||
Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
|
||||
|
|
@ -127,9 +127,9 @@ template <> class Real_embeddable_traits< leda_bigfloat >
|
|||
};
|
||||
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return !( CGAL_LEDA_SCOPE::isInf(x) || CGAL_LEDA_SCOPE::isNaN(x) );
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -93,11 +93,11 @@ template <>
|
|||
struct Coercion_traits< ::leda::bigfloat ,::leda::rational >{
|
||||
typedef Tag_true Are_explicit_interoperable;
|
||||
typedef Tag_false Are_implicit_interoperable;
|
||||
typedef ::leda::rational Coercion_type;
|
||||
typedef ::leda::rational Type;
|
||||
struct Cast{
|
||||
typedef Coercion_type result_type;
|
||||
Coercion_type operator()(const ::leda::rational& x) const { return x;}
|
||||
Coercion_type operator()(const ::leda::bigfloat& x) const {
|
||||
typedef Type result_type;
|
||||
Type operator()(const ::leda::rational& x) const { return x;}
|
||||
Type operator()(const ::leda::bigfloat& x) const {
|
||||
#if CGAL_LEDA_VERSION < 500
|
||||
::leda::integer e = x.get_exponent();
|
||||
::leda::integer s = x.get_significant();
|
||||
|
|
|
|||
|
|
@ -48,34 +48,34 @@ template <> class Algebraic_structure_traits< leda_integer >
|
|||
public:
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
typedef INTERN_AST::Is_square_per_sqrt< Algebraic_structure >
|
||||
typedef INTERN_AST::Is_square_per_sqrt< Type >
|
||||
Is_square;
|
||||
|
||||
class Gcd
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
// By definition gcd(0,0) == 0
|
||||
if( x == Algebraic_structure(0) && y == Algebraic_structure(0) )
|
||||
return Algebraic_structure(0);
|
||||
if( x == Type(0) && y == Type(0) )
|
||||
return Type(0);
|
||||
|
||||
return CGAL_LEDA_SCOPE::gcd( x, y );
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
typedef INTERN_AST::Div_per_operator< Algebraic_structure > Div;
|
||||
typedef INTERN_AST::Div_per_operator< Type > Div;
|
||||
|
||||
class Mod
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure,
|
||||
Algebraic_structure > {
|
||||
: public Binary_function< Type, Type,
|
||||
Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x,
|
||||
const Algebraic_structure& y ) const {
|
||||
Algebraic_structure m = x % y;
|
||||
Type operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
Type m = x % y;
|
||||
|
||||
// Fix wrong lede result if first operand is negative
|
||||
if( x < 0 && m != 0 )
|
||||
|
|
@ -84,13 +84,13 @@ template <> class Algebraic_structure_traits< leda_integer >
|
|||
return m;
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_LEDA_SCOPE::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
|
@ -101,44 +101,44 @@ template <> class Real_embeddable_traits< leda_integer >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_LEDA_SCOPE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return x.to_double();
|
||||
}
|
||||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
Protect_FPU_rounding<true> P (CGAL_FE_TONEAREST);
|
||||
double cn = CGAL_NTS to_double(x);
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ template <> class Algebraic_structure_traits< leda_rational >
|
|||
typedef Tag_true Is_exact;
|
||||
|
||||
// TODO: How to implement this without having sqrt?
|
||||
// typedef INTERN_AST::Is_square_per_sqrt< Algebraic_structure >
|
||||
// typedef INTERN_AST::Is_square_per_sqrt< Type >
|
||||
// Is_square;
|
||||
|
||||
class Simplify
|
||||
: public Unary_function< Algebraic_structure&, void > {
|
||||
: public Unary_function< Type&, void > {
|
||||
public:
|
||||
void operator()( Algebraic_structure& x) const {
|
||||
void operator()( Type& x) const {
|
||||
x.normalize();
|
||||
}
|
||||
};
|
||||
|
|
@ -71,50 +71,50 @@ template <> class Real_embeddable_traits< leda_rational >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_LEDA_SCOPE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Real_embeddable,Comparison_result);
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT(Type,Comparison_result);
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
return x.to_double();
|
||||
}
|
||||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
#if CGAL_LEDA_VERSION >= 501
|
||||
CGAL_LEDA_SCOPE::interval temp(x);
|
||||
std::pair<double, double> result(temp.lower_bound(),temp.upper_bound());
|
||||
CGAL_postcondition(Real_embeddable(result.first)<=x);
|
||||
CGAL_postcondition(Real_embeddable(result.second)>=x);
|
||||
CGAL_postcondition(Type(result.first)<=x);
|
||||
CGAL_postcondition(Type(result.second)>=x);
|
||||
return result;
|
||||
#else
|
||||
CGAL_LEDA_SCOPE::bigfloat xnum = x.numerator();
|
||||
|
|
@ -128,14 +128,14 @@ template <> class Real_embeddable_traits< leda_rational >
|
|||
double MinDbl = CGAL_LEDA_SCOPE::fp::compose_parts(0,0,0,1);
|
||||
|
||||
double low = xlow.to_double();
|
||||
while(Real_embeddable(low) > x) low = low - MinDbl;
|
||||
while(Type(low) > x) low = low - MinDbl;
|
||||
|
||||
double upp = xupp.to_double();
|
||||
while(Real_embeddable(upp) < x) upp = upp + MinDbl;
|
||||
while(Type(upp) < x) upp = upp + MinDbl;
|
||||
|
||||
std::pair<double, double> result(low,upp);
|
||||
CGAL_postcondition(Real_embeddable(result.first)<=x);
|
||||
CGAL_postcondition(Real_embeddable(result.second)>=x);
|
||||
CGAL_postcondition(Type(result.first)<=x);
|
||||
CGAL_postcondition(Type(result.second)>=x);
|
||||
return result;
|
||||
#endif
|
||||
// Original CGAL to_interval (seemed to be inferior)
|
||||
|
|
@ -160,7 +160,7 @@ template <> class Real_embeddable_traits< leda_rational >
|
|||
template <>
|
||||
class Fraction_traits< leda_rational > {
|
||||
public:
|
||||
typedef leda_rational Fraction;
|
||||
typedef leda_rational Type;
|
||||
typedef ::CGAL::Tag_true Is_fraction;
|
||||
typedef leda_integer Numerator;
|
||||
typedef Numerator Denominator;
|
||||
|
|
@ -169,11 +169,11 @@ public:
|
|||
|
||||
class Decompose {
|
||||
public:
|
||||
typedef Fraction first_argument_type;
|
||||
typedef Type first_argument_type;
|
||||
typedef Numerator& second_argument_type;
|
||||
typedef Numerator& third_argument_type;
|
||||
void operator () (
|
||||
const Fraction& rat,
|
||||
const Type& rat,
|
||||
Numerator& num,
|
||||
Numerator& den) {
|
||||
num = rat.numerator();
|
||||
|
|
@ -185,11 +185,11 @@ public:
|
|||
public:
|
||||
typedef Numerator first_argument_type;
|
||||
typedef Numerator second_argument_type;
|
||||
typedef Fraction result_type;
|
||||
Fraction operator ()(
|
||||
typedef Type result_type;
|
||||
Type operator ()(
|
||||
const Numerator& num ,
|
||||
const Numerator& den ) {
|
||||
Fraction result(num, den);
|
||||
Type result(num, den);
|
||||
result.normalize();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,18 +56,18 @@ template <> class Algebraic_structure_traits< leda_real >
|
|||
typedef Tag_true Is_exact;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_LEDA_SCOPE::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Kth_root
|
||||
: public Binary_function<int, Algebraic_structure, Algebraic_structure> {
|
||||
: public Binary_function<int, Type, Type> {
|
||||
public:
|
||||
Algebraic_structure operator()( int k,
|
||||
const Algebraic_structure& x) const {
|
||||
Type operator()( int k,
|
||||
const Type& x) const {
|
||||
CGAL_precondition_msg(k > 0, "'k' must be positive for k-th roots");
|
||||
return CGAL_LEDA_SCOPE::root( x, k);
|
||||
}
|
||||
|
|
@ -77,30 +77,30 @@ template <> class Algebraic_structure_traits< leda_real >
|
|||
#if CGAL_LEDA_VERSION >= 500
|
||||
class Root_of {
|
||||
public:
|
||||
typedef Algebraic_structure result_type;
|
||||
typedef Type result_type;
|
||||
typedef Arity_tag< 3 > Arity;
|
||||
|
||||
// typedef leda_rational Boundary;
|
||||
private:
|
||||
template< class ForwardIterator >
|
||||
inline
|
||||
CGAL_LEDA_SCOPE::polynomial<Algebraic_structure>
|
||||
CGAL_LEDA_SCOPE::polynomial<Type>
|
||||
make_polynomial(ForwardIterator begin,
|
||||
ForwardIterator end) const {
|
||||
CGAL_LEDA_SCOPE::growing_array<Algebraic_structure> coeffs;
|
||||
CGAL_LEDA_SCOPE::growing_array<Type> coeffs;
|
||||
for(ForwardIterator it = begin; it < end; it++)
|
||||
coeffs.push_back(*it);
|
||||
return CGAL_LEDA_SCOPE::polynomial<Algebraic_structure>(coeffs);
|
||||
return CGAL_LEDA_SCOPE::polynomial<Type>(coeffs);
|
||||
}
|
||||
public:
|
||||
template <class ForwardIterator>
|
||||
Algebraic_structure operator()( int k,
|
||||
Type operator()( int k,
|
||||
ForwardIterator begin,
|
||||
ForwardIterator end) const {
|
||||
return CGAL_LEDA_SCOPE::diamond(k,make_polynomial(begin,end));
|
||||
};
|
||||
/* template <class ForwardIterator>
|
||||
Algebraic_structure operator()( leda_rational lower,
|
||||
Type operator()( leda_rational lower,
|
||||
leda_rational upper,
|
||||
ForwardIterator begin,
|
||||
ForwardIterator end) const {
|
||||
|
|
@ -119,39 +119,39 @@ template <> class Real_embeddable_traits< leda_real >
|
|||
public:
|
||||
|
||||
class Abs
|
||||
: public Unary_function< Real_embeddable, Real_embeddable > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Real_embeddable operator()( const Real_embeddable& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_LEDA_SCOPE::abs( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Sign
|
||||
: public Unary_function< Real_embeddable, ::CGAL::Sign > {
|
||||
: public Unary_function< Type, ::CGAL::Sign > {
|
||||
public:
|
||||
::CGAL::Sign operator()( const Real_embeddable& x ) const {
|
||||
::CGAL::Sign operator()( const Type& x ) const {
|
||||
return (::CGAL::Sign) CGAL_LEDA_SCOPE::sign( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Compare
|
||||
: public Binary_function< Real_embeddable, Real_embeddable,
|
||||
: public Binary_function< Type, Type,
|
||||
Comparison_result > {
|
||||
public:
|
||||
Comparison_result operator()( const Real_embeddable& x,
|
||||
const Real_embeddable& y ) const {
|
||||
Comparison_result operator()( const Type& x,
|
||||
const Type& y ) const {
|
||||
return (Comparison_result) CGAL_LEDA_SCOPE::compare( x, y );
|
||||
}
|
||||
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Real_embeddable,
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( Type,
|
||||
Comparison_result );
|
||||
|
||||
};
|
||||
|
||||
class To_double
|
||||
: public Unary_function< Real_embeddable, double > {
|
||||
: public Unary_function< Type, double > {
|
||||
public:
|
||||
double operator()( const Real_embeddable& x ) const {
|
||||
double operator()( const Type& x ) const {
|
||||
// this call is required to get reasonable values for the double
|
||||
// approximation (as of LEDA-4.3.1)
|
||||
x.improve_approximation_to(53);
|
||||
|
|
@ -160,9 +160,9 @@ template <> class Real_embeddable_traits< leda_real >
|
|||
};
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
#if CGAL_LEDA_VERSION >= 501
|
||||
leda_bigfloat bnum = x.to_bigfloat();
|
||||
|
|
@ -175,15 +175,15 @@ template <> class Real_embeddable_traits< leda_real >
|
|||
CGAL_LEDA_SCOPE::TO_P_INF);
|
||||
|
||||
std::pair<double, double> result(low, upp);
|
||||
CGAL_postcondition(Real_embeddable(result.first)<=x);
|
||||
CGAL_postcondition(Real_embeddable(result.second)>=x);
|
||||
CGAL_postcondition(Type(result.first)<=x);
|
||||
CGAL_postcondition(Type(result.second)>=x);
|
||||
return result;
|
||||
#else
|
||||
CGAL_LEDA_SCOPE::interval temp(x); //bug in leda
|
||||
std::pair<double, double> result(temp.lower_bound(),temp.upper_bound());
|
||||
CGAL_postcondition_msg(Real_embeddable(result.first)<=x,
|
||||
CGAL_postcondition_msg(Type(result.first)<=x,
|
||||
"Known bug in LEDA <=5.0");
|
||||
CGAL_postcondition_msg(Real_embeddable(result.first)>=x,
|
||||
CGAL_postcondition_msg(Type(result.first)>=x,
|
||||
"Known bug in LEDA <=5.0");
|
||||
return result;
|
||||
// If x is very small and we look closer at x
|
||||
|
|
|
|||
|
|
@ -121,18 +121,18 @@ template <> class Algebraic_structure_traits< long double >
|
|||
typedef Tag_false Is_exact;
|
||||
|
||||
class Sqrt
|
||||
: public Unary_function< Algebraic_structure, Algebraic_structure > {
|
||||
: public Unary_function< Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( const Algebraic_structure& x ) const {
|
||||
Type operator()( const Type& x ) const {
|
||||
return CGAL_CLIB_STD::sqrt( x );
|
||||
}
|
||||
};
|
||||
|
||||
class Kth_root
|
||||
:public Binary_function<int, Algebraic_structure, Algebraic_structure > {
|
||||
:public Binary_function<int, Type, Type > {
|
||||
public:
|
||||
Algebraic_structure operator()( int k,
|
||||
const Algebraic_structure& x) const {
|
||||
Type operator()( int k,
|
||||
const Type& x) const {
|
||||
CGAL_precondition_msg( k > 0,
|
||||
"'k' must be positive for k-th roots");
|
||||
return CGAL_CLIB_STD::pow(x, (long double)1.0 / (long double)(k));
|
||||
|
|
@ -145,12 +145,12 @@ template <> class Real_embeddable_traits< long double >
|
|||
: public Real_embeddable_traits_base< long double > {
|
||||
public:
|
||||
|
||||
typedef INTERN_RET::To_double_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_double_by_conversion< Type >
|
||||
To_double;
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
|
||||
// We hope that the long double -> double conversion
|
||||
// follows the current rounding mode.
|
||||
|
|
@ -166,9 +166,9 @@ template <> class Real_embeddable_traits< long double >
|
|||
// Is_finite depends on platform
|
||||
#ifdef __sgi
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
switch (fp_class_d(x)) {
|
||||
case FP_POS_NORM:
|
||||
case FP_NEG_NORM:
|
||||
|
|
@ -188,19 +188,19 @@ template <> class Real_embeddable_traits< long double >
|
|||
};
|
||||
#elif defined CGAL_CFG_IEEE_754_BUG
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
Real_embeddable d = x;
|
||||
bool operator()( const Type& x ) const {
|
||||
Type d = x;
|
||||
IEEE_754_double* p = reinterpret_cast<IEEE_754_double*>(&d);
|
||||
return is_finite_by_mask_long_double( p->c.H );
|
||||
}
|
||||
};
|
||||
#else
|
||||
class Is_finite
|
||||
: public Unary_function< Real_embeddable, bool > {
|
||||
: public Unary_function< Type, bool > {
|
||||
public:
|
||||
bool operator()( const Real_embeddable& x ) const {
|
||||
bool operator()( const Type& x ) const {
|
||||
return (x == x) && (is_valid(x-x));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,21 +39,21 @@ template<> class Algebraic_structure_traits< long long int >
|
|||
public:
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
typedef INTERN_AST::Div_per_operator< Algebraic_structure > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Algebraic_structure > Mod;
|
||||
typedef INTERN_AST::Div_per_operator< Type > Div;
|
||||
typedef INTERN_AST::Mod_per_operator< Type > Mod;
|
||||
|
||||
class Is_square
|
||||
: public Binary_function< Algebraic_structure, Algebraic_structure&,
|
||||
: public Binary_function< Type, Type&,
|
||||
bool > {
|
||||
public:
|
||||
bool operator()( const Algebraic_structure& x,
|
||||
Algebraic_structure& y ) const {
|
||||
y = (Algebraic_structure) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
bool operator()( const Type& x,
|
||||
Type& y ) const {
|
||||
y = (Type) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
return x == y * y;
|
||||
}
|
||||
bool operator()( const Algebraic_structure& x) const {
|
||||
Algebraic_structure y
|
||||
= (Algebraic_structure) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
bool operator()( const Type& x) const {
|
||||
Type y
|
||||
= (Type) CGAL_CLIB_STD::sqrt( (double)x );
|
||||
return x == y * y;
|
||||
}
|
||||
};
|
||||
|
|
@ -63,13 +63,13 @@ template <> class Real_embeddable_traits< long long int >
|
|||
: public Real_embeddable_traits_base< long long int > {
|
||||
public:
|
||||
|
||||
typedef INTERN_RET::To_double_by_conversion< Real_embeddable >
|
||||
typedef INTERN_RET::To_double_by_conversion< Type >
|
||||
To_double;
|
||||
|
||||
class To_interval
|
||||
: public Unary_function< Real_embeddable, std::pair< double, double > > {
|
||||
: public Unary_function< Type, std::pair< double, double > > {
|
||||
public:
|
||||
std::pair<double, double> operator()( const Real_embeddable& x ) const {
|
||||
std::pair<double, double> operator()( const Type& x ) const {
|
||||
Protect_FPU_rounding<true> P(CGAL_FE_TONEAREST);
|
||||
Interval_nt<false> approx ((double) x);
|
||||
FPU_set_cw(CGAL_FE_UPWARD);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <CGAL/number_type_basic.h>
|
||||
//#include <gmpxx.h>
|
||||
#include <CGAL/gmpxx_coercion_traits.h>
|
||||
#include <CGAL/mpz_class.h> // for GCD in Fraction traits
|
||||
#include <CGAL/mpz_class.h> // for GCD in Type traits
|
||||
|
||||
|
||||
// This file gathers the necessary adaptors so that the following
|
||||
|
|
@ -51,7 +51,7 @@ class Algebraic_structure_traits< ::__gmp_expr< ::__gmpq_value,U> >
|
|||
public:
|
||||
typedef Field_tag Algebraic_structure_tag;
|
||||
typedef Tag_true Is_exact;
|
||||
typedef mpq_class Algebraic_structure;
|
||||
typedef mpq_class Type;
|
||||
|
||||
struct Is_zero: public Unary_function< mpq_class , bool > {
|
||||
template <class U2>
|
||||
|
|
@ -101,7 +101,7 @@ class Algebraic_structure_traits< ::__gmp_expr< ::__gmpq_value,U> >
|
|||
"Algebraic_structure_traits<mpq_class>::Integral_div()(x,y)" );
|
||||
return result;
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
class Is_square
|
||||
|
|
@ -131,7 +131,7 @@ template < class U >
|
|||
class Real_embeddable_traits< ::__gmp_expr< ::__gmpq_value,U> >
|
||||
: public Real_embeddable_traits_base< ::__gmp_expr< ::__gmpq_value,U> > {
|
||||
public:
|
||||
typedef mpq_class Real_embeddable;
|
||||
typedef mpq_class Type;
|
||||
|
||||
struct Is_zero: public Unary_function< mpq_class , bool > {
|
||||
template <class U2>
|
||||
|
|
@ -188,7 +188,7 @@ class Real_embeddable_traits< ::__gmp_expr< ::__gmpq_value,U> >
|
|||
return (Comparison_result) CGAL_NTS sign( ::cmp(x, y) );
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT
|
||||
( Real_embeddable, Comparison_result);
|
||||
( Type, Comparison_result);
|
||||
};
|
||||
|
||||
struct To_double
|
||||
|
|
@ -224,7 +224,7 @@ class Real_embeddable_traits< ::__gmp_expr< ::__gmpq_value,U> >
|
|||
template <>
|
||||
class Fraction_traits< mpq_class > {
|
||||
public:
|
||||
typedef mpq_class Fraction;
|
||||
typedef mpq_class Type;
|
||||
|
||||
typedef ::CGAL::Tag_true Is_fraction;
|
||||
typedef mpz_class Numerator;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Algebraic_structure_traits< ::__gmp_expr< ::__gmpz_value,U> >
|
|||
public:
|
||||
typedef Euclidean_ring_tag Algebraic_structure_tag;
|
||||
typedef Tag_true Is_exact;
|
||||
typedef mpz_class Algebraic_structure;
|
||||
typedef mpz_class Type;
|
||||
|
||||
struct Is_zero: public Unary_function< mpz_class , bool > {
|
||||
template <class U2>
|
||||
|
|
@ -95,7 +95,7 @@ public:
|
|||
"Algebraic_structure_traits<mpz_class>::Integral_div()(x,y)" );
|
||||
return result;
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
struct Gcd : public Binary_function< mpz_class, mpz_class, mpz_class > {
|
||||
|
|
@ -107,7 +107,7 @@ public:
|
|||
mpz_gcd( c.get_mpz_t(), mpz_class(x).get_mpz_t(), mpz_class(y).get_mpz_t() );
|
||||
return c;
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
struct Div : public Binary_function< mpz_class, mpz_class, mpz_class > {
|
||||
|
|
@ -117,7 +117,7 @@ public:
|
|||
const ::__gmp_expr< ::__gmpz_value,U3>& y) const {
|
||||
return x / y;
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
|
||||
struct Mod : public Binary_function< mpz_class, mpz_class, mpz_class > {
|
||||
|
|
@ -127,7 +127,7 @@ public:
|
|||
const ::__gmp_expr< ::__gmpz_value,U3>& y) const {
|
||||
return x % y;
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Algebraic_structure )
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type )
|
||||
};
|
||||
struct Div_mod {
|
||||
typedef mpz_class first_argument_type;
|
||||
|
|
@ -184,7 +184,7 @@ class Real_embeddable_traits< ::__gmp_expr< ::__gmpz_value,U> >
|
|||
: public Real_embeddable_traits_base< ::__gmp_expr< ::__gmpz_value,U> > {
|
||||
public:
|
||||
typedef ::__gmp_expr< ::__gmpz_value, ::__gmpz_value> mpz_class;
|
||||
typedef mpz_class Real_embeddable;
|
||||
typedef mpz_class Type;
|
||||
|
||||
struct Is_zero: public Unary_function< mpz_class , bool > {
|
||||
template <class U2>
|
||||
|
|
@ -238,7 +238,7 @@ public:
|
|||
return (Comparison_result) CGAL_NTS sign( ::cmp(x, y) );
|
||||
}
|
||||
CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT
|
||||
( Real_embeddable, Comparison_result);
|
||||
( Type, Comparison_result);
|
||||
};
|
||||
|
||||
struct To_double
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
// Author(s) : Stefan Schirra
|
||||
|
||||
|
||||
#ifndef CGAL_NUMBER_TYPE_BASIC_H
|
||||
#define CGAL_NUMBER_TYPE_BASIC_H
|
||||
#ifndef CGAL_NUMBER_Type_BASIC_H
|
||||
#define CGAL_NUMBER_Type_BASIC_H
|
||||
|
||||
#define CGAL_PI 3.14159265358979323846
|
||||
|
||||
|
|
@ -91,4 +91,4 @@
|
|||
#endif // CGAL_USE_GMPXX
|
||||
#endif // CGAL_USE_GMP
|
||||
|
||||
#endif // CGAL_NUMBER_TYPE_BASIC_H
|
||||
#endif // CGAL_NUMBER_Type_BASIC_H
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void algebraic_real_test()
|
|||
typedef REAL real_NT;
|
||||
typedef RATIONAL rat_NT;
|
||||
typedef Z Integer;
|
||||
typedef typename CGAL::Coercion_traits< Coeff_NT, rat_NT>::Coercion_type Coercion_type;
|
||||
typedef typename CGAL::Coercion_traits< Coeff_NT, rat_NT>::Type Type;
|
||||
|
||||
typedef NiX::Algebraic_real<Coeff_NT,real_NT,rat_NT> ALGNUM;
|
||||
typedef NiX::Polynomial<Coeff_NT> Poly;
|
||||
|
|
@ -123,7 +123,7 @@ void algebraic_real_test()
|
|||
// general constructor
|
||||
// tmp = 1
|
||||
tmp = ALGNUM(P_1,-2,+2);
|
||||
if ((LiS::Compare_types< rat_NT, Coercion_type >::same_type)) {
|
||||
if ((LiS::Compare_types< rat_NT, Type >::same_type)) {
|
||||
NiX_test(tmp.is_rational());
|
||||
NiX_test(tmp.type()==NiX::IS_RATIONAL);
|
||||
NiX_test(tmp==rat_NT(1));
|
||||
|
|
@ -138,7 +138,7 @@ void algebraic_real_test()
|
|||
NiX_test(tmp.rational()==1);
|
||||
}
|
||||
tmp = ALGNUM(P_1,1,1);
|
||||
if ((LiS::Compare_types< rat_NT, Coercion_type >::same_type)) {
|
||||
if ((LiS::Compare_types< rat_NT, Type >::same_type)) {
|
||||
NiX_test(tmp.is_rational());
|
||||
NiX_test(tmp.type()==NiX::IS_RATIONAL);
|
||||
NiX_test(tmp==rat_NT(1));
|
||||
|
|
@ -458,7 +458,7 @@ void algebraic_real_test_for_set_rational(bool set_rational)
|
|||
typedef REAL real_NT;
|
||||
typedef RATIONAL rat_NT;
|
||||
typedef Z Integer;
|
||||
typedef typename NiX::Coercion_traits< Coeff_NT, rat_NT>::Coercion_type Coercion_type;
|
||||
typedef typename NiX::Coercion_traits< Coeff_NT, rat_NT>::Type Type;
|
||||
|
||||
typedef NiX::Algebraic_real<Coeff_NT,real_NT,rat_NT> ALGNUM;
|
||||
typedef NiX::Polynomial<Coeff_NT> Poly;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ void algebraic_real_test()
|
|||
typedef REAL real_NT;
|
||||
typedef RATIONAL rat_NT;
|
||||
typedef Z Integer;
|
||||
typedef typename CGAL::Coercion_traits< Coeff_NT, rat_NT>::Coercion_type Coercion_type;
|
||||
typedef typename CGAL::Coercion_traits< Coeff_NT, rat_NT>::Type Type;
|
||||
|
||||
typedef NiX::Algebraic_real<Coeff_NT,real_NT,rat_NT> ALGNUM;
|
||||
typedef NiX::Polynomial<Coeff_NT> Poly;
|
||||
|
|
@ -121,7 +121,7 @@ void algebraic_real_test()
|
|||
// general constructor
|
||||
// tmp = 1
|
||||
tmp = ALGNUM(P_1,-2,+2);
|
||||
if ((LiS::Compare_types< rat_NT, Coercion_type >::same_type)) {
|
||||
if ((LiS::Compare_types< rat_NT, Type >::same_type)) {
|
||||
NiX_test(tmp.is_rational());
|
||||
NiX_test(tmp.type()==NiX::IS_RATIONAL);
|
||||
NiX_test(tmp==rat_NT(1));
|
||||
|
|
@ -136,7 +136,7 @@ void algebraic_real_test()
|
|||
NiX_test(tmp.rational()==1);
|
||||
}
|
||||
tmp = ALGNUM(P_1,1,1);
|
||||
if ((LiS::Compare_types< rat_NT, Coercion_type >::same_type)) {
|
||||
if ((LiS::Compare_types< rat_NT, Type >::same_type)) {
|
||||
NiX_test(tmp.is_rational());
|
||||
NiX_test(tmp.type()==NiX::IS_RATIONAL);
|
||||
NiX_test(tmp==rat_NT(1));
|
||||
|
|
@ -456,7 +456,7 @@ void algebraic_real_test_for_set_rational(bool set_rational)
|
|||
typedef REAL real_NT;
|
||||
typedef RATIONAL rat_NT;
|
||||
typedef Z Integer;
|
||||
typedef typename NiX::Coercion_traits< Coeff_NT, rat_NT>::Coercion_type Coercion_type;
|
||||
typedef typename NiX::Coercion_traits< Coeff_NT, rat_NT>::Type Type;
|
||||
|
||||
typedef NiX::Algebraic_real<Coeff_NT,real_NT,rat_NT> ALGNUM;
|
||||
typedef NiX::Polynomial<Coeff_NT> Poly;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void test_lazy_exact_nt() {
|
|||
typedef CGAL::Coercion_traits<LI,LR> CT;
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Coercion_type,LR>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Type,LR>::value));
|
||||
|
||||
LI i(4);
|
||||
LR r(4);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void test_quotient() {
|
|||
typedef CGAL::Coercion_traits<I,QI> CT;
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Coercion_type,QI>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same< typename CT::Type,QI>::value));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ template <class NT , class RT>
|
|||
inline
|
||||
void convert_to(const NT& x, RT& r){
|
||||
typedef CGAL::Coercion_traits<NT,RT> CT;
|
||||
typedef typename CT::Coercion_type Coercion_type;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<Coercion_type,RT>::value));
|
||||
typedef typename CT::Type Type;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<Type,RT>::value));
|
||||
r = typename CT::Cast()(x);
|
||||
}
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
@ -446,7 +446,7 @@ void scalar_factor_traits_test(){
|
|||
// TODO: No to_Sqrt_extension available in CGAL.
|
||||
/*template <class AT>
|
||||
void to_Sqrt_extension_test() {
|
||||
// CGAL_SNAP_ARITHMETIC_KERNEL_TYPEDEFS(AT);
|
||||
// CGAL_SNAP_ARITHMETIC_KERNEL_TypeDEFS(AT);
|
||||
typedef leda_integer Integer;
|
||||
typedef leda_rational Rational;
|
||||
typedef CGAL::Sqrt_extension<Rational,Integer> EXT;
|
||||
|
|
@ -480,7 +480,7 @@ void to_Sqrt_extension_test() {
|
|||
// TODO: Adapt when fraction_traits are available
|
||||
/*template <class AT>
|
||||
void fraction_traits_test(){
|
||||
//TEST Fraction traits ROOT of type INT
|
||||
//TEST Type traits ROOT of type INT
|
||||
typedef typename AT::Integer INT;
|
||||
typedef typename AT::Rational RAT;
|
||||
|
||||
|
|
@ -742,7 +742,7 @@ void polynom_test(){
|
|||
}*/
|
||||
template <class AT>
|
||||
void sqrt_extension_test(){
|
||||
CGAL_SNAP_ARITHMETIC_KERNEL_TYPEDEFS(AT);
|
||||
CGAL_SNAP_ARITHMETIC_KERNEL_TypeDEFS(AT);
|
||||
|
||||
general_test<Integer,Integer,CGAL::Integral_domain_tag>();
|
||||
general_test<Rational,Integer,CGAL::Field_tag>();
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ typedef LEDA_arithmetic_kernel Arithmetic_kernel;
|
|||
#endif // defined(CGAL_USE_LEDA) || defined(CGAL_USE_CORE)
|
||||
|
||||
// Macro to snap typedefs in Arithmetic_kernel
|
||||
#define CGAL_SNAP_ARITHMETIC_KERNEL_TYPEDEFS(AT) \
|
||||
#define CGAL_SNAP_ARITHMETIC_KERNEL_TypeDEFS(AT) \
|
||||
typedef typename AT::Integer Integer; \
|
||||
typedef typename AT::Rational Rational; \
|
||||
typedef typename AT::Field_with_sqrt Field_with_sqrt;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* types.
|
||||
*/
|
||||
|
||||
// within this file AS ^= Algebraic_structure
|
||||
// within this file AS ^= Type
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/_test_basic.h>
|
||||
|
|
@ -580,9 +580,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// Algebraic_structure_functions -----------------------------------------------
|
||||
// Type_functions -----------------------------------------------
|
||||
template <class AS >
|
||||
void test_Algebraic_structure_functions(
|
||||
void test_Type_functions(
|
||||
const CGAL::Integral_domain_without_division_tag&) {
|
||||
AS x(-15);
|
||||
CGAL_NTS simplify(x);
|
||||
|
|
@ -594,24 +594,24 @@ void test_Algebraic_structure_functions(
|
|||
};
|
||||
|
||||
template <class AS >
|
||||
void test_Algebraic_structure_functions( const CGAL::Integral_domain_tag&) {
|
||||
test_Algebraic_structure_functions< AS >
|
||||
void test_Type_functions( const CGAL::Integral_domain_tag&) {
|
||||
test_Type_functions< AS >
|
||||
(CGAL::Integral_domain_without_division_tag());
|
||||
CGAL_test_assert(CGAL_NTS integral_division( AS (10), AS (2))== AS (5));
|
||||
};
|
||||
|
||||
template <class AS >
|
||||
void test_Algebraic_structure_functions(
|
||||
void test_Type_functions(
|
||||
const CGAL::Unique_factorization_domain_tag&) {
|
||||
test_Algebraic_structure_functions< AS >(CGAL::Integral_domain_tag());
|
||||
test_Type_functions< AS >(CGAL::Integral_domain_tag());
|
||||
|
||||
CGAL_test_assert(CGAL_NTS gcd( AS (21), AS (15)) == unit_normal(AS (3)));
|
||||
|
||||
};
|
||||
|
||||
template <class AS >
|
||||
void test_Algebraic_structure_functions( const CGAL::Euclidean_ring_tag&) {
|
||||
test_Algebraic_structure_functions< AS >(
|
||||
void test_Type_functions( const CGAL::Euclidean_ring_tag&) {
|
||||
test_Type_functions< AS >(
|
||||
CGAL::Unique_factorization_domain_tag());
|
||||
//std::cerr << CGAL_NTS mod( AS(14), AS(5) ) << std::endl;
|
||||
CGAL_test_assert(CGAL_NTS mod( AS (14), AS (5))== unit_normal( AS (4) ));
|
||||
|
|
@ -623,23 +623,23 @@ void test_Algebraic_structure_functions( const CGAL::Euclidean_ring_tag&) {
|
|||
};
|
||||
|
||||
template <class AS >
|
||||
void test_Algebraic_structure_functions( const CGAL::Field_tag&) {
|
||||
test_Algebraic_structure_functions< AS >(CGAL::Integral_domain_tag());
|
||||
void test_Type_functions( const CGAL::Field_tag&) {
|
||||
test_Type_functions< AS >(CGAL::Integral_domain_tag());
|
||||
CGAL_test_assert(CGAL_NTS unit_part( AS (-15))== AS (-15));
|
||||
CGAL_test_assert(CGAL_NTS unit_part( AS (0 ))== AS ( 1));
|
||||
};
|
||||
|
||||
template <class AS >
|
||||
void test_Algebraic_structure_functions( const CGAL::Field_with_sqrt_tag&) {
|
||||
test_Algebraic_structure_functions< AS >(CGAL::Field_tag());
|
||||
void test_Type_functions( const CGAL::Field_with_sqrt_tag&) {
|
||||
test_Type_functions< AS >(CGAL::Field_tag());
|
||||
typedef Algebraic_structure_traits<AS> AST;
|
||||
typedef typename AST::Is_exact Is_exact;
|
||||
AS c = CGAL_NTS sqrt( AS (4));
|
||||
CGAL_test_assert( !Is_exact::value || c == AS (2) );
|
||||
}
|
||||
template <class AS >
|
||||
void test_Algebraic_structure_functions( const CGAL::Field_with_root_of_tag&) {
|
||||
test_Algebraic_structure_functions< AS >(CGAL::Field_with_sqrt_tag());
|
||||
void test_Type_functions( const CGAL::Field_with_root_of_tag&) {
|
||||
test_Type_functions< AS >(CGAL::Field_with_sqrt_tag());
|
||||
std::vector< AS > coeffs(4);
|
||||
coeffs[0]= AS (-27);
|
||||
coeffs[1]= AS (0);
|
||||
|
|
@ -701,7 +701,7 @@ template <class AS , class Algebra_type, class Is_exact>
|
|||
void test_algebraic_structure(){
|
||||
|
||||
test_ast_functor_arity<AS>();
|
||||
test_Algebraic_structure_functions< AS >(Algebra_type());
|
||||
test_Type_functions< AS >(Algebra_type());
|
||||
typedef CGAL::Algebraic_structure_traits< AS > AST;
|
||||
CGAL_SNAP_AST_FUNCTORS(AST);
|
||||
typedef typename AST::Algebraic_structure_tag Algebra;
|
||||
|
|
@ -850,4 +850,4 @@ void test_algebraic_structure_without_exactness_check(
|
|||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_TEST_NUMBER_TYPE_H
|
||||
#endif // CGAL_TEST_NUMBER_Type_H
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ CGAL_BEGIN_NAMESPACE
|
|||
namespace INTERN_COERCION_TRAITS {
|
||||
|
||||
|
||||
template< class A, class B, class Coercion_type, class Compare >
|
||||
template< class A, class B, class Type, class Compare >
|
||||
class Test_compare {
|
||||
public:
|
||||
void operator()() {
|
||||
|
|
@ -30,13 +30,13 @@ class Test_compare {
|
|||
A a(4);
|
||||
B b(2);
|
||||
typename CGAL::Coercion_traits< A, B >::Cast cast;
|
||||
Coercion_type a_ret = cast(a);
|
||||
Coercion_type b_ret = cast(b);
|
||||
Type a_ret = cast(a);
|
||||
Type b_ret = cast(b);
|
||||
CGAL_test_assert( compare( a, b ) == CGAL_NTS compare( a_ret, b_ret ) );
|
||||
}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type, class Integral_division >
|
||||
template< class A, class B, class Type, class Integral_division >
|
||||
class Test_integral_division {
|
||||
public:
|
||||
void operator()() {
|
||||
|
|
@ -44,21 +44,21 @@ class Test_integral_division {
|
|||
A a(4);
|
||||
B b(2);
|
||||
typename CGAL::Coercion_traits< A, B >::Cast cast;
|
||||
Coercion_type a_ret = cast(a);
|
||||
Coercion_type b_ret = cast(b);
|
||||
Type a_ret = cast(a);
|
||||
Type b_ret = cast(b);
|
||||
CGAL_test_assert( integral_division( a, b ) ==
|
||||
CGAL_NTS integral_division( a_ret, b_ret ) );
|
||||
}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
class Test_integral_division< A, B, Coercion_type, CGAL::Null_functor > {
|
||||
template< class A, class B, class Type >
|
||||
class Test_integral_division< A, B, Type, CGAL::Null_functor > {
|
||||
public:
|
||||
// Nothing to test
|
||||
void operator()(){}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type, class Gcd >
|
||||
template< class A, class B, class Type, class Gcd >
|
||||
class Test_gcd {
|
||||
public:
|
||||
void operator()() {
|
||||
|
|
@ -66,21 +66,21 @@ class Test_gcd {
|
|||
A a(4);
|
||||
B b(2);
|
||||
typename CGAL::Coercion_traits< A, B >::Cast cast;
|
||||
Coercion_type a_ret = cast(a);
|
||||
Coercion_type b_ret = cast(b);
|
||||
Type a_ret = cast(a);
|
||||
Type b_ret = cast(b);
|
||||
CGAL_test_assert( gcd( a, b ) ==
|
||||
CGAL_NTS gcd( a_ret, b_ret ) );
|
||||
}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
class Test_gcd< A, B, Coercion_type, CGAL::Null_functor > {
|
||||
template< class A, class B, class Type >
|
||||
class Test_gcd< A, B, Type, CGAL::Null_functor > {
|
||||
public:
|
||||
// Nothing to test
|
||||
void operator()(){}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type, class Div_mod >
|
||||
template< class A, class B, class Type, class Div_mod >
|
||||
class Test_div_mod {
|
||||
public:
|
||||
void operator()() {
|
||||
|
|
@ -88,12 +88,12 @@ class Test_div_mod {
|
|||
A a(4);
|
||||
B b(2);
|
||||
typename CGAL::Coercion_traits< A, B >::Cast cast;
|
||||
Coercion_type a_ret = cast(a);
|
||||
Coercion_type b_ret = cast(b);
|
||||
Coercion_type q;
|
||||
Coercion_type r;
|
||||
Coercion_type q_to_compare;
|
||||
Coercion_type r_to_compare;
|
||||
Type a_ret = cast(a);
|
||||
Type b_ret = cast(b);
|
||||
Type q;
|
||||
Type r;
|
||||
Type q_to_compare;
|
||||
Type r_to_compare;
|
||||
div_mod( a, b, q, r );
|
||||
CGAL_NTS div_mod( a_ret, b_ret, q_to_compare, r_to_compare );
|
||||
CGAL_test_assert( q == q_to_compare );
|
||||
|
|
@ -101,14 +101,14 @@ class Test_div_mod {
|
|||
}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
class Test_div_mod< A, B, Coercion_type, CGAL::Null_functor > {
|
||||
template< class A, class B, class Type >
|
||||
class Test_div_mod< A, B, Type, CGAL::Null_functor > {
|
||||
public:
|
||||
// Nothing to test
|
||||
void operator()(){}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type, class Div >
|
||||
template< class A, class B, class Type, class Div >
|
||||
class Test_div {
|
||||
public:
|
||||
void operator()() {
|
||||
|
|
@ -116,21 +116,21 @@ class Test_div {
|
|||
A a(4);
|
||||
B b(2);
|
||||
typename CGAL::Coercion_traits< A, B >::Cast cast;
|
||||
Coercion_type a_ret = cast(a);
|
||||
Coercion_type b_ret = cast(b);
|
||||
Type a_ret = cast(a);
|
||||
Type b_ret = cast(b);
|
||||
CGAL_test_assert( div( a, b ) ==
|
||||
CGAL_NTS div( a_ret, b_ret ) );
|
||||
}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
class Test_div< A, B, Coercion_type, CGAL::Null_functor > {
|
||||
template< class A, class B, class Type >
|
||||
class Test_div< A, B, Type, CGAL::Null_functor > {
|
||||
public:
|
||||
// Nothing to test
|
||||
void operator()(){}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type, class Mod >
|
||||
template< class A, class B, class Type, class Mod >
|
||||
class Test_mod {
|
||||
public:
|
||||
void operator()() {
|
||||
|
|
@ -138,83 +138,82 @@ class Test_mod {
|
|||
A a(4);
|
||||
B b(2);
|
||||
typename CGAL::Coercion_traits< A, B >::Cast cast;
|
||||
Coercion_type a_ret = cast(a);
|
||||
Coercion_type b_ret = cast(b);
|
||||
Type a_ret = cast(a);
|
||||
Type b_ret = cast(b);
|
||||
CGAL_test_assert( mod( a, b ) ==
|
||||
CGAL_NTS mod( a_ret, b_ret ) );
|
||||
}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
class Test_mod< A, B, Coercion_type, CGAL::Null_functor > {
|
||||
template< class A, class B, class Type >
|
||||
class Test_mod< A, B, Type, CGAL::Null_functor > {
|
||||
public:
|
||||
// Nothing to test
|
||||
void operator()(){}
|
||||
};
|
||||
|
||||
|
||||
template< class Coercion_type >
|
||||
void test_implicit_construction( Coercion_type a ) {
|
||||
template< class Type >
|
||||
void test_implicit_construction( Type a ) {
|
||||
(void)a;
|
||||
}
|
||||
|
||||
template< class A, class B, class Coercion_type, class Are_implicit_interoperable >
|
||||
template< class A, class B, class Type, class Are_implicit_interoperable >
|
||||
class Implicit_interoperability_test {
|
||||
public:
|
||||
void operator()() {
|
||||
// test implicit construction
|
||||
typedef Coercion_type Coercion_type_type;
|
||||
// Results in 'no matching function for call to...' compile error, if type Coercion_type
|
||||
// Results in 'no matching function for call to...' compile error, if type Type
|
||||
// is not implicit constructable from A and B (which is part of the concept)
|
||||
test_implicit_construction<Coercion_type>(A(1));
|
||||
test_implicit_construction<Coercion_type>(B(2));
|
||||
test_implicit_construction<Type>(A(1));
|
||||
test_implicit_construction<Type>(B(2));
|
||||
|
||||
// test explicit construction
|
||||
Coercion_type_type test_var = Coercion_type(A(1));
|
||||
test_var = Coercion_type(B(2));
|
||||
Type test_var = Type(A(1));
|
||||
test_var = Type(B(2));
|
||||
}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
class Implicit_interoperability_test<A,B,Coercion_type, CGAL::Tag_false > {
|
||||
template< class A, class B, class Type >
|
||||
class Implicit_interoperability_test<A,B,Type, CGAL::Tag_false > {
|
||||
public:
|
||||
void operator()() {}
|
||||
};
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
template< class A, class B, class Type >
|
||||
void interoperability_test_one_way() {
|
||||
typedef CGAL::Coercion_traits< A, B > CT;
|
||||
|
||||
CGAL_test_assert((::boost::is_same< typename CT::Are_implicit_interoperable,
|
||||
CGAL::Tag_true
|
||||
>::value));
|
||||
CGAL_test_assert((::boost::is_same< typename CT::Coercion_type, Coercion_type >::value));
|
||||
CGAL_test_assert((::boost::is_same< typename CT::Type, Type >::value));
|
||||
|
||||
// Implicit_interoperability_test
|
||||
Implicit_interoperability_test< A, B, Coercion_type,
|
||||
Implicit_interoperability_test< A, B, Type,
|
||||
typename CT::Are_implicit_interoperable >()();
|
||||
|
||||
Test_integral_division< A, B, Coercion_type,
|
||||
typename CGAL::Algebraic_structure_traits<Coercion_type>::Integral_division >()();
|
||||
Test_integral_division< A, B, Type,
|
||||
typename CGAL::Algebraic_structure_traits<Type>::Integral_division >()();
|
||||
|
||||
Test_gcd< A, B, Coercion_type,
|
||||
typename CGAL::Algebraic_structure_traits<Coercion_type>::Gcd >()();
|
||||
Test_gcd< A, B, Type,
|
||||
typename CGAL::Algebraic_structure_traits<Type>::Gcd >()();
|
||||
|
||||
Test_div_mod< A, B, Coercion_type,
|
||||
typename CGAL::Algebraic_structure_traits<Coercion_type>::Div_mod >()();
|
||||
Test_div_mod< A, B, Type,
|
||||
typename CGAL::Algebraic_structure_traits<Type>::Div_mod >()();
|
||||
|
||||
Test_div< A, B, Coercion_type,
|
||||
typename CGAL::Algebraic_structure_traits<Coercion_type>::Div >()();
|
||||
Test_mod< A, B, Coercion_type,
|
||||
typename CGAL::Algebraic_structure_traits<Coercion_type>::Mod >()();
|
||||
Test_compare< A, B, Coercion_type,
|
||||
typename CGAL::Real_embeddable_traits<Coercion_type>::Compare >()();
|
||||
Test_div< A, B, Type,
|
||||
typename CGAL::Algebraic_structure_traits<Type>::Div >()();
|
||||
Test_mod< A, B, Type,
|
||||
typename CGAL::Algebraic_structure_traits<Type>::Mod >()();
|
||||
Test_compare< A, B, Type,
|
||||
typename CGAL::Real_embeddable_traits<Type>::Compare >()();
|
||||
}
|
||||
|
||||
template< class A, class B, class Coercion_type >
|
||||
template< class A, class B, class Type >
|
||||
void interoperability_test() {
|
||||
interoperability_test_one_way< A, B, Coercion_type >();
|
||||
interoperability_test_one_way< B, A, Coercion_type >();
|
||||
interoperability_test_one_way< A, B, Type >();
|
||||
interoperability_test_one_way< B, A, Type >();
|
||||
}
|
||||
|
||||
template< class FROM, class TO >
|
||||
|
|
@ -226,13 +225,13 @@ template <class A, class B, class RT>
|
|||
void coercion_traits_test_one_way(){
|
||||
typedef CGAL::Coercion_traits<A,B> CT;
|
||||
{
|
||||
typedef typename CT::Coercion_type Coercion_type;
|
||||
typedef typename CT::Type Type;
|
||||
typename CT::Cast cast;
|
||||
CGAL_test_assert((::boost::is_same<
|
||||
typename CT::Are_explicit_interoperable,
|
||||
CGAL::Tag_true
|
||||
>::value));
|
||||
CGAL_test_assert((::boost::is_same<Coercion_type,RT>::value));
|
||||
CGAL_test_assert((::boost::is_same<Type,RT>::value));
|
||||
A a(3);
|
||||
B b(3);
|
||||
RT rt(3);
|
||||
|
|
@ -241,16 +240,16 @@ void coercion_traits_test_one_way(){
|
|||
}
|
||||
}
|
||||
|
||||
template <class A, class B, class Coercion_type>
|
||||
template <class A, class B, class Type>
|
||||
void coercion_traits_test(){
|
||||
coercion_traits_test_one_way<A,B,Coercion_type>();
|
||||
coercion_traits_test_one_way<B,A,Coercion_type>();
|
||||
coercion_traits_test_one_way<A,B,Type>();
|
||||
coercion_traits_test_one_way<B,A,Type>();
|
||||
|
||||
// TODO: Is this here OK?
|
||||
if((::boost::is_same< typename CGAL::Coercion_traits< A, B >::Are_implicit_interoperable,
|
||||
CGAL::Tag_true
|
||||
>::value)) {
|
||||
interoperability_test< A, B, Coercion_type >();
|
||||
interoperability_test< A, B, Type >();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ template <class T>
|
|||
void test_fraction_traits(){
|
||||
|
||||
typedef CGAL::Fraction_traits<T> FT;
|
||||
typedef typename FT::Fraction Fraction;
|
||||
typedef typename FT::Type Type;
|
||||
typedef typename FT::Is_fraction Is_fraction;
|
||||
typedef typename FT::Numerator Num;
|
||||
typedef typename FT::Denominator Den;
|
||||
|
|
@ -32,7 +32,7 @@ void test_fraction_traits(){
|
|||
typedef typename FT::Decompose Decompose;
|
||||
typedef typename FT::Compose Compose;
|
||||
|
||||
BOOST_STATIC_ASSERT( (::boost::is_same<Fraction,T>::value));
|
||||
BOOST_STATIC_ASSERT( (::boost::is_same<Type,T>::value));
|
||||
BOOST_STATIC_ASSERT( (::boost::is_same<Is_fraction,Tag_true>::value));
|
||||
BOOST_STATIC_ASSERT(!(::boost::is_same<Common_factor,Null_functor>::value));
|
||||
BOOST_STATIC_ASSERT(!(::boost::is_same<Decompose,Null_functor>::value));
|
||||
|
|
@ -40,7 +40,7 @@ void test_fraction_traits(){
|
|||
|
||||
|
||||
// Decompose
|
||||
Fraction frac = Fraction(7) / Fraction (5);
|
||||
Type frac = Type(7) / Type (5);
|
||||
Num num;
|
||||
Den den;
|
||||
Decompose()(frac,num,den);
|
||||
|
|
|
|||
|
|
@ -44,48 +44,48 @@
|
|||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template<class Real_embeddable, class ToDouble>
|
||||
template<class Type, class ToDouble>
|
||||
class Test_to_double {
|
||||
public:
|
||||
void operator() (const ToDouble& to_double) {
|
||||
typedef typename ToDouble::argument_type Argument_type;
|
||||
typedef typename ToDouble::result_type Result_type;
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same<Real_embeddable, Argument_type>::value));
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same<Type, Argument_type>::value));
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same<double, Result_type>::value));
|
||||
CGAL_test_assert(42.0 == to_double(Real_embeddable(42)));
|
||||
CGAL_test_assert(42.0 == to_double(Type(42)));
|
||||
}
|
||||
};
|
||||
|
||||
template<class Real_embeddable>
|
||||
class Test_to_double<Real_embeddable, CGAL::Null_tag> {
|
||||
template<class Type>
|
||||
class Test_to_double<Type, CGAL::Null_tag> {
|
||||
public:
|
||||
void operator() (CGAL::Null_functor) {
|
||||
CGAL_error("To_double functor not implemented");
|
||||
}
|
||||
};
|
||||
|
||||
template<class Real_embeddable, class To_interval>
|
||||
template<class Type, class To_interval>
|
||||
class Test_to_interval {
|
||||
public:
|
||||
void operator() (const To_interval& to_interval) {
|
||||
typedef typename To_interval::argument_type Argument_type;
|
||||
typedef typename To_interval::result_type Result_type;
|
||||
typedef std::pair<double,double> Interval_type;
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same<Real_embeddable, Argument_type>::value));
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same<Type, Argument_type>::value));
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same<Interval_type, Result_type>::value));
|
||||
|
||||
// CGAL_test_assert(NiX::in(42.0,to_Interval(Real_embeddable(42))));
|
||||
// CGAL_test_assert(NiX::in(42.0,to_Interval(Type(42))));
|
||||
// Instead of 'NiX::in':
|
||||
CGAL_test_assert( 42.0 >= to_interval( Real_embeddable(42) ).first );
|
||||
CGAL_test_assert( 42.0 <= to_interval( Real_embeddable(42) ).second );
|
||||
CGAL_test_assert( 42.0 >= to_interval( Type(42) ).first );
|
||||
CGAL_test_assert( 42.0 <= to_interval( Type(42) ).second );
|
||||
|
||||
CGAL_test_assert(to_interval(Real_embeddable(42)).first > 41.99);
|
||||
CGAL_test_assert(to_interval(Real_embeddable(42)).second < 42.01);
|
||||
CGAL_test_assert(to_interval(Type(42)).first > 41.99);
|
||||
CGAL_test_assert(to_interval(Type(42)).second < 42.01);
|
||||
|
||||
|
||||
/*
|
||||
Real_embeddable notdouble = ipower(2,60);
|
||||
notdouble = notdouble + Real_embeddable(1);
|
||||
Type notdouble = ipower(2,60);
|
||||
notdouble = notdouble + Type(1);
|
||||
Interval test = to_Interval(notdouble);
|
||||
double lower = ipower(2.0,60);
|
||||
double upper = ipower(2.0,53);
|
||||
|
|
@ -98,8 +98,8 @@ CGAL_BEGIN_NAMESPACE
|
|||
}
|
||||
};
|
||||
|
||||
template< class Real_embeddable >
|
||||
class Test_to_interval< Real_embeddable, CGAL::Null_tag> {
|
||||
template< class Type >
|
||||
class Test_to_interval< Type, CGAL::Null_tag> {
|
||||
public:
|
||||
void operator() (CGAL::Null_functor) {
|
||||
CGAL_assertion_msg(false, "To_Interval not implemented");
|
||||
|
|
@ -123,17 +123,17 @@ void test_ret_functor_arity() {
|
|||
}
|
||||
|
||||
|
||||
//! tests if \c Real_embeddable is a model for the \c RealComparable concept
|
||||
//! tests if \c Type is a model for the \c RealComparable concept
|
||||
//! and terminates the program with an error message if not.
|
||||
template <class Real_embeddable>
|
||||
template <class Type>
|
||||
void test_real_embeddable() {
|
||||
typedef CGAL::Real_embeddable_traits<Real_embeddable> RET;
|
||||
typedef CGAL::Real_embeddable_traits<Type> RET;
|
||||
CGAL_SNAP_RET_FUNCTORS(RET);
|
||||
typedef typename RET::Is_real_embeddable Is_real_embeddable;
|
||||
using CGAL::Tag_true;
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same< Is_real_embeddable, Tag_true>::value));
|
||||
|
||||
test_ret_functor_arity< Real_embeddable >();
|
||||
test_ret_functor_arity< Type >();
|
||||
typename RET::Compare compare;
|
||||
const Sign sign = Sign();
|
||||
const Abs abs=Abs();
|
||||
|
|
@ -142,9 +142,9 @@ void test_real_embeddable() {
|
|||
const Is_negative is_negative=Is_negative();
|
||||
const Is_zero is_zero=Is_zero();
|
||||
|
||||
Real_embeddable a(-2);
|
||||
Real_embeddable b(1);
|
||||
Real_embeddable c(0);
|
||||
Type a(-2);
|
||||
Type b(1);
|
||||
Type c(0);
|
||||
CGAL_test_assert( is_finite(a) );
|
||||
CGAL_test_assert( is_finite(b) );
|
||||
CGAL_test_assert( is_finite(c) );
|
||||
|
|
@ -185,81 +185,81 @@ void test_real_embeddable() {
|
|||
CGAL_test_assert( sign(c) > sign(a));
|
||||
CGAL_test_assert( sign(a) <= sign(c));
|
||||
CGAL_test_assert( sign(c) >= sign(a));
|
||||
CGAL_test_assert( abs(a) == Real_embeddable(2));
|
||||
CGAL_test_assert( abs(b) == Real_embeddable(1));
|
||||
CGAL_test_assert( abs(c) == Real_embeddable(0));
|
||||
CGAL_test_assert( abs(a) == Type(2));
|
||||
CGAL_test_assert( abs(b) == Type(1));
|
||||
CGAL_test_assert( abs(c) == Type(0));
|
||||
|
||||
// To_double --------------------------------------------------------------
|
||||
const To_double to_double = To_double();
|
||||
(void)to_double;
|
||||
Test_to_double<Real_embeddable, To_double> ttd;
|
||||
Test_to_double<Type, To_double> ttd;
|
||||
ttd(to_double);
|
||||
|
||||
// To_Interval ------------------------------------------------------------
|
||||
const To_interval to_interval = To_interval();
|
||||
(void)to_interval;
|
||||
Test_to_interval<Real_embeddable, To_interval> tti;
|
||||
Test_to_interval<Type, To_interval> tti;
|
||||
tti(to_interval);
|
||||
|
||||
// additional functions
|
||||
CGAL_test_assert( CGAL_NTS is_finite( Real_embeddable(1) ) );
|
||||
CGAL_test_assert( CGAL_NTS sign(Real_embeddable(-5))==CGAL::NEGATIVE);
|
||||
CGAL_test_assert( CGAL_NTS abs(Real_embeddable(-5))==Real_embeddable(5));
|
||||
// CGAL_test_assert(NiX::in(5.0,NiX::to_interval(Real_embeddable(5))));
|
||||
CGAL_test_assert( CGAL_NTS compare(Real_embeddable(-5),Real_embeddable(6))==CGAL::SMALLER);
|
||||
CGAL_test_assert( CGAL_NTS is_positive(Real_embeddable(23)) );
|
||||
CGAL_test_assert( CGAL_NTS is_negative(Real_embeddable(-23)) );
|
||||
CGAL_test_assert( CGAL_NTS is_zero( Real_embeddable(0) ) );
|
||||
CGAL_test_assert( !CGAL_NTS is_zero( Real_embeddable(23) ) );
|
||||
CGAL_test_assert( CGAL_NTS is_finite( Type(1) ) );
|
||||
CGAL_test_assert( CGAL_NTS sign(Type(-5))==CGAL::NEGATIVE);
|
||||
CGAL_test_assert( CGAL_NTS abs(Type(-5))==Type(5));
|
||||
// CGAL_test_assert(NiX::in(5.0,NiX::to_interval(Type(5))));
|
||||
CGAL_test_assert( CGAL_NTS compare(Type(-5),Type(6))==CGAL::SMALLER);
|
||||
CGAL_test_assert( CGAL_NTS is_positive(Type(23)) );
|
||||
CGAL_test_assert( CGAL_NTS is_negative(Type(-23)) );
|
||||
CGAL_test_assert( CGAL_NTS is_zero( Type(0) ) );
|
||||
CGAL_test_assert( !CGAL_NTS is_zero( Type(23) ) );
|
||||
|
||||
}
|
||||
|
||||
//! tests if \c Real_embeddable says it is not a model for the \c RealComparable
|
||||
//! tests if \c Type says it is not a model for the \c RealComparable
|
||||
//! concept and terminates the program with an error message if it
|
||||
//! actually is.
|
||||
template <class Real_embeddable>
|
||||
template <class Type>
|
||||
void test_not_real_embeddable() {
|
||||
typedef CGAL::Real_embeddable_traits<Real_embeddable> RET;
|
||||
typedef CGAL::Real_embeddable_traits<Type> RET;
|
||||
typedef typename RET::Is_real_embeddable Is_real_embeddable;
|
||||
using CGAL::Tag_false;
|
||||
BOOST_STATIC_ASSERT(( ::boost::is_same< Is_real_embeddable, Tag_false>::value));
|
||||
}
|
||||
|
||||
|
||||
//template <class Real_embeddable, class CeilLog2Abs>
|
||||
//void test_rounded_log2_abs(Real_embeddable zero, CGAL::Null_functor, CeilLog2Abs) {
|
||||
//template <class Type, class CeilLog2Abs>
|
||||
//void test_rounded_log2_abs(Type zero, CGAL::Null_functor, CeilLog2Abs) {
|
||||
// typedef CGAL::Null_functor Null_functor;
|
||||
// BOOST_STATIC_ASSERT(( ::boost::is_same< CeilLog2Abs, Null_functor>::value));
|
||||
//}
|
||||
//
|
||||
//template <class Real_embeddable, class FloorLog2Abs, class CeilLog2Abs>
|
||||
//void test_rounded_log2_abs(Real_embeddable zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) {
|
||||
//template <class Type, class FloorLog2Abs, class CeilLog2Abs>
|
||||
//void test_rounded_log2_abs(Type zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) {
|
||||
// typedef CGAL::Null_functor Null_functor;
|
||||
// BOOST_STATIC_ASSERT((!::boost::is_same< CeilLog2Abs, Null_functor>::value));
|
||||
//
|
||||
// CGAL_test_assert( fl_log(Real_embeddable( 7)) == 2 );
|
||||
// CGAL_test_assert( cl_log(Real_embeddable( 7)) == 3 );
|
||||
// CGAL_test_assert( fl_log(Real_embeddable( 8)) == 3 );
|
||||
// CGAL_test_assert( cl_log(Real_embeddable( 8)) == 3 );
|
||||
// CGAL_test_assert( fl_log(Real_embeddable(-9)) == 3 );
|
||||
// CGAL_test_assert( cl_log(Real_embeddable(-9)) == 4 );
|
||||
// CGAL_test_assert( fl_log(Type( 7)) == 2 );
|
||||
// CGAL_test_assert( cl_log(Type( 7)) == 3 );
|
||||
// CGAL_test_assert( fl_log(Type( 8)) == 3 );
|
||||
// CGAL_test_assert( cl_log(Type( 8)) == 3 );
|
||||
// CGAL_test_assert( fl_log(Type(-9)) == 3 );
|
||||
// CGAL_test_assert( cl_log(Type(-9)) == 4 );
|
||||
//
|
||||
// CGAL_test_assert( NiX::floor_log2_abs(Real_embeddable( 64)) == 6 );
|
||||
// CGAL_test_assert( NiX::ceil_log2_abs( Real_embeddable( 64)) == 6 );
|
||||
// CGAL_test_assert( NiX::floor_log2_abs(Real_embeddable(-126)) == 6 );
|
||||
// CGAL_test_assert( NiX::ceil_log2_abs( Real_embeddable(-126)) == 7 );
|
||||
// CGAL_test_assert( NiX::floor_log2_abs(Type( 64)) == 6 );
|
||||
// CGAL_test_assert( NiX::ceil_log2_abs( Type( 64)) == 6 );
|
||||
// CGAL_test_assert( NiX::floor_log2_abs(Type(-126)) == 6 );
|
||||
// CGAL_test_assert( NiX::ceil_log2_abs( Type(-126)) == 7 );
|
||||
//}
|
||||
//
|
||||
//
|
||||
////! tests that \c Floor_log2_abs and \c Ceil_log2_abs are
|
||||
////! \c both CGAL::Null_functor or both working properly
|
||||
////! (This is independent of the \c RealComparable concept)
|
||||
//template <class Real_embeddable>
|
||||
//template <class Type>
|
||||
//void test_rounded_log2_abs() {
|
||||
//
|
||||
// typedef typename NiX::Real_embeddable_traits<Real_embeddable>::Floor_log2_abs F;
|
||||
// typedef typename NiX::Real_embeddable_traits<Real_embeddable>::Ceil_log2_abs C;
|
||||
// test_rounded_log2_abs(Real_embeddable(0), F(), C());
|
||||
// typedef typename NiX::Real_embeddable_traits<Type>::Floor_log2_abs F;
|
||||
// typedef typename NiX::Real_embeddable_traits<Type>::Ceil_log2_abs C;
|
||||
// test_rounded_log2_abs(Type(0), F(), C());
|
||||
//}
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@
|
|||
template <class A, class B>
|
||||
inline
|
||||
typename CGAL::Algebraic_structure_traits<
|
||||
typename CGAL::Coercion_traits<A,B>::Coercion_type
|
||||
typename CGAL::Coercion_traits<A,B>::Type
|
||||
>::Integral_division::result_type
|
||||
integral_division(const A& a, const B& b){
|
||||
typedef CGAL::Coercion_traits<A,B> CT;
|
||||
typedef typename CT::Coercion_type Coercion_type;
|
||||
typedef typename CT::Type Type;
|
||||
typename CGAL::Algebraic_structure_traits<
|
||||
typename CGAL::Coercion_traits<A,B>::Coercion_type
|
||||
typename CGAL::Coercion_traits<A,B>::Type
|
||||
>::Integral_division integral_division;
|
||||
return integral_division(a,b);
|
||||
}
|
||||
|
|
@ -28,12 +28,12 @@ int
|
|||
test_coercion(const A& a, const B& b){
|
||||
std::cout << "START TEST" << std::endl;
|
||||
typedef CGAL::Coercion_traits<A,B> CT;
|
||||
typedef typename CT::Coercion_type Coercion_type;
|
||||
typedef typename CT::Type Type;
|
||||
typename CT::Cast cast;
|
||||
Coercion_type x = cast(a);
|
||||
Type x = cast(a);
|
||||
|
||||
typename CGAL::Algebraic_structure_traits<
|
||||
typename CGAL::Coercion_traits<A,B>::Coercion_type
|
||||
typename CGAL::Coercion_traits<A,B>::Type
|
||||
>::Integral_division integral_division;
|
||||
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue