Optimisation

This commit is contained in:
Andreas Fabri 2022-09-27 10:42:05 +01:00
parent 94c72ae386
commit 74e4d89cbc
32 changed files with 264 additions and 589 deletions

View File

@ -325,7 +325,7 @@ public:
Support_point_iterator Support_point_iterator
support_points_begin() const { support_points_begin() const {
CGAL_optimisation_assertion_msg(number_of_points() >= 2, CGAL_assertion_msg(number_of_points() >= 2,
"support_points_begin: not enough points"); "support_points_begin: not enough points");
return Support_point_iterator( return Support_point_iterator(
solver->basic_original_variable_indices_begin(), solver->basic_original_variable_indices_begin(),
@ -334,7 +334,7 @@ public:
Support_point_iterator Support_point_iterator
support_points_end() const { support_points_end() const {
CGAL_optimisation_assertion_msg(number_of_points() >= 2, CGAL_assertion_msg(number_of_points() >= 2,
"support_points_begin: not enough points"); "support_points_begin: not enough points");
return Support_point_iterator( return Support_point_iterator(
solver->basic_original_variable_indices_end(), solver->basic_original_variable_indices_end(),
@ -401,27 +401,27 @@ public:
// NOTE: an implicit conversion from ET to RT must be available! // NOTE: an implicit conversion from ET to RT must be available!
Point Point
center( ) const center( ) const
{ CGAL_optimisation_precondition( ! is_empty()); { CGAL_precondition( ! is_empty());
return tco.construct_point_d_object()( ambient_dimension(), return tco.construct_point_d_object()( ambient_dimension(),
center_coordinates_begin(), center_coordinates_begin(),
center_coordinates_end()); } center_coordinates_end()); }
FT FT
squared_inner_radius( ) const squared_inner_radius( ) const
{ CGAL_optimisation_precondition( ! is_empty()); { CGAL_precondition( ! is_empty());
return FT( squared_inner_radius_numerator()) / return FT( squared_inner_radius_numerator()) /
FT( squared_radii_denominator()); } FT( squared_radii_denominator()); }
FT FT
squared_outer_radius( ) const squared_outer_radius( ) const
{ CGAL_optimisation_precondition( ! is_empty()); { CGAL_precondition( ! is_empty());
return FT( squared_outer_radius_numerator()) / return FT( squared_outer_radius_numerator()) /
FT( squared_radii_denominator()); } FT( squared_radii_denominator()); }
// predicates // predicates
CGAL::Bounded_side CGAL::Bounded_side
bounded_side( const Point& p) const bounded_side( const Point& p) const
{ CGAL_optimisation_precondition( { CGAL_precondition(
is_empty() || tco.access_dimension_d_object()( p) == d); is_empty() || tco.access_dimension_d_object()( p) == d);
ET sqr_d = sqr_dist( p); ET sqr_d = sqr_dist( p);
ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d]; ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
@ -431,7 +431,7 @@ public:
bool bool
has_on_bounded_side( const Point& p) const has_on_bounded_side( const Point& p) const
{ CGAL_optimisation_precondition( { CGAL_precondition(
is_empty() || tco.access_dimension_d_object()( p) == d); is_empty() || tco.access_dimension_d_object()( p) == d);
ET sqr_d = sqr_dist( p); ET sqr_d = sqr_dist( p);
ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d]; ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
@ -440,7 +440,7 @@ public:
bool bool
has_on_boundary( const Point& p) const has_on_boundary( const Point& p) const
{ CGAL_optimisation_precondition( { CGAL_precondition(
is_empty() || tco.access_dimension_d_object()( p) == d); is_empty() || tco.access_dimension_d_object()( p) == d);
ET sqr_d = sqr_dist( p); ET sqr_d = sqr_dist( p);
ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d]; ET h_p_sqr = da_coord(p)[d] * da_coord(p)[d];
@ -449,7 +449,7 @@ public:
bool bool
has_on_unbounded_side( const Point& p) const has_on_unbounded_side( const Point& p) const
{ CGAL_optimisation_precondition( { CGAL_precondition(
is_empty() || tco.access_dimension_d_object()( p) == d); is_empty() || tco.access_dimension_d_object()( p) == d);
ET sqr_d = sqr_dist( p); ET sqr_d = sqr_dist( p);
ET h_p_sqr(da_coord(p)[d]); ET h_p_sqr(da_coord(p)[d]);
@ -468,14 +468,14 @@ public:
{ if ( points.size() > 0) points.erase( points.begin(), points.end()); { if ( points.size() > 0) points.erase( points.begin(), points.end());
std::copy( first, last, std::back_inserter( points)); std::copy( first, last, std::back_inserter( points));
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg( check_dimension(), CGAL_precondition_msg( check_dimension(),
"Not all points have the same dimension."); "Not all points have the same dimension.");
compute_min_annulus(); } compute_min_annulus(); }
void void
insert( const Point& p) insert( const Point& p)
{ if ( is_empty()) d = tco.access_dimension_d_object()( p); { if ( is_empty()) d = tco.access_dimension_d_object()( p);
CGAL_optimisation_precondition( CGAL_precondition(
tco.access_dimension_d_object()( p) == d); tco.access_dimension_d_object()( p) == d);
points.push_back( p); points.push_back( p);
compute_min_annulus(); } compute_min_annulus(); }
@ -483,10 +483,10 @@ public:
template < class InputIterator > template < class InputIterator >
void void
insert( InputIterator first, InputIterator last) insert( InputIterator first, InputIterator last)
{ CGAL_optimisation_precondition_code( std::size_t old_n = points.size()); { CGAL_precondition_code( std::size_t old_n = points.size());
points.insert( points.end(), first, last); points.insert( points.end(), first, last);
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg( check_dimension( old_n), CGAL_precondition_msg( check_dimension( old_n),
"Not all points have the same dimension."); "Not all points have the same dimension.");
compute_min_annulus(); } compute_min_annulus(); }
@ -645,7 +645,7 @@ private:
options.set_pricing_strategy(pricing_strategy(NT())); options.set_pricing_strategy(pricing_strategy(NT()));
delete solver; delete solver;
solver = new Solver(lp, options); solver = new Solver(lp, options);
CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL); CGAL_assertion(solver->status() == QP_OPTIMAL);
// compute center and squared radius // compute center and squared radius
ET sqr_sum = 0; ET sqr_sum = 0;
@ -829,7 +829,7 @@ operator << ( std::ostream& os,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -858,7 +858,7 @@ operator >> ( std::istream& is, CGAL::Min_annulus_d<Traits_>& min_annulus)
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!"); CGAL_assertion_msg( false, "CGAL::IO::mode invalid!");
break; } break; }
return( is); return( is);

View File

@ -191,7 +191,7 @@ class Min_circle_2 {
const Point& const Point&
support_point( std::size_t i) const support_point( std::size_t i) const
{ {
CGAL_optimisation_precondition(i < number_of_support_points()); CGAL_precondition(i < number_of_support_points());
return( support_points[ i]); return( support_points[ i]);
} }
// circle // circle
@ -256,7 +256,7 @@ class Min_circle_2 {
tco.circle.set( ); tco.circle.set( );
break; break;
default: default:
CGAL_optimisation_assertion( n_support_points <= 3 ); } CGAL_assertion( n_support_points <= 3 ); }
} }
void void
@ -334,7 +334,7 @@ class Min_circle_2 {
// initialize circle // initialize circle
tco.circle.set(); tco.circle.set();
CGAL_optimisation_postcondition( is_empty()); CGAL_postcondition( is_empty());
} }
// constructor for one point // constructor for one point
@ -349,7 +349,7 @@ class Min_circle_2 {
support_points[ 0] = p; support_points[ 0] = p;
tco.circle.set( p); tco.circle.set( p);
CGAL_optimisation_postcondition( is_degenerate()); CGAL_postcondition( is_degenerate());
} }
// constructor for two points // constructor for two points

View File

@ -293,7 +293,7 @@ operator << ( std::ostream& os,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -323,7 +323,7 @@ operator >> ( std::istream& is,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::mode invalid!"); "CGAL::IO::mode invalid!");
break; } break; }

View File

@ -332,7 +332,7 @@ operator << ( std::ostream& os,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -363,7 +363,7 @@ operator >> ( std::istream& is,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::mode invalid!"); "CGAL::IO::mode invalid!");
break; } break; }

View File

@ -60,7 +60,7 @@ operator << ( std::ostream& os,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -89,7 +89,7 @@ operator >> ( std::istream& is, CGAL::Min_circle_2<Traits_>& min_circle)
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!"); CGAL_assertion_msg( false, "CGAL::IO::mode invalid!");
break; } break; }
return( is); return( is);

View File

@ -11,7 +11,7 @@
// Author(s) : Sven Schoenherr <sven@inf.ethz.ch>, Bernd Gaertner // Author(s) : Sven Schoenherr <sven@inf.ethz.ch>, Bernd Gaertner
// includes // includes
# include <CGAL/Optimisation/assertions.h> # include <CGAL/assertions.h>
namespace CGAL { namespace CGAL {
@ -42,7 +42,7 @@ operator << ( std::ostream& os, const CGAL::Optimisation_circle_2<K_>& c)
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -79,7 +79,7 @@ operator >> ( std::istream& is, CGAL::Optimisation_circle_2<K_>& c)
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( is) invalid!"); "CGAL::IO::get_mode( is) invalid!");
break; } break; }

View File

@ -203,7 +203,7 @@ class Min_ellipse_2 {
const Point& const Point&
support_point( std::size_t i) const support_point( std::size_t i) const
{ {
CGAL_optimisation_precondition(i < number_of_support_points()); CGAL_precondition(i < number_of_support_points());
return( support_points[ i]); return( support_points[ i]);
} }
// ellipse // ellipse
@ -281,7 +281,7 @@ class Min_ellipse_2 {
tco.ellipse.set( ); tco.ellipse.set( );
break; break;
default: default:
CGAL_optimisation_assertion( ( n_support_points >= 0) && CGAL_assertion( ( n_support_points >= 0) &&
( n_support_points <= 5) ); } ( n_support_points <= 5) ); }
} }
@ -360,7 +360,7 @@ class Min_ellipse_2 {
// initialize ellipse // initialize ellipse
tco.ellipse.set(); tco.ellipse.set();
CGAL_optimisation_postcondition( is_empty()); CGAL_postcondition( is_empty());
} }
inline inline
@ -373,7 +373,7 @@ class Min_ellipse_2 {
// initialize ellipse // initialize ellipse
tco.ellipse.set(); tco.ellipse.set();
CGAL_optimisation_postcondition( is_empty()); CGAL_postcondition( is_empty());
} }
// constructor for one point // constructor for one point
@ -388,7 +388,7 @@ class Min_ellipse_2 {
support_points[ 0] = p; support_points[ 0] = p;
tco.ellipse.set( p); tco.ellipse.set( p);
CGAL_optimisation_postcondition( is_degenerate()); CGAL_postcondition( is_degenerate());
} }
// constructor for two points // constructor for two points
@ -409,7 +409,7 @@ class Min_ellipse_2 {
// compute me // compute me
me( points.end(), 0); me( points.end(), 0);
CGAL_optimisation_postcondition( is_degenerate()); CGAL_postcondition( is_degenerate());
} }
// constructor for three points // constructor for three points

View File

@ -18,7 +18,7 @@
// includes // includes
# include <CGAL/Cartesian/ConicCPA2.h> # include <CGAL/Cartesian/ConicCPA2.h>
# include <CGAL/Optimisation/assertions.h> # include <CGAL/assertions.h>
namespace CGAL { namespace CGAL {
@ -235,7 +235,7 @@ class _Min_ellipse_2_adapterC2__Ellipse {
int tau_star = c.vol_derivative( dr, ds, dt, du, dv, dw); int tau_star = c.vol_derivative( dr, ds, dt, du, dv, dw);
return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } } return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } }
default: default:
CGAL_optimisation_assertion( ( n_boundary_points >= 0) && CGAL_assertion( ( n_boundary_points >= 0) &&
( n_boundary_points <= 5) ); } ( n_boundary_points <= 5) ); }
// keeps g++ happy // keeps g++ happy
return( CGAL::Bounded_side( 0)); return( CGAL::Bounded_side( 0));
@ -298,7 +298,7 @@ class _Min_ellipse_2_adapterC2__Ellipse {
|| ( ( conic1 == e.conic2) || ( ( conic1 == e.conic2)
&& ( conic2 == e.conic1))); && ( conic2 == e.conic1)));
default: default:
CGAL_optimisation_assertion( ( n_boundary_points >= 0) CGAL_assertion( ( n_boundary_points >= 0)
&& ( n_boundary_points <= 5)); } && ( n_boundary_points <= 5)); }
// keeps g++ happy // keeps g++ happy
return( false); return( false);
@ -341,7 +341,7 @@ operator << ( std::ostream& os,
case CGAL::IO::BINARY: case CGAL::IO::BINARY:
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -405,7 +405,7 @@ operator >> ( std::istream& is,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::mode invalid!"); "CGAL::IO::mode invalid!");
break; } break; }

