Replace CGAL::Interval_nt<>::number_of_failures() by a CGAL_PROFILER() counter.

This commit is contained in:
Sylvain Pion 2008-08-06 13:16:04 +00:00
parent 33b8f3a06a
commit aff1bf74aa
9 changed files with 19 additions and 33 deletions

View File

@ -292,8 +292,5 @@ int main(int argc, char **argv)
for(int i=0; i<loops; ++i)
test_side_of_oriented_sphere_3();
std::cerr << "Total number of IA failures = "
<< CGAL::Interval_nt<false>::number_of_failures() << std::endl;
return 0;
}

View File

@ -84,11 +84,19 @@ The following functionality has been added or changed:
by the get<i>() member function; and replace the make_triple and make_quadruple
maker functions by make_tuple.
This way, in a further release, we will be able to switch to boost::tuple more easily.
- The class CGAL::Uncertain<> has been documented. It is typically used to report
uncertain results for predicates using interval arithmetic, and other filtering
techniques.
5- Triangulation_3:
- Removed the deprecated functions Cell:mirror_index() and Cell::mirror_vertex().
6- Number types:
- the counter Interval_nt::number_of_failures() has been removed, replaced by
a profiling counter enabled with CGAL_PROFILE.
----------------------------- Release 3.3.1 ----------------------------------
The following corrections have been made:

View File

@ -1226,8 +1226,7 @@ bool strictly_ordered_ccw(const Direction_2& d1,
void print_statistics() const
{
std::cout << "Statistics of filtered kernel:\n";
std::cout << "total failed double filter stages = ";
std::cout << CGAL::Interval_nt_advanced::number_of_failures() << std::endl;
std::cout << "total failed double filter stages = (now needs CGAL_PROFILE)\n";
PRINT_CHECK_ENABLED;
PRINT_STATISTICS(or2);
PRINT_STATISTICS(or1);

View File

@ -1503,8 +1503,7 @@ bool strictly_ordered_ccw(const Direction_2& d1,
void print_statistics() const
{
std::cout << "Statistics of filtered kernel:\n";
std::cout << "total failed double filter stages = ";
std::cout << CGAL::Interval_nt_advanced::number_of_failures << std::endl;
std::cout << "total failed double filter stages = (now needs CGAL_PROFILE)\n";
PRINT_CHECK_ENABLED;
PRINT_STATISTICS(or2);
PRINT_STATISTICS(or1);

View File

@ -136,7 +136,7 @@ or \ccc{Uncertain<Sign>}, which
can be probed for uncertainty explicitely, and which has a conversion to
the normal type (e.g. \ccc{bool}) which throws an exception when the
conversion is not certain. Note that each failed conversion increments
the counter \ccc{number_of_failures()}, and then throw the exception of
a profiling counter (see \ccc{CGAL_PROFILE}), and then throws the exception of
type \ccc{unsafe_comparison}.
%SetThreeColumns{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{}{\hspace*{8cm}}
@ -157,10 +157,6 @@ type \ccc{unsafe_comparison}.
\ccGlue
\ccFunction{Uncertain<Sign> sign(Interval_nt i);}{}
\ccFunction{static unsigned number_of_failures();}
{Returns a global counter incremented at each conversion which thrown an
exception.}
\ccTypedef{typedef Interval_nt<false> Interval_nt_advanced;}
{This typedef (at namespace CGAL scope) exists for backward compatibility,
as well as removing the need to remember the Boolean value for the template

View File

@ -90,9 +90,6 @@ public:
Interval_nt(const Pair & p)
: _inf(p.first), _sup(p.second) {}
static unsigned number_of_failures()
{ return Uncertain<bool>::number_of_failures(); }
IA operator-() const { return IA (-sup(), -inf()); }
IA & operator+= (const IA &d) { return *this = *this + d; }

View File

@ -136,7 +136,9 @@ Another option is :
\ccMethod{T make_certain() const;}
{if \ccVar.\ccc{is_certain()}, then returns the certain value which is represented.
Otherwise, throws an exception of type \ccc{Uncertain_conversion_exception}.}
Otherwise, throws an exception of type \ccc{Uncertain_conversion_exception}.
A profile counter of the number of such exceptions thrown during the execution of
the program is available with \ccc{CGAL_PROFILE}.}
\ccMethod{operator T() const;}
{conversion operator to \ccc{T}. It does and returns the same thing as

View File

@ -23,7 +23,9 @@
#include <CGAL/config.h>
#include <CGAL/assertions.h>
#include <CGAL/enum.h>
#include <CGAL/Profile_counter.h>
#include <stdexcept>
#include <typeinfo>
CGAL_BEGIN_NAMESPACE
@ -85,8 +87,6 @@ class Uncertain
{
T _i, _s;
static unsigned failures; // Number of conversion failures.
public:
typedef T value_type;
@ -117,9 +117,10 @@ public:
{
if (is_certain())
return _i;
++Uncertain<bool>::number_of_failures();
CGAL_PROFILER(std::string("Uncertain_conversion_exception thrown for CGAL::Uncertain< ")
+ typeid(T).name() + " >");
throw Uncertain_conversion_exception(
"undecidable conversion of CGAL::Uncertain<T>");
"Undecidable conversion of CGAL::Uncertain<T>");
}
#if 1 // Comment out in order to spot some unwanted conversions.
@ -144,17 +145,10 @@ public:
}
#endif
static unsigned & number_of_failures() { return failures; }
static Uncertain indeterminate();
};
template < typename T >
unsigned
Uncertain<T>::failures = 0;
// Access functions
// ----------------

View File

@ -1278,12 +1278,6 @@ int main( int argc, char const* argv[] )
cout << "Failed cases: " << lFailed_cases << endl ;
cout << endl ;
if ( Uncertain<bool>::number_of_failures() > 0 )
{
cout << "!! " << Uncertain<bool>::number_of_failures() << " uncertain conversion failures. " << endl ;
cout << endl ;
}
int lTotalPred = sTotalPredFailures + sTotalPredSuccess ;
int lTotalCons = sTotalConsFailures + sTotalConsSuccess ;