mirror of https://github.com/CGAL/cgal
tweaked error reporting
This commit is contained in:
parent
2fe5f7fe26
commit
e48c4a7906
|
|
@ -24,6 +24,7 @@
|
|||
#include <CGAL/Tools/Label.h>
|
||||
#include <CGAL/Kinetic/Ref_counted.h>
|
||||
#include <CGAL/Tools/Counter.h>
|
||||
#include <CGAL/Kinetic/internal/debug_counters.h>
|
||||
#include <iostream>
|
||||
#include <CGAL/Kinetic/Multi_listener.h>
|
||||
#include <set>
|
||||
|
|
@ -305,7 +306,7 @@ public:
|
|||
iss >> d;
|
||||
if (!iss) {
|
||||
CGAL_KINETIC_ERROR("ERROR reading object from line " << buf);
|
||||
internal::fail__=true;
|
||||
++internal::io_errors__;
|
||||
} else {
|
||||
//CGAL_KINETIC_LOG(LOG_LOTS, "Read " << d << std::endl);
|
||||
insert(d);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef CGAL_KINETIC_ROOT_DEGEN_FK_H
|
||||
#define CGAL_KINETIC_ROOT_DEGEN_FK_H
|
||||
#include <CGAL/Kinetic/basic.h>
|
||||
#include <CGAL/Kinetic/internal/debug_counters.h>
|
||||
|
||||
CGAL_KINETIC_BEGIN_NAMESPACE;
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ class HDRS{
|
|||
CGAL_KINETIC_LOG(LOG_LOTS, "Function= " << uf << std::endl);
|
||||
CGAL_expensive_precondition(solver_.empty() || solver_.top() >= lb);
|
||||
|
||||
#if 0
|
||||
#ifndef NDEBUG
|
||||
if (!SLOPPY && k.sign_at_object()(uf, lb) == CGAL::NEGATIVE) {
|
||||
CGAL_KINETIC_ERROR( "Invalid certificate constructed for function " << uf << " between " << lb
|
||||
<< " and " << ub << " will fail immediately." << std::endl);
|
||||
|
|
@ -57,6 +58,7 @@ class HDRS{
|
|||
CGAL_KINETIC_LOG(LOG_LOTS, "Degeneracy at " << solver_.top() << std::endl);
|
||||
CGAL::Sign sn = k.sign_after_object()(uf, lb);
|
||||
if (sn == CGAL::NEGATIVE) {
|
||||
++internal::function_degeneracies__;
|
||||
CGAL_KINETIC_LOG(LOG_LOTS, "Extra root at lower bound of " << lb << std::endl);
|
||||
} else {
|
||||
CGAL_KINETIC_LOG(LOG_LOTS, "Popping extra root at lower bound of " << lb << std::endl);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <CGAL/Kinetic/basic.h>
|
||||
#include <CGAL/Kinetic/Active_objects_listener_helper.h>
|
||||
#include <CGAL/Kinetic/Ref_counted.h>
|
||||
#include <CGAL/Kinetic/internal/debug_counters.h>
|
||||
#include <CGAL/Kinetic/Simulator_kds_listener.h>
|
||||
#include <CGAL/Kinetic/Sort_visitor_base.h>
|
||||
#include <CGAL/Kinetic/Event_base.h>
|
||||
|
|
@ -272,7 +273,7 @@ public:
|
|||
std::cerr << "ERROR: order is ";
|
||||
write(std::cerr);
|
||||
std::cerr << std::endl;
|
||||
CGAL::Kinetic::internal::fail__=true;
|
||||
++internal::audit_failures__;
|
||||
|
||||
if (!wrote_objects_) {
|
||||
wrote_objects_=true;
|
||||
|
|
@ -408,7 +409,11 @@ public:
|
|||
if (s_.will_fail()) out << " next is " << s_.failure_time();
|
||||
else out << " out of failures";
|
||||
}
|
||||
void audit(typename Sort::Event_key tk) const {
|
||||
void audit(typename Sort::Event_key
|
||||
#ifndef NDEBUG
|
||||
tk
|
||||
#endif
|
||||
) const {
|
||||
//std::cout << "Auditing event ";
|
||||
//write(std::cout);
|
||||
//std::cout << std::endl;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#define CGAL_KINETIC_BIN_QUEUE_H
|
||||
#include <CGAL/Kinetic/basic.h>
|
||||
#include <iostream>
|
||||
#include <CGAL/Kinetic/internal/debug_counters.h>
|
||||
#include <CGAL/In_place_list.h>
|
||||
#include <functional>
|
||||
#include <CGAL/assertions.h>
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
#include <algorithm>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <CGAL/Kinetic/internal/debug_counters.h>
|
||||
|
||||
//int two_list_remaining=0;
|
||||
|
||||
|
|
@ -668,7 +670,7 @@ protected:
|
|||
#ifndef NDEBUG
|
||||
if (CGAL::compare(tc, tp) == CGAL::SMALLER) {
|
||||
std::cout << "ERROR: Out of order " << tc << std::endl << tp << std::endl << std::endl;
|
||||
CGAL::Kinetic::internal::fail__= true;
|
||||
++internal::audit_failures__;
|
||||
}
|
||||
#endif
|
||||
//CGAL_assertion(tc >= tp);
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
CGAL_KINETIC_BEGIN_INTERNAL_NAMESPACE
|
||||
|
||||
extern bool fail__;
|
||||
|
||||
class Logs
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
#include <CGAL/Kinetic/basic.h>
|
||||
|
||||
CGAL_KINETIC_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
extern unsigned int function_degeneracies__;
|
||||
extern unsigned int io_errors__;
|
||||
extern unsigned int audit_failures__;
|
||||
|
||||
void write_debug_counters(std::ostream &out);
|
||||
}
|
||||
CGAL_KINETIC_END_NAMESPACE
|
||||
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
CGAL_KINETIC_BEGIN_INTERNAL_NAMESPACE
|
||||
|
||||
bool fail__=false;
|
||||
|
||||
Logs kds_logs;
|
||||
|
||||
CGAL_KINETIC_END_INTERNAL_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
#include <CGAL/Kinetic/internal/debug_counters.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
CGAL_KINETIC_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
unsigned int function_degeneracies__=0;
|
||||
unsigned int io_errors__=0;
|
||||
unsigned int audit_failures__=0;
|
||||
|
||||
void write_debug_counters(std::ostream &out) {
|
||||
out << "Degeneracies " << function_degeneracies__ << std::endl;
|
||||
if (io_errors__ != 0) out << "I/O errors " << io_errors__ << std::endl;
|
||||
if (audit_failures__ != 0) out << "Audit failures " << audit_failures__ << std::endl;
|
||||
}
|
||||
}
|
||||
CGAL_KINETIC_END_NAMESPACE
|
||||
|
|
@ -88,6 +88,6 @@ int main(int, char *[])
|
|||
std::cout << "No errors for " << std::distance(kdel.visitor().events_begin(), kdel.visitor().events_end()) << " events.\n";
|
||||
}
|
||||
|
||||
if (CGAL::Kinetic::internal::fail__) return EXIT_FAILURE;
|
||||
if (CGAL::Kinetic::internal::audit_failures__ != 0 ) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -84,6 +84,6 @@ int main(int, char *[])
|
|||
//std::cout << "Insert " << queue_insertions__ << " and front " << queue_front_insertions__ << std::endl;
|
||||
//std::cout << "Sturm created " << sturm_created__ << " and shrink " << sturm_refined__ << std::endl;
|
||||
|
||||
if (CGAL::Kinetic::internal::fail__) return EXIT_FAILURE;
|
||||
if (CGAL::Kinetic::internal::audit_failures__ != 0 ) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
|
||||
if (error || CGAL::Kinetic::internal::fail__) {
|
||||
if (error || CGAL::Kinetic::internal::audit_failures__ != 0) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ bool sort_test(Traits &tr, double max_events=std::numeric_limits<double>::infini
|
|||
#ifndef NDEBUG
|
||||
if (tr.simulator_handle()->current_event_number() > max_events){
|
||||
std::cerr << "ERROR too many events" << std::endl;
|
||||
CGAL::Kinetic::internal::fail__=true;
|
||||
++CGAL::Kinetic::internal::audit_failures__;
|
||||
std::cerr << *tr.active_points_1_table_handle() << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -73,7 +73,7 @@ bool sort_test(Traits &tr, double max_events=std::numeric_limits<double>::infini
|
|||
std::cerr << etag << "Objects " << c->object() << " = " << tr.active_points_1_table_handle()->at(*c).x() << " and "
|
||||
<< b->object() << " = " << tr.active_points_1_table_handle()->at(*b).x() << " out of order at end of time "
|
||||
<<ratt << std::endl;
|
||||
CGAL::Kinetic::internal::fail__|= fail;
|
||||
++CGAL::Kinetic::internal::audit_failures__;
|
||||
error=eret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@ int main(int, char *[])
|
|||
Tr::Simulator::Function_kernel::Function fn= tr.kinetic_kernel_object().function_kernel_object().construct_function_object()(1,0,-2);
|
||||
check_nt(Tr::Simulator::Time(-1));
|
||||
|
||||
if (CGAL::Kinetic::internal::fail__) return EXIT_FAILURE;
|
||||
if (CGAL::Kinetic::internal::audit_failures__ != 0) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
|||
error= sort_test<Tr>(tr, 3000);
|
||||
|
||||
|
||||
if (error || CGAL::Kinetic::internal::fail__) {
|
||||
if (error || CGAL::Kinetic::internal::audit_failures__ != 0) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <CGAL/Kinetic/basic.h>
|
||||
|
||||
#include <CGAL/Kinetic/Regular_triangulation_3.h>
|
||||
#include <CGAL/Kinetic/Regular_triangulation_exact_simulation_traits.h>
|
||||
#include <CGAL/Kinetic/Regular_triangulation_CORE_exact_simulation_traits.h>
|
||||
#include <CGAL/Kinetic/Regular_triangulation_inexact_simulation_traits.h>
|
||||
#include <CGAL/Kinetic/Regular_triangulation_event_log_visitor_3.h>
|
||||
#include <algorithm>
|
||||
|
|
@ -17,103 +17,104 @@ int main(int, char *[])
|
|||
|
||||
if (0) {
|
||||
typedef CGAL::Kinetic::Regular_triangulation_inexact_simulation_traits Simulation_traits;
|
||||
typedef CGAL::Kinetic::Regular_triangulation_event_log_visitor_3 Visitor;
|
||||
typedef CGAL::Kinetic::Regular_triangulation_3<Simulation_traits, Visitor> KDel;
|
||||
Simulation_traits simtr(0,100000);
|
||||
Simulation_traits::Simulator::Handle sp= simtr.simulator_handle();
|
||||
typedef CGAL::Kinetic::Regular_triangulation_event_log_visitor_3 Visitor;
|
||||
typedef CGAL::Kinetic::Regular_triangulation_3<Simulation_traits, Visitor> KDel;
|
||||
Simulation_traits simtr(0,100000);
|
||||
Simulation_traits::Simulator::Handle sp= simtr.simulator_handle();
|
||||
|
||||
KDel kdel(simtr);
|
||||
//CGAL_KINETIC_SET_LOG_LEVEL(CGAL::Kinetic::LOG_LOTS);
|
||||
std::ifstream in("data/regular_triangulation_3.input");
|
||||
if (!in) {
|
||||
std::cerr << "Error opening input file: " << "data/regular_triangulation_3.input" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
char buf[1000];
|
||||
int nread=0;
|
||||
while (true ) {
|
||||
in.getline(buf, 1000);
|
||||
if (!in) break;
|
||||
std::istringstream il(buf);
|
||||
Simulation_traits::Kinetic_kernel::Weighted_point_3 p;
|
||||
il >> p;
|
||||
//std::cout << p << std::endl;
|
||||
simtr.active_points_3_table_handle()->insert(p); // here
|
||||
++nread;
|
||||
}
|
||||
kdel.set_has_certificates(true);
|
||||
KDel kdel(simtr);
|
||||
//CGAL_KINETIC_SET_LOG_LEVEL(CGAL::Kinetic::LOG_LOTS);
|
||||
std::ifstream in("data/regular_triangulation_3.input");
|
||||
if (!in) {
|
||||
std::cerr << "Error opening input file: " << "data/regular_triangulation_3.input" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
char buf[1000];
|
||||
int nread=0;
|
||||
while (true ) {
|
||||
in.getline(buf, 1000);
|
||||
if (!in) break;
|
||||
std::istringstream il(buf);
|
||||
Simulation_traits::Kinetic_kernel::Weighted_point_3 p;
|
||||
il >> p;
|
||||
//std::cout << p << std::endl;
|
||||
simtr.active_points_3_table_handle()->insert(p); // here
|
||||
++nread;
|
||||
}
|
||||
kdel.set_has_certificates(true);
|
||||
|
||||
while (sp->next_event_time()
|
||||
< sp->end_time()) {
|
||||
sp->set_current_event_number(sp->current_event_number()+1);
|
||||
}
|
||||
while (sp->next_event_time()
|
||||
< sp->end_time()) {
|
||||
sp->set_current_event_number(sp->current_event_number()+1);
|
||||
}
|
||||
} else {
|
||||
typedef CGAL::Kinetic::Regular_triangulation_exact_simulation_traits Simulation_traits;
|
||||
typedef CGAL::Kinetic::Regular_triangulation_event_log_visitor_3 Visitor;
|
||||
typedef CGAL::Kinetic::Regular_triangulation_3<Simulation_traits, Visitor> KDel;
|
||||
Simulation_traits simtr(0,100000);
|
||||
Simulation_traits::Simulator::Handle sp= simtr.simulator_handle();
|
||||
typedef CGAL::Kinetic::Regular_triangulation_CORE_exact_simulation_traits Simulation_traits;
|
||||
typedef CGAL::Kinetic::Regular_triangulation_event_log_visitor_3 Visitor;
|
||||
typedef CGAL::Kinetic::Regular_triangulation_3<Simulation_traits, Visitor> KDel;
|
||||
Simulation_traits simtr(0,100000);
|
||||
Simulation_traits::Simulator::Handle sp= simtr.simulator_handle();
|
||||
|
||||
KDel kdel(simtr);
|
||||
//CGAL_KINETIC_SET_LOG_LEVEL(CGAL::Kinetic::LOG_LOTS);
|
||||
std::ifstream in("data/regular_triangulation_3.input");
|
||||
if (!in) {
|
||||
std::cerr << "Error opening input file: " << "data/regular_triangulation_3.input" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
char buf[1000];
|
||||
int nread=0;
|
||||
while (true ) {
|
||||
in.getline(buf, 1000);
|
||||
if (!in) break;
|
||||
std::istringstream il(buf);
|
||||
Simulation_traits::Kinetic_kernel::Weighted_point_3 p;
|
||||
il >> p;
|
||||
//std::cout << p << std::endl;
|
||||
simtr.active_points_3_table_handle()->insert(p); // here
|
||||
++nread;
|
||||
}
|
||||
kdel.set_has_certificates(true);
|
||||
|
||||
while (sp->next_event_time()
|
||||
< sp->end_time()) {
|
||||
sp->set_current_event_number(sp->current_event_number()+1);
|
||||
}
|
||||
|
||||
/*std::copy(kdel.visitor().begin(), kdel.visitor().end(),
|
||||
std::ostream_iterator<std::string>(std::cout, "\n"));*/
|
||||
|
||||
std::ifstream out("data/regular_triangulation_3.output");
|
||||
if (!out) {
|
||||
std::cerr << "Error opening input file: " << "data/regular_triangulation_3.output" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int error_count=0;
|
||||
for (CGAL::Kinetic::Delaunay_triangulation_event_log_visitor_3::Event_iterator it = kdel.visitor().events_begin();
|
||||
it != kdel.visitor().events_end(); ++it) {
|
||||
char buf[1000];
|
||||
out.getline(buf, 1000);
|
||||
if (*it != buf) {
|
||||
std::cerr << "ERROR Got event: " << *it << std::endl;
|
||||
std::cerr << "ERROR Expected event: " << buf << std::endl;
|
||||
++error_count;
|
||||
KDel kdel(simtr);
|
||||
//CGAL_KINETIC_SET_LOG_LEVEL(CGAL::Kinetic::LOG_LOTS);
|
||||
std::ifstream in("data/regular_triangulation_3.input");
|
||||
if (!in) {
|
||||
std::cerr << "Error opening input file: " << "data/regular_triangulation_3.input" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
while (out) {
|
||||
char buf[1000];
|
||||
out.getline(buf, 1000);
|
||||
if (out) {
|
||||
std::cerr << "ERROR Missing event: " << buf << std::endl;
|
||||
++error_count;
|
||||
int nread=0;
|
||||
while (true ) {
|
||||
in.getline(buf, 1000);
|
||||
if (!in) break;
|
||||
std::istringstream il(buf);
|
||||
Simulation_traits::Kinetic_kernel::Weighted_point_3 p;
|
||||
il >> p;
|
||||
//std::cout << p << std::endl;
|
||||
simtr.active_points_3_table_handle()->insert(p); // here
|
||||
++nread;
|
||||
}
|
||||
}
|
||||
kdel.set_has_certificates(true);
|
||||
|
||||
if (error_count != 0) {
|
||||
std::cerr << "ERROR " << error_count << " errors in " << kdel.visitor().size() << " events.\n";
|
||||
}
|
||||
if (CGAL::Kinetic::internal::fail__) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
while (sp->next_event_time()
|
||||
< sp->end_time()) {
|
||||
sp->set_current_event_number(sp->current_event_number()+1);
|
||||
}
|
||||
|
||||
/*std::copy(kdel.visitor().begin(), kdel.visitor().end(),
|
||||
std::ostream_iterator<std::string>(std::cout, "\n"));*/
|
||||
|
||||
std::ifstream out("data/regular_triangulation_3.output");
|
||||
if (!out) {
|
||||
std::cerr << "Error opening input file: " << "data/regular_triangulation_3.output" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
int error_count=0;
|
||||
for (CGAL::Kinetic::Delaunay_triangulation_event_log_visitor_3::Event_iterator it = kdel.visitor().events_begin();
|
||||
it != kdel.visitor().events_end(); ++it) {
|
||||
char buf[1000];
|
||||
out.getline(buf, 1000);
|
||||
if (*it != buf) {
|
||||
std::cerr << "ERROR Got event: " << *it << std::endl;
|
||||
std::cerr << " Expected event: " << buf << std::endl;
|
||||
++error_count;
|
||||
}
|
||||
}
|
||||
|
||||
while (out) {
|
||||
char buf[1000];
|
||||
out.getline(buf, 1000);
|
||||
if (out) {
|
||||
std::cerr << "ERROR Missing event: " << buf << std::endl;
|
||||
++error_count;
|
||||
}
|
||||
}
|
||||
|
||||
if (error_count != 0) {
|
||||
std::cerr << "ERROR " << error_count << " errors in " << kdel.visitor().size() << " events.\n";
|
||||
}
|
||||
CGAL::Kinetic::internal::write_debug_counters(std::cout);
|
||||
if (CGAL::Kinetic::internal::audit_failures__ != 0) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -269,6 +269,6 @@ int main(int, char *[])
|
|||
|
||||
// if (!error) return EXIT_SUCCESS;
|
||||
//else
|
||||
if (CGAL::Kinetic::internal::fail__) return EXIT_FAILURE;
|
||||
if (CGAL::Kinetic::internal::audit_failures__ != 0 ) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,6 @@ int main(int, char *[])
|
|||
}
|
||||
}*/
|
||||
|
||||
if (CGAL::Kinetic::internal::fail__) return EXIT_FAILURE;
|
||||
if (CGAL::Kinetic::internal::audit_failures__ != 0) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
|||
std::cout << "Sort\n";
|
||||
test_sort < CGAL::Kinetic::Exact_simulation_traits > ("Upper bound");
|
||||
|
||||
if (CGAL::Kinetic::internal::fail__) return EXIT_FAILURE;
|
||||
if (CGAL::Kinetic::internal::audit_failures__ != 0) return EXIT_FAILURE;
|
||||
else return EXIT_SUCCESS;
|
||||
|
||||
//test_sort < CGAL::Kinetic::Exact_simulation_traits_1 > ("Upper bound");
|
||||
|
|
|
|||
Loading…
Reference in New Issue