View File

@ -18,7 +18,7 @@
// includes // includes
# include <CGAL/Homogeneous/ConicHPA2.h> # include <CGAL/Homogeneous/ConicHPA2.h>
# include <CGAL/Optimisation/assertions.h> # include <CGAL/assertions.h>
namespace CGAL { namespace CGAL {
@ -243,7 +243,7 @@ class _Min_ellipse_2_adapterH2__Ellipse {
int tau_star = c.vol_derivative( dr, ds, dt, du, dv, dw); int tau_star = c.vol_derivative( dr, ds, dt, du, dv, dw);
return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } } return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } }
default: default:
CGAL_optimisation_assertion( ( n_boundary_points >= 0) && CGAL_assertion( ( n_boundary_points >= 0) &&
( n_boundary_points <= 5) ); } ( n_boundary_points <= 5) ); }
// keeps g++ happy // keeps g++ happy
return( CGAL::Bounded_side( 0)); return( CGAL::Bounded_side( 0));
@ -306,7 +306,7 @@ class _Min_ellipse_2_adapterH2__Ellipse {
|| ( ( conic1 == e.conic2) || ( ( conic1 == e.conic2)
&& ( conic2 == e.conic1))); && ( conic2 == e.conic1)));
default: default:
CGAL_optimisation_assertion( ( n_boundary_points >= 0) CGAL_assertion( ( n_boundary_points >= 0)
&& ( n_boundary_points <= 5)); } && ( n_boundary_points <= 5)); }
// keeps g++ happy // keeps g++ happy
return( false); return( false);
@ -349,7 +349,7 @@ operator << ( std::ostream& os,
case CGAL::IO::BINARY: case CGAL::IO::BINARY:
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -413,7 +413,7 @@ operator >> ( std::istream& is,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::mode invalid!"); "CGAL::IO::mode invalid!");
break; } break; }

View File

@ -60,7 +60,7 @@ operator << ( std::ostream& os,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -89,7 +89,7 @@ operator >> ( std::istream& is, CGAL::Min_ellipse_2<Traits_>& min_ellipse)
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, "CGAL::IO::mode invalid!"); CGAL_assertion_msg( false, "CGAL::IO::mode invalid!");
break; } break; }
return( is); return( is);

View File

@ -17,7 +17,7 @@
#include <CGAL/Conic_2.h> #include <CGAL/Conic_2.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/Kernel/global_functions_2.h> #include <CGAL/Kernel/global_functions_2.h>
@ -131,7 +131,7 @@ class Optimisation_ellipse_2 {
set( const Point& p, const Point& q) set( const Point& p, const Point& q)
{ {
n_boundary_points = 2; n_boundary_points = 2;
CGAL_optimisation_precondition(boundary_point1 == p); CGAL_USE(p); CGAL_precondition(boundary_point1 == p); CGAL_USE(p);
boundary_point2 = q; boundary_point2 = q;
} }
@ -139,20 +139,20 @@ class Optimisation_ellipse_2 {
set( const Point& p1, const Point& p2, const Point& p3) set( const Point& p1, const Point& p2, const Point& p3)
{ {
n_boundary_points = 3; n_boundary_points = 3;
CGAL_optimisation_precondition(boundary_point1 == p1); CGAL_precondition(boundary_point1 == p1);
CGAL_optimisation_precondition(boundary_point2 == p2); CGAL_precondition(boundary_point2 == p2);
boundary_point3 = p3; boundary_point3 = p3;
helper_conic.set_ellipse( p1, p2, p3); helper_conic.set_ellipse( p1, p2, p3);
CGAL_optimisation_assertion(helper_conic.is_ellipse()); CGAL_assertion(helper_conic.is_ellipse());
} }
void void
set( const Point& p1, const Point& p2, const Point& p3, const Point& p4) set( const Point& p1, const Point& p2, const Point& p3, const Point& p4)
{ {
n_boundary_points = 4; n_boundary_points = 4;
CGAL_optimisation_precondition(boundary_point1 == p1); CGAL_precondition(boundary_point1 == p1);
CGAL_optimisation_precondition(boundary_point2 == p2); CGAL_precondition(boundary_point2 == p2);
CGAL_optimisation_precondition(boundary_point3 == p3); CGAL_precondition(boundary_point3 == p3);
boundary_point4 = p4; boundary_point4 = p4;
Conic::set_two_linepairs( p1, p2, p3, p4, conic1, conic2); Conic::set_two_linepairs( p1, p2, p3, p4, conic1, conic2);
@ -195,7 +195,7 @@ class Optimisation_ellipse_2 {
if (!helper_ellipse_set) { if (!helper_ellipse_set) {
helper_ellipse.set_ellipse( conic1, conic2); helper_ellipse.set_ellipse( conic1, conic2);
helper_ellipse.analyse(); helper_ellipse.analyse();
CGAL_optimisation_assertion (helper_ellipse.is_ellipse()); CGAL_assertion (helper_ellipse.is_ellipse());
helper_ellipse_set= true; helper_ellipse_set= true;
} }
} }
@ -211,14 +211,14 @@ class Optimisation_ellipse_2 {
// In that case, helper_conic is already correct, // In that case, helper_conic is already correct,
// but in general, this optimization is NOT valid. // but in general, this optimization is NOT valid.
n_boundary_points = 5; n_boundary_points = 5;
CGAL_optimisation_assertion(helper_conic.is_ellipse()); CGAL_assertion(helper_conic.is_ellipse());
// the following assertion is too strict if we run under // the following assertion is too strict if we run under
// double (which is sometimes the case, e.g. in demos) // double (which is sometimes the case, e.g. in demos)
// CGAL_optimisation_assertion(helper_conic.has_on_boundary(p5)); // CGAL_assertion(helper_conic.has_on_boundary(p5));
CGAL_optimisation_precondition(boundary_point1 == p1); CGAL_precondition(boundary_point1 == p1);
CGAL_optimisation_precondition(boundary_point2 == p2); CGAL_precondition(boundary_point2 == p2);
CGAL_optimisation_precondition(boundary_point3 == p3); CGAL_precondition(boundary_point3 == p3);
CGAL_optimisation_precondition(boundary_point4 == p4); CGAL_precondition(boundary_point4 == p4);
CGAL_USE(p1); CGAL_USE(p2); CGAL_USE(p3); CGAL_USE(p4); CGAL_USE(p1); CGAL_USE(p2); CGAL_USE(p3); CGAL_USE(p4);
boundary_point5 = p5; boundary_point5 = p5;
} }
@ -247,7 +247,7 @@ class Optimisation_ellipse_2 {
double &u, double &v, double &w) const double &u, double &v, double &w) const
{ {
// just like double_conic, but we only get the coefficients // just like double_conic, but we only get the coefficients
CGAL_optimisation_precondition( ! is_degenerate()); CGAL_precondition( ! is_degenerate());
if ( n_boundary_points == 4) { if ( n_boundary_points == 4) {
set_e_values(); set_e_values();
@ -297,7 +297,7 @@ class Optimisation_ellipse_2 {
|| ( ( conic1 == e.conic2) || ( ( conic1 == e.conic2)
&& ( conic2 == e.conic1))); && ( conic2 == e.conic1)));
default: default:
CGAL_optimisation_assertion( ( n_boundary_points >= 0) CGAL_assertion( ( n_boundary_points >= 0)
&& ( n_boundary_points <= 5)); } && ( n_boundary_points <= 5)); }
// keeps g++ happy // keeps g++ happy
return( false); return( false);
@ -343,7 +343,7 @@ class Optimisation_ellipse_2 {
helper_conic.vol_derivative( dr, ds, dt, du, dv, dw); helper_conic.vol_derivative( dr, ds, dt, du, dv, dw);
return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } } return( CGAL::Bounded_side( CGAL_NTS sign( tau_star))); } }
default: default:
CGAL_optimisation_assertion( ( n_boundary_points >= 0) && CGAL_assertion( ( n_boundary_points >= 0) &&
( n_boundary_points <= 5) ); } ( n_boundary_points <= 5) ); }
// keeps g++ happy // keeps g++ happy
return( CGAL::Bounded_side( 0)); return( CGAL::Bounded_side( 0));
@ -416,7 +416,7 @@ class Optimisation_ellipse_2 {
return (CGAL::ZERO == (c.vol_derivative(dr, ds, dt, du, dv, dw))); return (CGAL::ZERO == (c.vol_derivative(dr, ds, dt, du, dv, dw)));
} }
default: default:
CGAL_optimisation_assertion( ( n_boundary_points >= 0) && CGAL_assertion( ( n_boundary_points >= 0) &&
( n_boundary_points <= 5) ); ( n_boundary_points <= 5) );
return false; return false;
} }

View File

@ -43,7 +43,7 @@ operator << ( std::ostream& os, const CGAL::Optimisation_ellipse_2<K_>& e)
case CGAL::IO::BINARY: case CGAL::IO::BINARY:
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }
@ -106,7 +106,7 @@ operator >> ( std::istream& is, CGAL::Optimisation_ellipse_2<K_>& e)
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( is) invalid!"); "CGAL::IO::get_mode( is) invalid!");
break; } break; }

View File

@ -18,7 +18,7 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/Point_2.h> #include <CGAL/Point_2.h>
#include <CGAL/Direction_2.h> #include <CGAL/Direction_2.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
@ -303,36 +303,36 @@ public:
if (assign(tmp, tmpo)) { if (assign(tmp, tmpo)) {
*o++ = tmp; *o++ = tmp;
} else { } else {
CGAL_optimisation_assertion_code(bool test1 =) CGAL_assertion_code(bool test1 =)
assign(tmpl, tmpo); assign(tmpl, tmpo);
CGAL_optimisation_assertion(test1); CGAL_assertion(test1);
*o++ = r.p1; *o++ = r.p1;
} }
tmpo = isec(line(r.p3, r.d1), line(r.p2, r.d2)); tmpo = isec(line(r.p3, r.d1), line(r.p2, r.d2));
if (assign(tmp, tmpo)) { if (assign(tmp, tmpo)) {
*o++ = tmp; *o++ = tmp;
} else { } else {
CGAL_optimisation_assertion_code(bool test1 =) CGAL_assertion_code(bool test1 =)
assign(tmpl, tmpo); assign(tmpl, tmpo);
CGAL_optimisation_assertion(test1); CGAL_assertion(test1);
*o++ = r.p2; *o++ = r.p2;
} }
tmpo = isec(line(r.p3, r.d1), line(r.p4, r.d2)); tmpo = isec(line(r.p3, r.d1), line(r.p4, r.d2));
if (assign(tmp, tmpo)) { if (assign(tmp, tmpo)) {
*o++ = tmp; *o++ = tmp;
} else { } else {
CGAL_optimisation_assertion_code(bool test1 =) CGAL_assertion_code(bool test1 =)
assign(tmpl, tmpo); assign(tmpl, tmpo);
CGAL_optimisation_assertion(test1); CGAL_assertion(test1);
*o++ = r.p3; *o++ = r.p3;
} }
tmpo = isec(line(r.p1, r.d1), line(r.p4, r.d2)); tmpo = isec(line(r.p1, r.d1), line(r.p4, r.d2));
if (assign(tmp, tmpo)) { if (assign(tmp, tmpo)) {
*o++ = tmp; *o++ = tmp;
} else { } else {
CGAL_optimisation_assertion_code(bool test1 =) CGAL_assertion_code(bool test1 =)
assign(tmpl, tmpo); assign(tmpl, tmpo);
CGAL_optimisation_assertion(test1); CGAL_assertion(test1);
*o++ = r.p3; *o++ = r.p3;
} }
return o; return o;

View File

@ -26,7 +26,7 @@
# include <CGAL/basic.h> # include <CGAL/basic.h>
# include <CGAL/Optimisation/assertions.h> # include <CGAL/assertions.h>
# include <CGAL/Optimisation/basic.h> # include <CGAL/Optimisation/basic.h>
@ -110,7 +110,7 @@ public:
#endif #endif
if (points.size()>0) { if (points.size()>0) {
d = tco.access_dimension_d_object() (points.front()); d = tco.access_dimension_d_object() (points.front());
CGAL_optimisation_precondition ((d>=0) && all_points_have_dim(d)); CGAL_precondition ((d>=0) && all_points_have_dim(d));
ms_basis.get_sphere(Rep_tag()).set_size (d); ms_basis.get_sphere(Rep_tag()).set_size (d);
pivot_ms(); pivot_ms();
} }
@ -137,7 +137,7 @@ public:
#endif #endif
if (points.size()>0) { if (points.size()>0) {
d = tco.access_dimension_d_object() (points.front()); d = tco.access_dimension_d_object() (points.front());
CGAL_optimisation_precondition ((d>=0) && all_points_have_dim(d)); CGAL_precondition ((d>=0) && all_points_have_dim(d));
ms_basis.get_sphere(Rep_tag()).set_size (d); ms_basis.get_sphere(Rep_tag()).set_size (d);
pivot_ms(); pivot_ms();
} }
@ -211,13 +211,13 @@ public:
Point center () const Point center () const
{ {
CGAL_optimisation_precondition (!is_empty()); CGAL_precondition (!is_empty());
return ms_basis.get_sphere(Rep_tag()).center(); return ms_basis.get_sphere(Rep_tag()).center();
} }
FT squared_radius () const FT squared_radius () const
{ {
CGAL_optimisation_precondition (!is_empty()); CGAL_precondition (!is_empty());
return ms_basis.get_sphere(Rep_tag()).squared_radius(); return ms_basis.get_sphere(Rep_tag()).squared_radius();
} }
@ -227,7 +227,7 @@ public:
if (d == -1) if (d == -1)
return ON_UNBOUNDED_SIDE; return ON_UNBOUNDED_SIDE;
else { else {
CGAL_optimisation_precondition CGAL_precondition
(d == tco.access_dimension_d_object()(p)); (d == tco.access_dimension_d_object()(p));
return (Bounded_side return (Bounded_side
(-CGAL::sign (ms_basis.get_sphere(Rep_tag()).excess (p)))); (-CGAL::sign (ms_basis.get_sphere(Rep_tag()).excess (p))));
@ -239,7 +239,7 @@ public:
if (d == -1) if (d == -1)
return false; return false;
else { else {
CGAL_optimisation_precondition CGAL_precondition
(d == tco.access_dimension_d_object()(p)); (d == tco.access_dimension_d_object()(p));
return (CGAL_NTS is_negative (ms_basis.get_sphere(Rep_tag()).excess (p))); return (CGAL_NTS is_negative (ms_basis.get_sphere(Rep_tag()).excess (p)));
} }
@ -250,7 +250,7 @@ public:
if (d == -1) if (d == -1)
return true; return true;
else { else {
CGAL_optimisation_precondition CGAL_precondition
(d == tco.access_dimension_d_object()(p)); (d == tco.access_dimension_d_object()(p));
return (CGAL_NTS is_positive (ms_basis.get_sphere(Rep_tag()).excess (p))); return (CGAL_NTS is_positive (ms_basis.get_sphere(Rep_tag()).excess (p)));
} }
@ -261,7 +261,7 @@ public:
if (d == -1) if (d == -1)
return false; return false;
else { else {
CGAL_optimisation_precondition CGAL_precondition
(d == tco.access_dimension_d_object()(p)); (d == tco.access_dimension_d_object()(p));
return (CGAL_NTS is_zero (ms_basis.get_sphere(Rep_tag()).excess (p))); return (CGAL_NTS is_zero (ms_basis.get_sphere(Rep_tag()).excess (p)));
} }
@ -296,7 +296,7 @@ public:
support_end = points.begin(); support_end = points.begin();
if (points.size()>0) { if (points.size()>0) {
d = tco.access_dimension_d_object() (points.front()); d = tco.access_dimension_d_object() (points.front());
CGAL_optimisation_precondition ((d>=0) && all_points_have_dim (d)); CGAL_precondition ((d>=0) && all_points_have_dim (d));
ms_basis.get_sphere(Rep_tag()).set_size (d); ms_basis.get_sphere(Rep_tag()).set_size (d);
pivot_ms(); pivot_ms();
} else { } else {
@ -310,7 +310,7 @@ public:
if (has_on_unbounded_side (p)) { if (has_on_unbounded_side (p)) {
if (is_empty()) { if (is_empty()) {
d = tco.access_dimension_d_object() (p); d = tco.access_dimension_d_object() (p);
CGAL_optimisation_precondition (d>=0); CGAL_precondition (d>=0);
ms_basis.get_sphere(Rep_tag()).set_size (d); ms_basis.get_sphere(Rep_tag()).set_size (d);
} }
// ensure precondition of pivot_ms // ensure precondition of pivot_ms

View File

@ -62,7 +62,7 @@ operator << ( std::ostream& os, const Min_sphere_d<Traits>& min_sphere)
break; break;
default: default:
CGAL_optimisation_assertion_msg CGAL_assertion_msg
( false, "IO::get_mode( os) invalid!"); ( false, "IO::get_mode( os) invalid!");
break; } break; }
@ -93,7 +93,7 @@ operator >> ( std::istream& is, Min_sphere_d<Traits>& min_sphere)
} break; } break;
default: default:
CGAL_optimisation_assertion_msg( false, "IO::mode invalid!"); CGAL_assertion_msg( false, "IO::mode invalid!");
break; break;
} }

View File

@ -42,7 +42,7 @@ class Optimisation_sphere_d<Cartesian_tag, FT, RT, PT, Traits>;
#include <CGAL/Optimisation/basic.h> #include <CGAL/Optimisation/basic.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
namespace CGAL { namespace CGAL {
@ -188,7 +188,7 @@ class Optimisation_sphere_d<Cartesian_tag, FT, RT, PT, Traits>;
// compute z // compute z
FT z = FT_(2)*v_basis[m+1] - prod(v,x,m+1); FT z = FT_(2)*v_basis[m+1] - prod(v,x,m+1);
CGAL_optimisation_assertion (!CGAL_NTS is_zero (z)); CGAL_assertion (!CGAL_NTS is_zero (z));
FT inv_z = FT_(1)/z; FT inv_z = FT_(1)/z;
// set up A^{-1}_{B^m} // set up A^{-1}_{B^m}
@ -461,7 +461,7 @@ class Optimisation_sphere_d<Cartesian_tag, FT, RT, PT, Traits>;
// compute \tilde{z} // compute \tilde{z}
RT old_denom = denom[m-1]; RT old_denom = denom[m-1];
RT z = old_denom*RT_(2)*sqr_q_m - prod(v,x,m+1); RT z = old_denom*RT_(2)*sqr_q_m - prod(v,x,m+1);
CGAL_optimisation_assertion (!CGAL_NTS is_zero (z)); CGAL_assertion (!CGAL_NTS is_zero (z));
// set up \tilde{A}^{-1}_{B^m} // set up \tilde{A}^{-1}_{B^m}
RT** M = inv[m-1]; // \tilde{A}^{-1}_B, old matrix RT** M = inv[m-1]; // \tilde{A}^{-1}_B, old matrix
@ -503,7 +503,7 @@ class Optimisation_sphere_d<Cartesian_tag, FT, RT, PT, Traits>;
// get h_p // get h_p
RT h_p = *(i++); RT h_p = *(i++);
CGAL_optimisation_precondition (!CGAL_NTS is_zero (h_p)); CGAL_precondition (!CGAL_NTS is_zero (h_p));
// compute (h_p h D)^2 (c-p)^2 // compute (h_p h D)^2 (c-p)^2
RT sqr_dist(RT(0)); RT sqr_dist(RT(0));

View File

@ -20,7 +20,7 @@
#include <CGAL/Iso_rectangle_2.h> #include <CGAL/Iso_rectangle_2.h>
#include <CGAL/basic_constructions_2.h> #include <CGAL/basic_constructions_2.h>
#include <CGAL/pierce_rectangles_2.h> #include <CGAL/pierce_rectangles_2.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
namespace CGAL { namespace CGAL {
@ -228,21 +228,21 @@ struct Rectangular_p_center_matrix_search_traits_2 {
bool operator()(FT v) bool operator()(FT v)
{ {
CGAL_optimisation_assertion(ld.size() == ld_size); CGAL_assertion(ld.size() == ld_size);
ld.r = v / FT(2); ld.r = v / FT(2);
bool ok; bool ok;
pf(ld, Wastebasket< Point_2 >(), ok); pf(ld, Wastebasket< Point_2 >(), ok);
CGAL_optimisation_assertion(ld.size() == ld_size); CGAL_assertion(ld.size() == ld_size);
return ok; return ok;
} }
template < class OutputIterator > template < class OutputIterator >
OutputIterator operator()(FT v, OutputIterator o, bool& ok) OutputIterator operator()(FT v, OutputIterator o, bool& ok)
{ {
CGAL_optimisation_assertion(ld.size() == ld_size); CGAL_assertion(ld.size() == ld_size);
ld.r = v / FT(2); ld.r = v / FT(2);
OutputIterator n = pf(ld, o, ok); OutputIterator n = pf(ld, o, ok);
CGAL_optimisation_assertion(ld.size() == ld_size); CGAL_assertion(ld.size() == ld_size);
return n; //pf(ld, o, ok); return n; //pf(ld, o, ok);
} }
@ -250,7 +250,7 @@ protected:
// data members: // data members:
LD ld; LD ld;
PiercingFunction pf; PiercingFunction pf;
CGAL_optimisation_assertion_code(typename LD::size_type ld_size;) CGAL_assertion_code(typename LD::size_type ld_size;)
// copying this would be too inefficient // copying this would be too inefficient
Rectangular_p_center_matrix_search_traits_2( Rectangular_p_center_matrix_search_traits_2(

View File

@ -18,7 +18,7 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <iterator> #include <iterator>
#include <functional> #include <functional>
@ -346,8 +346,8 @@ min_rectangle_2(
{ {
typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits; typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits;
Traits t(bt); Traits t(bt);
CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t)); CGAL_expensive_precondition(is_convex_2(f, l, t));
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
orientation_2(f, l, t) == COUNTERCLOCKWISE); orientation_2(f, l, t) == COUNTERCLOCKWISE);
// check for trivial cases // check for trivial cases
@ -395,7 +395,7 @@ min_rectangle_2(
int yet_to_finish = 0; int yet_to_finish = 0;
for (int i1 = 0; i1 < 4; ++i1) { for (int i1 = 0; i1 < 4; ++i1) {
CGAL_optimisation_assertion(limit[i1] != l); CGAL_assertion(limit[i1] != l);
if (curr[i1] != limit[i1]) if (curr[i1] != limit[i1])
++yet_to_finish; ++yet_to_finish;
} }
@ -448,7 +448,7 @@ min_parallelogram_2(ForwardIterator f,
{ {
typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits; typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits;
Traits t(bt); Traits t(bt);
CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t)); CGAL_expensive_precondition(is_convex_2(f, l, t));
// types from the traits class // types from the traits class
typedef typename Traits::Direction_2 Direction_2; typedef typename Traits::Direction_2 Direction_2;
@ -630,7 +630,7 @@ min_strip_2(ForwardIterator f,
{ {
typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits; typedef Optimisation::Min_quadrilateral_traits_wrapper<BTraits> Traits;
Traits t(bt); Traits t(bt);
CGAL_optimisation_expensive_precondition(is_convex_2(f, l, t)); CGAL_expensive_precondition(is_convex_2(f, l, t));
// types from the traits class // types from the traits class
typedef typename Traits::Direction_2 Direction_2; typedef typename Traits::Direction_2 Direction_2;

View File

@ -16,7 +16,7 @@
#include <CGAL/license/Bounding_volumes.h> #include <CGAL/license/Bounding_volumes.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/circulator.h> #include <CGAL/circulator.h>
#include <CGAL/algorithm.h> #include <CGAL/algorithm.h>
#include <algorithm> #include <algorithm>
@ -75,7 +75,7 @@ struct Loc_domain {
void void
update(int j, Citerator i) update(int j, Citerator i)
{ {
CGAL_optimisation_precondition(j >= 0 && j < 4); CGAL_precondition(j >= 0 && j < 4);
if (j < 2) if (j < 2)
if (j == 0) { if (j == 0) {
if (traits.less_x_2_object()(*i, minx)) minx = *i; if (traits.less_x_2_object()(*i, minx)) minx = *i;
@ -106,9 +106,9 @@ struct Loc_domain {
maxy(pts.front()), maxy(pts.front()),
traits(t) traits(t)
{ {
CGAL_optimisation_precondition(b != e); CGAL_precondition(b != e);
Iterator i = pts.begin(); Iterator i = pts.begin();
CGAL_optimisation_assertion(i != pts.end()); CGAL_assertion(i != pts.end());
while (++i != pts.end()) { while (++i != pts.end()) {
if (traits.less_x_2_object()(*i, minx)) minx = *i; if (traits.less_x_2_object()(*i, minx)) minx = *i;
if (traits.less_x_2_object()(maxx, *i)) maxx = *i; if (traits.less_x_2_object()(maxx, *i)) maxx = *i;
@ -124,7 +124,7 @@ struct Loc_domain {
operator[](int i) const operator[](int i) const
// return corner points (0 <-> bottom-left, 1 <-> bottom-right) // return corner points (0 <-> bottom-left, 1 <-> bottom-right)
{ {
CGAL_optimisation_precondition(i >= 0 && i < 4); CGAL_precondition(i >= 0 && i < 4);
if (i == 0) if (i == 0)
return traits.construct_point_2_above_right_implicit_point_2_object()( return traits.construct_point_2_above_right_implicit_point_2_object()(
minx, miny, r); minx, miny, r);
@ -142,7 +142,7 @@ struct Loc_domain {
extreme(int i) const extreme(int i) const
// return extreme points (0 <-> left, 1 <-> bottom) // return extreme points (0 <-> left, 1 <-> bottom)
{ {
CGAL_optimisation_precondition(i >= 0 && i < 4); CGAL_precondition(i >= 0 && i < 4);
if (i > 1) return i == 2 ? maxx : maxy; if (i > 1) return i == 2 ? maxx : maxy;
return i == 0 ? minx : miny; return i == 0 ? minx : miny;
} }
@ -151,7 +151,7 @@ struct Loc_domain {
extreme(int i) extreme(int i)
// return extreme points (0 <-> left, 1 <-> bottom) // return extreme points (0 <-> left, 1 <-> bottom)
{ {
CGAL_optimisation_precondition(i >= 0 && i < 4); CGAL_precondition(i >= 0 && i < 4);
if (i > 1) return i == 2 ? maxx : maxy; if (i > 1) return i == 2 ? maxx : maxy;
return i == 0 ? minx : miny; return i == 0 ? minx : miny;
} }
@ -177,13 +177,13 @@ struct Loc_domain {
void void
check() const { check() const {
CGAL_optimisation_expensive_assertion_code( CGAL_expensive_assertion_code(
Iterator i = pts.begin(); Iterator i = pts.begin();
do { do {
CGAL_optimisation_assertion(!traits.less_x_2_object()(*i, minx)); CGAL_assertion(!traits.less_x_2_object()(*i, minx));
CGAL_optimisation_assertion(!traits.less_x_2_object()(maxx, *i)); CGAL_assertion(!traits.less_x_2_object()(maxx, *i));
CGAL_optimisation_assertion(!traits.less_y_2_object()(*i, miny)); CGAL_assertion(!traits.less_y_2_object()(*i, miny));
CGAL_optimisation_assertion(!traits.less_y_2_object()(maxy, *i)); CGAL_assertion(!traits.less_y_2_object()(maxy, *i));
} while (++i != end); } while (++i != end);
) )
} }
@ -463,7 +463,7 @@ inline OutputIterator
two_cover_points( two_cover_points(
InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t) InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t)
{ {
CGAL_optimisation_precondition(f != l); CGAL_precondition(f != l);
// compute location domain: // compute location domain:
Loc_domain< Traits > d(f, l, t); Loc_domain< Traits > d(f, l, t);
@ -475,7 +475,7 @@ inline OutputIterator
three_cover_points( three_cover_points(
InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t) InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t)
{ {
CGAL_optimisation_precondition(f != l); CGAL_precondition(f != l);
// compute location domain: // compute location domain:
Loc_domain< Traits > d(f, l, t); Loc_domain< Traits > d(f, l, t);
@ -487,7 +487,7 @@ inline OutputIterator
four_cover_points( four_cover_points(
InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t) InputIC f, InputIC l, OutputIterator o, bool& ok, const Traits& t)
{ {
CGAL_optimisation_precondition(f != l); CGAL_precondition(f != l);
// compute location domain: // compute location domain:
Loc_domain< Traits > d(f, l, t); Loc_domain< Traits > d(f, l, t);
@ -562,7 +562,7 @@ three_cover_points(
using std::less; using std::less;
using std::iter_swap; using std::iter_swap;
CGAL_optimisation_precondition(!d.empty()); CGAL_precondition(!d.empty());
// typedefs: // typedefs:
typedef typename Traits::Point_2 Point_2; typedef typename Traits::Point_2 Point_2;
@ -583,7 +583,7 @@ three_cover_points(
// are all points already covered? // are all points already covered?
if (i == d.end()) { if (i == d.end()) {
CGAL_optimisation_assertion(k == 0); CGAL_assertion(k == 0);
*o++ = d[0]; *o++ = d[0];
ok = true; ok = true;
return o; return o;
@ -620,11 +620,11 @@ three_cover_points(
// check disjoint for two-pierceability: // check disjoint for two-pierceability:
CGAL_optimisation_expensive_assertion( CGAL_expensive_assertion(
save_end == find_if(d.end(), save_end, save_end == find_if(d.end(), save_end,
[&d, &dist, &corner](const Point_2& p) [&d, &dist, &corner](const Point_2& p)
{ return d.r < dist(corner, p); })); { return d.r < dist(corner, p); }));
CGAL_optimisation_expensive_assertion( CGAL_expensive_assertion(
d.end() == find_if(d.begin(), d.end(), d.end() == find_if(d.begin(), d.end(),
[&d,&dist, &corner](const Point_2& p) [&d,&dist, &corner](const Point_2& p)
{ return d.r >= dist(corner, p); })); { return d.r >= dist(corner, p); }));
@ -721,7 +721,7 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok)
// are all points already covered? // are all points already covered?
if (i == d.end()) { if (i == d.end()) {
CGAL_optimisation_assertion(k == 0); CGAL_assertion(k == 0);
*o++ = d[0]; *o++ = d[0];
ok = true; ok = true;
return o; return o;
@ -758,11 +758,11 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok)
// check disjoint for two-pierceability: // check disjoint for two-pierceability:
CGAL_optimisation_expensive_assertion( CGAL_expensive_assertion(
save_end == find_if(d.end(), save_end, save_end == find_if(d.end(), save_end,
[&d,&dist,&corner](const Point_2& p) [&d,&dist,&corner](const Point_2& p)
{ return d.r < dist(corner, p); })); { return d.r < dist(corner, p); }));
CGAL_optimisation_expensive_assertion( CGAL_expensive_assertion(
d.end() == find_if(d.begin(), d.end(), d.end() == find_if(d.begin(), d.end(),
[&d,&dist,&corner](const Point_2& p) [&d,&dist,&corner](const Point_2& p)
{ return d.r >= dist(corner, p); })); { return d.r >= dist(corner, p); }));

View File

@ -17,7 +17,7 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/algorithm.h> #include <CGAL/algorithm.h>
#include <CGAL/Rectangular_p_center_traits_2.h> #include <CGAL/Rectangular_p_center_traits_2.h>
#include <algorithm> #include <algorithm>
@ -965,7 +965,7 @@ rectangular_3_center_2_type2(
(Q_r_empty || op.compute_y_distance(q_r, Q_r) <= op.delta()(*m))) { (Q_r_empty || op.compute_y_distance(q_r, Q_r) <= op.delta()(*m))) {
boost::function1<bool,FT> boost::function1<bool,FT>
greater_delta_m = boost::bind(less< FT >(), op.delta()(*m)); greater_delta_m = boost::bind(less< FT >(), op.delta()(*m));
CGAL_optimisation_assertion_code(RandomAccessIterator iii =) CGAL_assertion_code(RandomAccessIterator iii =)
find_if(e, find_if(e,
l, l,
boost::bind(logical_and< bool >(), boost::bind(logical_and< bool >(),
@ -973,7 +973,7 @@ rectangular_3_center_2_type2(
boost::bind(op.distance(), q_t, _1)), boost::bind(op.distance(), q_t, _1)),
boost::bind(greater_delta_m, boost::bind(greater_delta_m,
boost::bind(op.distance(), q_r, _1)))); boost::bind(op.distance(), q_r, _1))));
CGAL_optimisation_assertion(iii == l); CGAL_assertion(iii == l);
} }
// check whether the points in [f,s) are covered // check whether the points in [f,s) are covered
{ {
@ -985,7 +985,7 @@ rectangular_3_center_2_type2(
boost::bind(le_delta_m, boost::bind(op.distance(), q_t, _1))); boost::bind(le_delta_m, boost::bind(op.distance(), q_t, _1)));
iii = partition(iii, s, iii = partition(iii, s,
boost::bind(le_delta_m, boost::bind(op.distance(), q_r, _1))); boost::bind(le_delta_m, boost::bind(op.distance(), q_r, _1)));
CGAL_optimisation_assertion(iii == s); CGAL_assertion(iii == s);
} }
#endif // CGAL_3COVER_CHECK #endif // CGAL_3COVER_CHECK
@ -1052,7 +1052,7 @@ rectangular_3_center_2_type2(
} }
// step (e) [not enough points in G] // step (e) [not enough points in G]
CGAL_optimisation_assertion(b1 - (m + 1) >= 5 * cutoff); CGAL_assertion(b1 - (m + 1) >= 5 * cutoff);
// compute the four cutting lines for R // compute the four cutting lines for R
std::nth_element(m + 1, m + 1 + cutoff, b1, less_x_2); std::nth_element(m + 1, m + 1 + cutoff, b1, less_x_2);
@ -1113,7 +1113,7 @@ rectangular_3_center_2_type2(
// now s_b corresponds to the first moment in [s, m+1) // now s_b corresponds to the first moment in [s, m+1)
// where q_t and q_r cover B // where q_t and q_r cover B
CGAL_optimisation_assertion_code(bool loopcheck = false;) CGAL_assertion_code(bool loopcheck = false;)
CGAL_3CENTER_REPEAT_CHECK: CGAL_3CENTER_REPEAT_CHECK:
// place q_t and q_r // place q_t and q_r
q_t = op.place_x_square(q_t_afap, r, op.delta()(*s_b)); q_t = op.place_x_square(q_t_afap, r, op.delta()(*s_b));
@ -1142,9 +1142,9 @@ CGAL_3CENTER_REPEAT_CHECK:
// in degenerate situations it can happen that the number of // in degenerate situations it can happen that the number of
// points in R is too small => decrease radius and check again // points in R is too small => decrease radius and check again
--s_b; --s_b;
CGAL_optimisation_assertion(!loopcheck); CGAL_assertion(!loopcheck);
CGAL_optimisation_assertion(s != s_b); CGAL_assertion(s != s_b);
CGAL_optimisation_assertion_code(loopcheck = true;) CGAL_assertion_code(loopcheck = true;)
goto CGAL_3CENTER_REPEAT_CHECK; goto CGAL_3CENTER_REPEAT_CHECK;
} }
s = b1; s = b1;
@ -1166,7 +1166,7 @@ CGAL_3CENTER_REPEAT_CHECK:
// we still have a covering // we still have a covering
if (s_b == s) { if (s_b == s) {
CGAL_optimisation_expensive_assertion_code( CGAL_expensive_assertion_code(
std::vector< Point > tmppts(f, l); std::vector< Point > tmppts(f, l);
RandomAccessIterator ii = RandomAccessIterator ii =
partition(tmppts.begin(), tmppts.end(), partition(tmppts.begin(), tmppts.end(),
@ -1174,9 +1174,9 @@ CGAL_3CENTER_REPEAT_CHECK:
IP tmppos = min_max_element(ii, tmppts.end(), IP tmppos = min_max_element(ii, tmppts.end(),
op.compare_x(), op.compare_y()); op.compare_x(), op.compare_y());
) )
CGAL_optimisation_expensive_assertion( CGAL_expensive_assertion(
!op.compare_x()(*tmppos.first, q_t)); !op.compare_x()(*tmppos.first, q_t));
CGAL_optimisation_expensive_assertion( CGAL_expensive_assertion(
!op.compare_y()(q_r, *tmppos.second)); !op.compare_y()(q_r, *tmppos.second));
// we are done // we are done
@ -1219,7 +1219,7 @@ CGAL_3CENTER_REPEAT_CHECK:
[&op, s_b](const Point& p){ return op.delta()(*s_b) != op.delta()(p); }); [&op, s_b](const Point& p){ return op.delta()(*s_b) != op.delta()(p); });
rho_max = op.delta()(*s_b); rho_max = op.delta()(*s_b);
q_t_at_rho_max = q_t, q_r_at_rho_max = q_r; q_t_at_rho_max = q_t, q_r_at_rho_max = q_r;
CGAL_optimisation_assertion(op.delta()(*next) < op.delta()(*s_b)); CGAL_assertion(op.delta()(*next) < op.delta()(*s_b));
q_t_afap = op.update_x_square(q_t_afap, *s_b); q_t_afap = op.update_x_square(q_t_afap, *s_b);
q_r_afap = op.update_y_square(q_r_afap, *s_b); q_r_afap = op.update_y_square(q_r_afap, *s_b);
q_t = op.place_x_square(q_t_afap, r, op.delta()(*next)); q_t = op.place_x_square(q_t_afap, r, op.delta()(*next));
@ -1255,7 +1255,7 @@ CGAL_3CENTER_REPEAT_CHECK:
} }
CGAL_optimisation_assertion(b3 - b1 >= cutoff); CGAL_assertion(b3 - b1 >= cutoff);
e = b1; e = b1;
// adjust Q_t // adjust Q_t
if (b1 != b2) { if (b1 != b2) {
@ -1299,7 +1299,7 @@ CGAL_3CENTER_REPEAT_CHECK:
rho_max = max BOOST_PREVENT_MACRO_SUBSTITUTION (op.compute_x_distance(q_t, Q_t), rho_max = max BOOST_PREVENT_MACRO_SUBSTITUTION (op.compute_x_distance(q_t, Q_t),
op.compute_y_distance(q_r, Q_r)); op.compute_y_distance(q_r, Q_r));
#ifndef CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST #ifndef CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST
CGAL_optimisation_assertion(rho_max <= rad); CGAL_assertion(rho_max <= rad);
#endif // ! CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST #endif // ! CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST
rad = rho_max; rad = rho_max;
*o++ = op.construct_corner_square(r, rad / FT(2)); *o++ = op.construct_corner_square(r, rad / FT(2));
@ -1307,7 +1307,7 @@ CGAL_3CENTER_REPEAT_CHECK:
*o++ = op.construct_y_square(q_r, rad / FT(2)); *o++ = op.construct_y_square(q_r, rad / FT(2));
return o; return o;
} }
CGAL_optimisation_assertion(s != e); CGAL_assertion(s != e);
// find the first diameter where covering is possible // find the first diameter where covering is possible
for (;;) { for (;;) {
@ -1324,7 +1324,7 @@ CGAL_3CENTER_REPEAT_CHECK:
// try the next possible diameter value // try the next possible diameter value
FT try_rho = op.delta()(*t); FT try_rho = op.delta()(*t);
CGAL_optimisation_assertion(t == s || try_rho < rho_max); CGAL_assertion(t == s || try_rho < rho_max);
q_t = op.place_x_square(q_t_afap, r, try_rho); q_t = op.place_x_square(q_t_afap, r, try_rho);
q_r = op.place_y_square(q_r_afap, r, try_rho); q_r = op.place_y_square(q_r_afap, r, try_rho);
@ -1370,8 +1370,8 @@ CGAL_3CENTER_REPEAT_CHECK:
// - q_r_at_rho_max is the corr. position of q_r. // - q_r_at_rho_max is the corr. position of q_r.
// try rho_min // try rho_min
CGAL_optimisation_assertion(rho_min <= rho_max); CGAL_assertion(rho_min <= rho_max);
CGAL_optimisation_assertion(rho_min >= 0); CGAL_assertion(rho_min >= 0);
FT rad_2 = q_t_q_r_cover_at_rho_min; FT rad_2 = q_t_q_r_cover_at_rho_min;
if (s_at_rho_min != e_at_rho_min) { if (s_at_rho_min != e_at_rho_min) {
auto mydist = [&q_t_at_rho_min, &q_r_at_rho_min, &op](const Point& p) auto mydist = [&q_t_at_rho_min, &q_r_at_rho_min, &op](const Point& p)
@ -1384,7 +1384,7 @@ CGAL_3CENTER_REPEAT_CHECK:
[&mydist](const Point& p1, const Point& p2) [&mydist](const Point& p1, const Point& p2)
{ return mydist(p1) < mydist(p2); }))); { return mydist(p1) < mydist(p2); })));
} }
CGAL_optimisation_assertion(rad_2 == 0 || rad_2 > rho_min); CGAL_assertion(rad_2 == 0 || rad_2 > rho_min);
// if a covering with rho == 0 is possible, // if a covering with rho == 0 is possible,
// it will be catched in the type1 functions // it will be catched in the type1 functions
@ -1397,7 +1397,7 @@ CGAL_3CENTER_REPEAT_CHECK:
q_t = q_t_at_rho_min, q_r = q_r_at_rho_min; q_t = q_t_at_rho_min, q_r = q_r_at_rho_min;
#ifndef CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST #ifndef CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST
CGAL_optimisation_assertion(rad_2 <= rad); CGAL_assertion(rad_2 <= rad);
#endif // ! CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST #endif // ! CGAL_3COVER_NO_CHECK_OPTIMUM_FIRST
rad = rad_2; rad = rad_2;
*o++ = op.construct_corner_square(r, rad / FT(2)); *o++ = op.construct_corner_square(r, rad / FT(2));
@ -1414,7 +1414,7 @@ rectangular_3_center_2(
typename Traits::FT& r, typename Traits::FT& r,
Traits& t) Traits& t)
{ {
CGAL_optimisation_precondition(f != l); CGAL_precondition(f != l);
typedef typename Traits::FT FT; typedef typename Traits::FT FT;
typedef typename Traits::Point_2 Point; typedef typename Traits::Point_2 Point;
typedef typename Traits::Iso_rectangle_2 Rectangle; typedef typename Traits::Iso_rectangle_2 Rectangle;

View File

@ -72,8 +72,8 @@ public:
Value Value
operator()( int r, int c) const operator()( int r, int c) const
{ {
CGAL_optimisation_precondition( r >= 0 && r < number_of_rows()); CGAL_precondition( r >= 0 && r < number_of_rows());
CGAL_optimisation_precondition( c >= 0 && c < number_of_columns()); CGAL_precondition( c >= 0 && c < number_of_columns());
return Base::operator()( r, number_of_columns() - 1 - c); return Base::operator()( r, number_of_columns() - 1 - c);
} }
}; };
@ -145,7 +145,7 @@ rectangular_p_center_2_binary_search(
// -------------- // --------------
// //
{ {
CGAL_optimisation_precondition( f != l); CGAL_precondition( f != l);
// typedefs: // typedefs:
typedef typename Traits::FT FT; typedef typename Traits::FT FT;
@ -171,7 +171,7 @@ rectangular_p_center_2_binary_search(
c_diffs.push_back( CGAL_NTS abs( i->x() - j->x())); c_diffs.push_back( CGAL_NTS abs( i->x() - j->x()));
c_diffs.push_back( CGAL_NTS abs( i->y() - j->y())); c_diffs.push_back( CGAL_NTS abs( i->y() - j->y()));
} }
CGAL_optimisation_assertion( CGAL_assertion(
c_diffs.size() == pierce_it.number_of_points() * c_diffs.size() == pierce_it.number_of_points() *
(pierce_it.number_of_points() - 1)); (pierce_it.number_of_points() - 1));
@ -195,12 +195,12 @@ rectangular_p_center_2_binary_search(
b = c + 1; b = c + 1;
} }
} // while ( e > b) } // while ( e > b)
CGAL_optimisation_assertion( e == b); CGAL_assertion( e == b);
// return the result: // return the result:
r = c_diffs[e]; r = c_diffs[e];
OutputIterator o_return( pierce_it( r, o, ok)); OutputIterator o_return( pierce_it( r, o, ok));
CGAL_optimisation_assertion( ok); CGAL_assertion( ok);
return o_return; return o_return;
} // rectangular_p_center_2_binary_search( ... ) } // rectangular_p_center_2_binary_search( ... )
@ -221,7 +221,7 @@ rectangular_p_center_2_matrix_search(
const MatrixOperator& mop) const MatrixOperator& mop)
{ {
std::size_t number_of_points( iterator_distance( f, l)); std::size_t number_of_points( iterator_distance( f, l));
CGAL_optimisation_precondition( number_of_points > 0); CGAL_precondition( number_of_points > 0);
using std::minus; using std::minus;
using std::sort; using std::sort;
@ -296,7 +296,7 @@ rectangular_p_center_2_matrix_search(
// return result: // return result:
OutputIterator o_return(pierce_it(r, o, ok)); OutputIterator o_return(pierce_it(r, o, ok));
CGAL_optimisation_assertion(ok); CGAL_assertion(ok);
return o_return; return o_return;
} // P_center_matrix_search } // P_center_matrix_search
@ -341,7 +341,7 @@ rectangular_p_center_matrix_search_2(
FT& r, FT& r,
int p) int p)
{ {
CGAL_optimisation_precondition(p >= 2 && p < 5); CGAL_precondition(p >= 2 && p < 5);
typename std::iterator_traits<ForwardIterator>::value_type::R t; typename std::iterator_traits<ForwardIterator>::value_type::R t;
if (p == 2) if (p == 2)
return rectangular_p_center_2_matrix_search( return rectangular_p_center_2_matrix_search(
@ -401,7 +401,7 @@ rectangular_p_center_2(ForwardIterator f,
int p, int p,
Traits& t) Traits& t)
{ {
CGAL_optimisation_precondition(p >= 2 && p < 5); CGAL_precondition(p >= 2 && p < 5);
r=0; r=0;
if ( !internal::is_distance_greater_than_p(f,l,p) ) return std::copy(f,l,o); if ( !internal::is_distance_greater_than_p(f,l,p) ) return std::copy(f,l,o);
@ -422,7 +422,7 @@ rectangular_p_center_2(ForwardIterator f,
FT& r, FT& r,
int p) int p)
{ {
CGAL_optimisation_precondition(p >= 2 && p < 5); CGAL_precondition(p >= 2 && p < 5);
typedef typename typedef typename
std::iterator_traits< ForwardIterator >::value_type::R R; std::iterator_traits< ForwardIterator >::value_type::R R;
Rectangular_p_center_default_traits_2< R > t; Rectangular_p_center_default_traits_2< R > t;

View File

@ -16,7 +16,7 @@
#include <CGAL/license/Inscribed_areas.h> #include <CGAL/license/Inscribed_areas.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/squared_distance_2.h> #include <CGAL/squared_distance_2.h>
#include <CGAL/Polygon_2.h> #include <CGAL/Polygon_2.h>
#include <boost/function.hpp> #include <boost/function.hpp>
@ -83,7 +83,7 @@ struct Extremal_polygon_area_traits_2 {
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, static_cast<int>(iterator_distance( points_begin,
points_end))); points_end)));
CGAL_optimisation_precondition( number_of_points > min_k()); CGAL_precondition( number_of_points > min_k());
// this gives the area of the triangle of two points with // this gives the area of the triangle of two points with
// the root: // the root:
@ -136,7 +136,7 @@ protected:
}; };
} //namespace CGAL } //namespace CGAL
#include <CGAL/Optimisation/assertions.h>
#include <cmath> #include <cmath>
#ifdef CGAL_USE_LEDA #ifdef CGAL_USE_LEDA
#include <CGAL/leda_real.h> #include <CGAL/leda_real.h>
@ -221,11 +221,11 @@ struct Extremal_polygon_perimeter_traits_2 {
using std::less; using std::less;
using std::max_element; using std::max_element;
CGAL_optimisation_precondition_code( CGAL_precondition_code(
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, static_cast<int>(iterator_distance( points_begin,
points_end)));) points_end)));)
CGAL_optimisation_precondition( number_of_points > min_k()); CGAL_precondition( number_of_points > min_k());
// kind of messy, but first we have to have something // kind of messy, but first we have to have something
// like Distance (function object) ... // like Distance (function object) ...

View File

@ -16,7 +16,7 @@
#include <CGAL/license/Inscribed_areas.h> #include <CGAL/license/Inscribed_areas.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/monotone_matrix_search.h> #include <CGAL/monotone_matrix_search.h>
#include <CGAL/Dynamic_matrix.h> #include <CGAL/Dynamic_matrix.h>
#include <CGAL/Transform_iterator.h> #include <CGAL/Transform_iterator.h>
@ -76,7 +76,7 @@ public:
RandomAccessIC_object begin_col, RandomAccessIC_object begin_col,
RandomAccessIC_object end_col, RandomAccessIC_object end_col,
RandomAccessIC_value begin_value, RandomAccessIC_value begin_value,
RandomAccessIC_value CGAL_optimisation_precondition_code(end_value), RandomAccessIC_value CGAL_precondition_code(end_value),
const Operation& o) const Operation& o)
// initialization with two ranges [begin_row, end_row) and // initialization with two ranges [begin_row, end_row) and
// [begin_col, end_col) of Objects, a range [begin_value, end_value) // [begin_col, end_col) of Objects, a range [begin_value, end_value)
@ -92,9 +92,9 @@ public:
n_rows( static_cast<int>(iterator_distance( begin_row, end_row))), n_rows( static_cast<int>(iterator_distance( begin_row, end_row))),
n_cols( static_cast<int>(iterator_distance( begin_col, end_col))) n_cols( static_cast<int>(iterator_distance( begin_col, end_col)))
{ {
CGAL_optimisation_precondition( CGAL_precondition(
iterator_distance( begin_value, end_value) == n_cols); iterator_distance( begin_value, end_value) == n_cols);
CGAL_optimisation_assertion( n_rows > 0 && n_cols > 0); CGAL_assertion( n_rows > 0 && n_cols > 0);
} }
int int
@ -108,8 +108,8 @@ public:
Value Value
operator()( int r, int c) const operator()( int r, int c) const
{ {
CGAL_optimisation_precondition( r >= 0 && r < n_rows); CGAL_precondition( r >= 0 && r < n_rows);
CGAL_optimisation_precondition( c >= 0 && c < n_cols); CGAL_precondition( c >= 0 && c < n_cols);
return begin_value_[c] + op( begin_row_[r], begin_col_[c]); return begin_value_[c] + op( begin_row_[r], begin_col_[c]);
} }
@ -181,11 +181,11 @@ CGAL_maximum_inscribed_rooted_k_gon_2(
// returns the past-the-end iterator of that sequence. // returns the past-the-end iterator of that sequence.
{ {
// check preconditions: // check preconditions:
CGAL_optimisation_precondition( k >= t.min_k()); CGAL_precondition( k >= t.min_k());
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, static_cast<int>(iterator_distance( points_begin,
points_end))); points_end)));
CGAL_optimisation_precondition( number_of_points > k); CGAL_precondition( number_of_points > k);
typedef std::vector< int > Index_cont; typedef std::vector< int > Index_cont;
@ -203,7 +203,7 @@ CGAL_maximum_inscribed_rooted_k_gon_2(
points_begin, points_end, max_area, gon.rbegin() + k + 1 - i); points_begin, points_end, max_area, gon.rbegin() + k + 1 - i);
for (;;) { for (;;) {
CGAL_optimisation_assertion( gon[0] == 0); CGAL_assertion( gon[0] == 0);
gon[i] = number_of_points - 1; gon[i] = number_of_points - 1;
if ( ++i >= k) if ( ++i >= k)
break; break;
@ -243,7 +243,7 @@ CGAL_maximum_inscribed_rooted_k_gon_2(
RandomAccessIC_point points_end, RandomAccessIC_point points_end,
int root, int root,
RandomAccessIC_int left_c_begin, RandomAccessIC_int left_c_begin,
RandomAccessIC_int CGAL_optimisation_precondition_code(left_c_end), RandomAccessIC_int CGAL_precondition_code(left_c_end),
RandomAccessIC_int right_c_begin, RandomAccessIC_int right_c_begin,
RandomAccessIC_int right_c_end, RandomAccessIC_int right_c_end,
typename Traits::FT& max_area, typename Traits::FT& max_area,
@ -294,26 +294,26 @@ CGAL_maximum_inscribed_rooted_k_gon_2(
right_c_end)); right_c_end));
// check preconditions: // check preconditions:
CGAL_optimisation_precondition( number_of_points > t.min_k()); CGAL_precondition( number_of_points > t.min_k());
CGAL_optimisation_precondition( size_of_gon >= t.min_k() - 1); CGAL_precondition( size_of_gon >= t.min_k() - 1);
CGAL_optimisation_precondition( CGAL_precondition(
iterator_distance( left_c_begin, left_c_end) == iterator_distance( left_c_begin, left_c_end) ==
iterator_distance( right_c_begin, right_c_end)); iterator_distance( right_c_begin, right_c_end));
CGAL_optimisation_precondition( left_c_begin[0] >= 0); CGAL_precondition( left_c_begin[0] >= 0);
CGAL_optimisation_precondition( right_c_begin[0] >= 0); CGAL_precondition( right_c_begin[0] >= 0);
CGAL_optimisation_precondition( CGAL_precondition(
left_c_begin[size_of_gon-1] < number_of_points); left_c_begin[size_of_gon-1] < number_of_points);
CGAL_optimisation_precondition( CGAL_precondition(
right_c_begin[size_of_gon-1] < number_of_points); right_c_begin[size_of_gon-1] < number_of_points);
CGAL_optimisation_expensive_precondition_code( CGAL_expensive_precondition_code(
for ( i = 0; i < size_of_gon; ++i) { for ( i = 0; i < size_of_gon; ++i) {
CGAL_optimisation_expensive_precondition( left_c_begin[i] >= 0); CGAL_expensive_precondition( left_c_begin[i] >= 0);
CGAL_optimisation_expensive_precondition( right_c_begin[i] >= 0); CGAL_expensive_precondition( right_c_begin[i] >= 0);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
left_c_begin[i] < number_of_points); left_c_begin[i] < number_of_points);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
right_c_begin[i] < number_of_points); right_c_begin[i] < number_of_points);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
left_c_begin[i] <= right_c_begin[i]); left_c_begin[i] <= right_c_begin[i]);
}) })
@ -426,12 +426,12 @@ extremal_polygon_2(
// returns the past-the-end iterator of that sequence. // returns the past-the-end iterator of that sequence.
{ {
// check preconditions: // check preconditions:
CGAL_optimisation_precondition_code( CGAL_precondition_code(
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, static_cast<int>(iterator_distance( points_begin,
points_end)));) points_end)));)
CGAL_optimisation_precondition( number_of_points >= t.min_k()); CGAL_precondition( number_of_points >= t.min_k());
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
is_convex_2( points_begin, points_end, t)); is_convex_2( points_begin, points_end, t));
typedef typename Traits::Point_2 Point_2; typedef typename Traits::Point_2 Point_2;
@ -491,11 +491,11 @@ CGAL_maximum_inscribed_k_gon_2(
// returns the past-the-end iterator of that sequence. // returns the past-the-end iterator of that sequence.
{ {
// check preconditions: // check preconditions:
CGAL_optimisation_precondition( k >= t.min_k()); CGAL_precondition( k >= t.min_k());
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, static_cast<int>(iterator_distance( points_begin,
points_end))); points_end)));
CGAL_optimisation_precondition( number_of_points > 0); CGAL_precondition( number_of_points > 0);
using std::copy; using std::copy;
@ -518,7 +518,7 @@ CGAL_maximum_inscribed_k_gon_2(
P_0.rbegin() + 1, P_0.rbegin() + 1,
t); t);
P_0[k] = number_of_points - 1; P_0[k] = number_of_points - 1;
CGAL_optimisation_assertion( P_0[0] == 0); CGAL_assertion( P_0[0] == 0);
// compute k-gon rooted at points_begin[P_0[1]] // compute k-gon rooted at points_begin[P_0[1]]
Index_cont P_1( k); Index_cont P_1( k);
FT area_1; FT area_1;
@ -535,7 +535,7 @@ CGAL_maximum_inscribed_k_gon_2(
P_1.rbegin(), P_1.rbegin(),
t); t);
CGAL_optimisation_assertion( P_1[0] == P_0[1]); CGAL_assertion( P_1[0] == P_0[1]);
// start recursive computation: // start recursive computation:
@ -630,29 +630,29 @@ CGAL_maximum_inscribed_k_gon_2(
using std::copy; using std::copy;
// check preconditions: // check preconditions:
CGAL_optimisation_precondition( k >= t.min_k()); CGAL_precondition( k >= t.min_k());
CGAL_optimisation_precondition( left_index <= right_index); CGAL_precondition( left_index <= right_index);
CGAL_optimisation_precondition( left_index >= 0); CGAL_precondition( left_index >= 0);
CGAL_optimisation_precondition( right_index >= 0); CGAL_precondition( right_index >= 0);
CGAL_optimisation_precondition_code( CGAL_precondition_code(
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, static_cast<int>(iterator_distance( points_begin,
points_end)));) points_end)));)
CGAL_optimisation_precondition( left_index < number_of_points); CGAL_precondition( left_index < number_of_points);
CGAL_optimisation_precondition( right_index < number_of_points); CGAL_precondition( right_index < number_of_points);
CGAL_optimisation_precondition( CGAL_precondition(
iterator_distance( left_c_begin, left_c_end) == k - 1); iterator_distance( left_c_begin, left_c_end) == k - 1);
CGAL_optimisation_precondition( CGAL_precondition(
iterator_distance( right_c_begin, right_c_end) == k - 1); iterator_distance( right_c_begin, right_c_end) == k - 1);
CGAL_optimisation_expensive_precondition_code( CGAL_expensive_precondition_code(
for ( int i( 0); i < k - 1; ++i) { for ( int i( 0); i < k - 1; ++i) {
CGAL_optimisation_expensive_precondition( left_c_begin[i] >= 0); CGAL_expensive_precondition( left_c_begin[i] >= 0);
CGAL_optimisation_expensive_precondition( right_c_begin[i] >= 0); CGAL_expensive_precondition( right_c_begin[i] >= 0);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
left_c_begin[i] < number_of_points); left_c_begin[i] < number_of_points);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
right_c_begin[i] < number_of_points); right_c_begin[i] < number_of_points);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
left_c_begin[i] <= right_c_begin[i]); left_c_begin[i] <= right_c_begin[i]);
}) })
@ -671,7 +671,7 @@ CGAL_maximum_inscribed_k_gon_2(
area_middle, area_middle,
P_m.rbegin(), P_m.rbegin(),
t); t);
CGAL_optimisation_assertion( P_m[0] == middle_index); CGAL_assertion( P_m[0] == middle_index);
// left recursive branch: // left recursive branch:
FT area_left( 0); FT area_left( 0);
Index_cont P_l( k); Index_cont P_l( k);

View File

@ -17,7 +17,7 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <type_traits> #include <type_traits>
namespace CGAL { namespace CGAL {
@ -67,8 +67,8 @@ public:
Value Value
operator()(int r, int c) const operator()(int r, int c) const
{ {
CGAL_optimisation_precondition(r >= 0 && r < number_of_rows()); CGAL_precondition(r >= 0 && r < number_of_rows());
CGAL_optimisation_precondition(c >= 0 && c < number_of_columns()); CGAL_precondition(c >= 0 && c < number_of_columns());
return op(row_vec[r], column_vec[c]); return op(row_vec[r], column_vec[c]);
} }

View File

@ -18,7 +18,7 @@
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
namespace CGAL { namespace CGAL {
@ -56,8 +56,8 @@ public:
Value Value
operator()( int r, int c) const operator()( int r, int c) const
{ {
CGAL_optimisation_precondition( r >= 0 && r < number_of_rows()); CGAL_precondition( r >= 0 && r < number_of_rows());
CGAL_optimisation_precondition( c >= 0 && c < number_of_columns()); CGAL_precondition( c >= 0 && c < number_of_columns());
return (*matrix)( r << row_power, column_indices[c]); return (*matrix)( r << row_power, column_indices[c]);
} }
@ -70,18 +70,18 @@ public:
void void
replace_column( int o, int n) replace_column( int o, int n)
{ {
CGAL_optimisation_precondition( o >= 0 && o < number_of_columns()); CGAL_precondition( o >= 0 && o < number_of_columns());
CGAL_optimisation_precondition( n >= 0 && n < number_of_columns()); CGAL_precondition( n >= 0 && n < number_of_columns());
column_indices[o] = column_indices[n]; column_indices[o] = column_indices[n];
} }
void void
shrink_to_quadratic_size() shrink_to_quadratic_size()
{ {
CGAL_optimisation_precondition( number_of_columns() >= number_of_rows()); CGAL_precondition( number_of_columns() >= number_of_rows());
column_indices.erase( column_indices.begin() + number_of_rows(), column_indices.erase( column_indices.begin() + number_of_rows(),
column_indices.end()); column_indices.end());
CGAL_optimisation_postcondition( number_of_columns() == number_of_rows()); CGAL_postcondition( number_of_columns() == number_of_rows());
} }
private: private:

View File

@ -16,7 +16,6 @@
#include <CGAL/license/Matrix_search.h> #include <CGAL/license/Matrix_search.h>
#include <CGAL/Optimisation/assertions.h>
#include <CGAL/circulator_bases.h> #include <CGAL/circulator_bases.h>
#include <iterator> #include <iterator>

View File

@ -16,7 +16,7 @@
#include <CGAL/license/Matrix_search.h> #include <CGAL/license/Matrix_search.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <vector> #include <vector>
#include <functional> #include <functional>
@ -57,9 +57,9 @@ monotone_matrix_search(
// ------ // ------
// get even rows of M: // get even rows of M:
Matrix* M_new = M.extract_all_even_rows(); Matrix* M_new = M.extract_all_even_rows();
CGAL_optimisation_assertion( CGAL_assertion(
M_new->number_of_columns() == M.number_of_columns()); M_new->number_of_columns() == M.number_of_columns());
CGAL_optimisation_assertion( CGAL_assertion(
M_new->number_of_rows() == 0 || M_new->number_of_rows() == 0 ||
M_new->number_of_rows() == ( M.number_of_rows() + 1) >> 1); M_new->number_of_rows() == ( M.number_of_rows() + 1) >> 1);
@ -75,7 +75,7 @@ monotone_matrix_search(
reduction_table[M_new->number_of_rows()] = reduction_table[M_new->number_of_rows()] =
M.number_of_columns() - 1; M.number_of_columns() - 1;
_reduce_matrix( *M_new, reduction_table, compare_strictly); _reduce_matrix( *M_new, reduction_table, compare_strictly);
CGAL_optimisation_assertion( CGAL_assertion(
M_new->number_of_columns() == M_new->number_of_rows()); M_new->number_of_columns() == M_new->number_of_rows());
} // if ( M_new->number_of_rows() < M_new->number_of_columns()) } // if ( M_new->number_of_rows() < M_new->number_of_columns())
@ -92,7 +92,7 @@ monotone_matrix_search(
// recursion: // recursion:
CGAL_optimisation_assertion( CGAL_assertion(
M_new->number_of_rows() >= M_new->number_of_columns()); M_new->number_of_rows() >= M_new->number_of_columns());
// table to store the rmax values of M_new: // table to store the rmax values of M_new:
@ -160,7 +160,7 @@ _reduce_matrix(
// and returns for each column of the resulting // and returns for each column of the resulting
// matrix its column index in the original matrix // matrix its column index in the original matrix
{ {
CGAL_optimisation_precondition( CGAL_precondition(
M.number_of_columns() >= M.number_of_rows()); M.number_of_columns() >= M.number_of_rows());
// active columns are 0, ..., j1, j2, ..., M.x_dim()-1 // active columns are 0, ..., j1, j2, ..., M.x_dim()-1
int j1( 0), j2( 1); int j1( 0), j2( 1);
@ -191,7 +191,7 @@ _reduce_matrix(
// have been deleted, now move columns // have been deleted, now move columns
// j2 .. M.number_of_columns()-1 to the first part // j2 .. M.number_of_columns()-1 to the first part
while ( j1 < M.number_of_rows() - 1) { while ( j1 < M.number_of_rows() - 1) {
CGAL_optimisation_assertion( j2 < M.number_of_columns()); CGAL_assertion( j2 < M.number_of_columns());
M.replace_column( ++j1, j2); M.replace_column( ++j1, j2);
*(t+j1) = j2++; *(t+j1) = j2++;
} }

View File

@ -17,7 +17,7 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
#include <CGAL/Sorted_matrix_search_traits_adaptor.h> #include <CGAL/Sorted_matrix_search_traits_adaptor.h>
@ -159,13 +159,13 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
Cell_container active_cells; Cell_container active_cells;
// set of input matrices must not be empty: // set of input matrices must not be empty:
CGAL_optimisation_precondition( f != l); CGAL_precondition( f != l);
// for each input matrix insert a cell into active_cells: // for each input matrix insert a cell into active_cells:
InputIterator i( f); InputIterator i( f);
int maxdim( -1); int maxdim( -1);
while ( i != l) { while ( i != l) {
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
PaddedMatrix( *i).is_sorted()); PaddedMatrix( *i).is_sorted());
active_cells.push_back( Cell( PaddedMatrix( *i))); active_cells.push_back( Cell( PaddedMatrix( *i)));
maxdim = max BOOST_PREVENT_MACRO_SUBSTITUTION ( max BOOST_PREVENT_MACRO_SUBSTITUTION ( (*i).number_of_columns(), maxdim = max BOOST_PREVENT_MACRO_SUBSTITUTION ( max BOOST_PREVENT_MACRO_SUBSTITUTION ( (*i).number_of_columns(),
@ -173,7 +173,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
maxdim); maxdim);
++i; ++i;
} }
CGAL_optimisation_precondition( maxdim > 0); CGAL_precondition( maxdim > 0);
// current cell dimension: // current cell dimension:
@ -239,7 +239,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
break; break;
// there has to be at least one cell left: // there has to be at least one cell left:
CGAL_optimisation_assertion( active_cells.size() > 0); CGAL_assertion( active_cells.size() > 0);
// ------------------------------------------------------ // ------------------------------------------------------
// compute medians of smallest and largest elements: // compute medians of smallest and largest elements:
@ -285,7 +285,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
{ {
return equal_to< Value >()(lower_median, Cell_min< Cell >()(c)); return equal_to< Value >()(lower_median, Cell_min< Cell >()(c));
}); });
CGAL_optimisation_assertion(lower_median_cell != active_cells.end()); CGAL_assertion(lower_median_cell != active_cells.end());
// ------------------------------------------------------ // ------------------------------------------------------
// test feasibility of medians and remove cells accordingly: // test feasibility of medians and remove cells accordingly:
Cell_iterator new_end; Cell_iterator new_end;
@ -385,8 +385,8 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
} // for (;;) } // for (;;)
// there must be only one cell left: // there must be only one cell left:
CGAL_optimisation_assertion( active_cells.size() == 1); CGAL_assertion( active_cells.size() == 1);
CGAL_optimisation_assertion( ccd == 1); CGAL_assertion( ccd == 1);
return ((*active_cells.begin()).min)(); return ((*active_cells.begin()).min)();
} }

View File

@ -1,323 +0,0 @@
// Copyright (c) 1997-2001
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Geert-Jan Giezeman, Sven Schoenherr <sven@inf.ethz.ch>
#ifndef CGAL_OPTIMISATION_ASSERTIONS_H
#define CGAL_OPTIMISATION_ASSERTIONS_H
#include <CGAL/Uncertain.h>
// macro definitions
// =================
// assertions
// ----------
#if ( defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \
|| defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG))
# define CGAL_optimisation_assertion(EX) ((void)0)
# define CGAL_optimisation_assertion_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_assertion_code(CODE)
# undef CGAL_OPTIMISATION_ASSERTION_TAG
#else
# define CGAL_optimisation_assertion(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_assertion_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_assertion_code(CODE) CODE
# define CGAL_OPTIMISATION_ASSERTION_TAG 1
#endif // optimisation assertions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXACTNESS) ) \
|| defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \
|| defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG))
# define CGAL_optimisation_exactness_assertion(EX) ((void)0)
# define CGAL_optimisation_exactness_assertion_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_exactness_assertion_code(CODE)
# undef CGAL_OPTIMISATION_EXACTNESS_ASSERTION_TAG
#else
# define CGAL_optimisation_exactness_assertion(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_exactness_assertion_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_exactness_assertion_code(CODE) CODE
# define CGAL_OPTIMISATION_EXACTNESS_ASSERTION_TAG 1
#endif // optimisation exactness assertions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \
|| defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_assertion(EX) ((void)0)
# define CGAL_optimisation_expensive_assertion_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_expensive_assertion_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_ASSERTION_TAG
#else
# define CGAL_optimisation_expensive_assertion(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_assertion_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_assertion_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_ASSERTION_TAG 1
#endif // optimisation expensive assertions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_ASSERTIONS) \
|| defined( CGAL_NO_ASSERTIONS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_exactness_assertion(EX) \
((void)0)
# define CGAL_optimisation_expensive_exactness_assertion_msg(EX,MSG) \
((void)0)
# define CGAL_optimisation_expensive_exactness_assertion_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_ASSERTION_TAG
#else
# define CGAL_optimisation_expensive_exactness_assertion(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_exactness_assertion_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::assertion_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_exactness_assertion_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_ASSERTION_TAG 1
#endif // optimisation expensive exactness assertions
// preconditions
// -------------
#if ( defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \
|| defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_precondition(EX) ((void)0)
# define CGAL_optimisation_precondition_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_precondition_code(CODE)
# undef CGAL_OPTIMISATION_PRECONDITION_TAG
#else
# define CGAL_optimisation_precondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_precondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_precondition_code(CODE) CODE
# define CGAL_OPTIMISATION_PRECONDITION_TAG 1
#endif // optimisation preconditions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXACTNESS) ) \
|| defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \
|| defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_exactness_precondition(EX) ((void)0)
# define CGAL_optimisation_exactness_precondition_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_exactness_precondition_code(CODE)
# undef CGAL_OPTIMISATION_EXACTNESS_PRECONDITION_TAG
#else
# define CGAL_optimisation_exactness_precondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_exactness_precondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_exactness_precondition_code(CODE) CODE
# define CGAL_OPTIMISATION_EXACTNESS_PRECONDITION_TAG 1
#endif // optimisation exactness preconditions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \
|| defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_precondition(EX) ((void)0)
# define CGAL_optimisation_expensive_precondition_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_expensive_precondition_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG
#else
# define CGAL_optimisation_expensive_precondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_precondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_precondition_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG 1
#endif // optimisation expensive preconditions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_PRECONDITIONS) \
|| defined( CGAL_NO_PRECONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_exactness_precondition(EX) \
((void)0)
# define CGAL_optimisation_expensive_exactness_precondition_msg(EX,MSG) \
((void)0)
# define CGAL_optimisation_expensive_exactness_precondition_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_PRECONDITION_TAG
#else
# define CGAL_optimisation_expensive_exactness_precondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_exactness_precondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::precondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_exactness_precondition_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_PRECONDITION_TAG 1
#endif // optimisation expensive exactness preconditions
// postconditions
// --------------
#if ( defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \
|| defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_postcondition(EX) ((void)0)
# define CGAL_optimisation_postcondition_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_postcondition_code(CODE)
# undef CGAL_OPTIMISATION_POSTCONDITION_TAG
#else
# define CGAL_optimisation_postcondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_postcondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_postcondition_code(CODE) CODE
# define CGAL_OPTIMISATION_POSTCONDITION_TAG 1
#endif // optimisation postconditions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXACTNESS) ) \
|| defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \
|| defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_exactness_postcondition(EX) ((void)0)
# define CGAL_optimisation_exactness_postcondition_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_exactness_postcondition_code(CODE)
# undef CGAL_OPTIMISATION_EXACTNESS_POSTCONDITION_TAG
#else
# define CGAL_optimisation_exactness_postcondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_exactness_postcondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_exactness_postcondition_code(CODE) CODE
# define CGAL_OPTIMISATION_EXACTNESS_POSTCONDITION_TAG 1
#endif // optimisation exactness postconditions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \
|| defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_postcondition(EX) ((void)0)
# define CGAL_optimisation_expensive_postcondition_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_expensive_postcondition_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_POSTCONDITION_TAG
#else
# define CGAL_optimisation_expensive_postcondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_postcondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_postcondition_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_POSTCONDITION_TAG 1
#endif // optimisation expensive postconditions
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_POSTCONDITIONS) \
|| defined( CGAL_NO_POSTCONDITIONS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_exactness_postcondition(EX) \
((void)0)
# define CGAL_optimisation_expensive_exactness_postcondition_msg(EX,MSG) \
((void)0)
# define CGAL_optimisation_expensive_exactness_postcondition_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_POSTCONDITION_TAG
#else
# define CGAL_optimisation_expensive_exactness_postcondition(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_exactness_postcondition_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::postcondition_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_exactness_postcondition_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_POSTCONDITION_TAG 1
#endif // optimisation expensive exactness postconditions
// warnings
// --------
#if ( defined( CGAL_OPTIMISATION_NO_WARNINGS) \
|| defined( CGAL_NO_WARNINGS) || defined( NDEBUG))
# define CGAL_optimisation_warning(EX) ((void)0)
# define CGAL_optimisation_warning_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_warning_code(CODE)
# undef CGAL_OPTIMISATION_WARNING_TAG
#else
# define CGAL_optimisation_warning(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_warning_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_warning_code(CODE) CODE
# define CGAL_OPTIMISATION_WARNING_TAG 1
#endif // optimisation warnings
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXACTNESS) ) \
|| defined( CGAL_OPTIMISATION_NO_WARNINGS) \
|| defined( CGAL_NO_WARNINGS) || defined( NDEBUG))
# define CGAL_optimisation_exactness_warning(EX) ((void)0)
# define CGAL_optimisation_exactness_warning_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_exactness_warning_code(CODE)
# undef CGAL_OPTIMISATION_EXACTNESS_WARNING_TAG
#else
# define CGAL_optimisation_exactness_warning(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_exactness_warning_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_exactness_warning_code(CODE) CODE
# define CGAL_OPTIMISATION_EXACTNESS_WARNING_TAG 1
#endif // optimisation exactness warnings
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_WARNINGS) \
|| defined( CGAL_NO_WARNINGS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_warning(EX) ((void)0)
# define CGAL_optimisation_expensive_warning_msg(EX,MSG) ((void)0)
# define CGAL_optimisation_expensive_warning_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_WARNING_TAG
#else
# define CGAL_optimisation_expensive_warning(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_warning_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_warning_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_WARNING_TAG 1
#endif // optimisation expensive warnings
#if ( ! ( defined( CGAL_OPTIMISATION_CHECK_EXACTNESS) \
|| defined( CGAL_OPTIMISATION_CHECK_EXPENSIVE) \
|| defined( CGAL_CHECK_EXACTNESS) \
|| defined( CGAL_CHECK_EXPENSIVE) ) \
|| defined( CGAL_OPTIMISATION_NO_WARNINGS) \
|| defined( CGAL_NO_WARNINGS) || defined( NDEBUG))
# define CGAL_optimisation_expensive_exactness_warning(EX) \
((void)0)
# define CGAL_optimisation_expensive_exactness_warning_msg(EX,MSG) \
((void)0)
# define CGAL_optimisation_expensive_exactness_warning_code(CODE)
# undef CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_WARNING_TAG
#else
# define CGAL_optimisation_expensive_exactness_warning(EX) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__))
# define CGAL_optimisation_expensive_exactness_warning_msg(EX,MSG) \
(CGAL::possibly(EX)?((void)0): ::CGAL::warning_fail( # EX ,__FILE__,__LINE__,MSG))
# define CGAL_optimisation_expensive_exactness_warning_code(CODE) CODE
# define CGAL_OPTIMISATION_EXPENSIVE_EXACTNESS_WARNING_TAG 1
#endif // optimisation expensive exactness warnings
#endif // CGAL_OPTIMISATION_ASSERTIONS_H
// ===== EOF ==================================================================

View File

@ -19,7 +19,6 @@
// includes // includes
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h>
#include <CGAL/Optimisation/debug.h> #include <CGAL/Optimisation/debug.h>
#include <CGAL/IO/Verbose_ostream.h> #include <CGAL/IO/Verbose_ostream.h>

View File

@ -473,7 +473,7 @@ public:
// NOTE: an implicit conversion from ET to RT must be available! // NOTE: an implicit conversion from ET to RT must be available!
Point Point
realizing_point_p( ) const realizing_point_p( ) const
{ CGAL_optimisation_precondition( is_finite()); { CGAL_precondition( is_finite());
return tco.construct_point_d_object() return tco.construct_point_d_object()
( ambient_dimension(), ( ambient_dimension(),
realizing_point_p_coordinates_begin(), realizing_point_p_coordinates_begin(),
@ -481,7 +481,7 @@ public:
Point Point
realizing_point_q( ) const realizing_point_q( ) const
{ CGAL_optimisation_precondition( is_finite()); { CGAL_precondition( is_finite());
return tco.construct_point_d_object() return tco.construct_point_d_object()
( ambient_dimension(), ( ambient_dimension(),
realizing_point_q_coordinates_begin(), realizing_point_q_coordinates_begin(),
@ -512,7 +512,7 @@ public:
std::copy( p_first, p_last, std::back_inserter( p_points)); std::copy( p_first, p_last, std::back_inserter( p_points));
std::copy( q_first, q_last, std::back_inserter( q_points)); std::copy( q_first, q_last, std::back_inserter( q_points));
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg CGAL_precondition_msg
(check_dimension( p_points.begin(), p_points.end()) (check_dimension( p_points.begin(), p_points.end())
&& check_dimension( q_points.begin(), q_points.end()), && check_dimension( q_points.begin(), q_points.end()),
"Not all points have the same dimension."); "Not all points have the same dimension.");
@ -527,7 +527,7 @@ public:
p_points.clear(); p_points.clear();
std::copy( p_first, p_last, std::back_inserter( p_points)); std::copy( p_first, p_last, std::back_inserter( p_points));
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg CGAL_precondition_msg
(check_dimension( p_points.begin(), p_points.end()), (check_dimension( p_points.begin(), p_points.end()),
"Not all points have the same dimension."); "Not all points have the same dimension.");
@ -541,7 +541,7 @@ public:
q_points.clear(); q_points.clear();
std::copy( q_first, q_last, std::back_inserter( q_points)); std::copy( q_first, q_last, std::back_inserter( q_points));
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg CGAL_precondition_msg
(check_dimension( q_points.begin(), q_points.end()), (check_dimension( q_points.begin(), q_points.end()),
"Not all points have the same dimension."); "Not all points have the same dimension.");
@ -551,7 +551,7 @@ public:
void void
insert_p( const Point& p) insert_p( const Point& p)
{ {
CGAL_optimisation_precondition CGAL_precondition
( ( ! is_finite()) || ( ( ! is_finite()) ||
( tco.access_dimension_d_object()( p) == d)); ( tco.access_dimension_d_object()( p) == d));
p_points.push_back( p); p_points.push_back( p);
@ -562,7 +562,7 @@ public:
void void
insert_q( const Point& q) insert_q( const Point& q)
{ {
CGAL_optimisation_precondition CGAL_precondition
( ( ! is_finite()) || ( ( ! is_finite()) ||
( tco.access_dimension_d_object()( q) == d)); ( tco.access_dimension_d_object()( q) == d));
q_points.push_back( q); q_points.push_back( q);
@ -575,12 +575,12 @@ public:
insert( InputIterator1 p_first, InputIterator1 p_last, insert( InputIterator1 p_first, InputIterator1 p_last,
InputIterator2 q_first, InputIterator2 q_last) InputIterator2 q_first, InputIterator2 q_last)
{ {
CGAL_optimisation_precondition_code(int old_r = static_cast<int>(p_points.size())); CGAL_precondition_code(int old_r = static_cast<int>(p_points.size()));
CGAL_optimisation_precondition_code(int old_s = static_cast<int>(q_points.size())); CGAL_precondition_code(int old_s = static_cast<int>(q_points.size()));
p_points.insert( p_points.end(), p_first, p_last); p_points.insert( p_points.end(), p_first, p_last);
q_points.insert( q_points.end(), q_first, q_last); q_points.insert( q_points.end(), q_first, q_last);
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg CGAL_precondition_msg
(check_dimension( p_points.begin()+old_r, p_points.end()) (check_dimension( p_points.begin()+old_r, p_points.end())
&& check_dimension( q_points.begin()+old_s, q_points.end()), && check_dimension( q_points.begin()+old_s, q_points.end()),
"Not all points have the same dimension."); "Not all points have the same dimension.");
@ -591,10 +591,10 @@ public:
void void
insert_p( InputIterator p_first, InputIterator p_last) insert_p( InputIterator p_first, InputIterator p_last)
{ {
CGAL_optimisation_precondition_code(int old_r = static_cast<int>(p_points.size())); CGAL_precondition_code(int old_r = static_cast<int>(p_points.size()));
p_points.insert( p_points.end(), p_first, p_last); p_points.insert( p_points.end(), p_first, p_last);
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg CGAL_precondition_msg
(check_dimension( p_points.begin()+old_r, p_points.end()), (check_dimension( p_points.begin()+old_r, p_points.end()),
"Not all points have the same dimension."); "Not all points have the same dimension.");
compute_distance(); compute_distance();
@ -604,10 +604,10 @@ public:
void void
insert_q( InputIterator q_first, InputIterator q_last) insert_q( InputIterator q_first, InputIterator q_last)
{ {
CGAL_optimisation_precondition_code( int old_s = static_cast<int>(q_points.size())); CGAL_precondition_code( int old_s = static_cast<int>(q_points.size()));
q_points.insert( q_points.end(), q_first, q_last); q_points.insert( q_points.end(), q_first, q_last);
set_dimension(); set_dimension();
CGAL_optimisation_precondition_msg CGAL_precondition_msg
(check_dimension( q_points.begin()+old_s, q_points.end()), (check_dimension( q_points.begin()+old_s, q_points.end()),
"Not all points have the same dimension."); "Not all points have the same dimension.");
compute_distance(); compute_distance();
@ -681,7 +681,7 @@ private:
// construct program // construct program
int n = 2 * d + static_cast<int>(p_points.size() + q_points.size()); int n = 2 * d + static_cast<int>(p_points.size() + q_points.size());
int m = d + 2; int m = d + 2;
CGAL_optimisation_precondition (p_points.size() > 0); CGAL_precondition (p_points.size() > 0);
QP qp (n, m, QP qp (n, m,
A_iterator A_iterator
(boost::counting_iterator<int>(0), (boost::counting_iterator<int>(0),
@ -696,7 +696,7 @@ private:
Quadratic_program_options options; Quadratic_program_options options;
options.set_pricing_strategy(pricing_strategy(NT())); options.set_pricing_strategy(pricing_strategy(NT()));
solver = new Solver(qp, options); solver = new Solver(qp, options);
CGAL_optimisation_assertion(solver->status() == QP_OPTIMAL); CGAL_assertion(solver->status() == QP_OPTIMAL);
// compute support and realizing points // compute support and realizing points
ET et_0 = 0; ET et_0 = 0;
int r = static_cast<int>(p_points.size()); int r = static_cast<int>(p_points.size());
@ -773,8 +773,8 @@ is_valid( bool verbose, int level) const
// compute normal vector // compute normal vector
ET_vector normal( d), diff( d); ET_vector normal( d), diff( d);
ET et_0 = 0, den = p_coords[d]; ET et_0 = 0, den = p_coords[d];
CGAL_optimisation_assertion (den > et_0); CGAL_assertion (den > et_0);
CGAL_optimisation_assertion (den == q_coords[d]); CGAL_assertion (den == q_coords[d]);
int i, j; int i, j;
for ( j = 0; j < d; ++j) normal[ j] = p_coords[ j] - q_coords[ j]; for ( j = 0; j < d; ++j) normal[ j] = p_coords[ j] - q_coords[ j];
@ -917,7 +917,7 @@ operator << ( std::ostream& os,
break; break;
default: default:
CGAL_optimisation_assertion_msg( false, CGAL_assertion_msg( false,
"CGAL::IO::get_mode( os) invalid!"); "CGAL::IO::get_mode( os) invalid!");
break; } break; }

View File

@ -16,7 +16,7 @@
#include <CGAL/license/Polytope_distance_d.h> #include <CGAL/license/Polytope_distance_d.h>
#include <CGAL/Optimisation/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/Cartesian_matrix.h> #include <CGAL/Cartesian_matrix.h>
#include <CGAL/Dynamic_matrix.h> #include <CGAL/Dynamic_matrix.h>
#include <CGAL/monotone_matrix_search.h> #include <CGAL/monotone_matrix_search.h>
@ -53,8 +53,8 @@ public:
Value Value
operator()( int r, int c) const operator()( int r, int c) const
{ {
CGAL_optimisation_precondition(r >= 0 && r < number_of_rows()); CGAL_precondition(r >= 0 && r < number_of_rows());
CGAL_optimisation_precondition(c >= 0 && c < number_of_columns()); CGAL_precondition(c >= 0 && c < number_of_columns());
if (c <= r) if (c <= r)
return Value(c - r); return Value(c - r);
else if (c >= r + number_of_rows()) else if (c >= r + number_of_rows())
@ -93,8 +93,8 @@ all_furthest_neighbors_2( RandomAccessIC points_begin,
// check preconditions: // check preconditions:
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, points_end))); static_cast<int>(iterator_distance( points_begin, points_end)));
CGAL_optimisation_precondition( number_of_points > 0); CGAL_precondition( number_of_points > 0);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
is_convex_2( points_begin, points_end, t)); is_convex_2( points_begin, points_end, t));
// prepare random access container: // prepare random access container:
@ -125,7 +125,7 @@ all_furthest_neighbors_2( RandomAccessIC points_begin,
RandomAccessIC points_end, RandomAccessIC points_end,
OutputIterator o, OutputIterator o,
const Traits& const Traits&
CGAL_optimisation_expensive_precondition_code(t), CGAL_expensive_precondition_code(t),
std::random_access_iterator_tag) std::random_access_iterator_tag)
{ {
typedef All_furthest_neighbor_matrix< typedef All_furthest_neighbor_matrix<
@ -135,8 +135,8 @@ all_furthest_neighbors_2( RandomAccessIC points_begin,
// check preconditions: // check preconditions:
int number_of_points( int number_of_points(
static_cast<int>(iterator_distance( points_begin, points_end))); static_cast<int>(iterator_distance( points_begin, points_end)));
CGAL_optimisation_precondition( number_of_points > 0); CGAL_precondition( number_of_points > 0);
CGAL_optimisation_expensive_precondition( CGAL_expensive_precondition(
is_convex_2( points_begin, points_end, t)); is_convex_2( points_begin, points_end, t));
// compute maxima: // compute maxima: