mirror of https://github.com/CGAL/cgal
*** empty log message ***
This commit is contained in:
parent
0974c7b331
commit
c3d9ba41df
|
|
@ -25,8 +25,6 @@ except we could merge stuff with Olivier's Fixed !
|
|||
- In case there are loops, we must take the max() of the epsilons. This should
|
||||
not happen often, imho... Wait and see.
|
||||
- Move static_infos in src/.
|
||||
- Have a global ::number_of_failure for the static filters too. (don't use
|
||||
IA_nt's one)
|
||||
- Replace: NEW_bound = max(NEW_bound, fabs(px.to_double())); by: if (NEW_bound
|
||||
< fabs(px.to_double())) NEW_bound = fabs(px.to_double()); or even, using a
|
||||
.bound() member function: if (NEW_bound < px.bound()) NEW_bound = px.bound();
|
||||
|
|
@ -72,144 +70,10 @@ except we could merge stuff with Olivier's Fixed !
|
|||
and having the kernel store a predicate object for each predicate.
|
||||
Then the orientation_2_object() simply returns a reference to it.
|
||||
|
||||
The failure counters can go in a base class from which all predicate objects
|
||||
derive. For the IA filters, we can write a template operator() which does
|
||||
the try{} catch{} for any number of arguments ? Then the failure counters
|
||||
could be enabled (disabled by default) by an additional template parameter
|
||||
or a macro.
|
||||
|
||||
Then it means algorithms should use one "global" object per predicate (e.g.
|
||||
one orientation object for a whole Triangulation). Except for cases where
|
||||
they actually want different contexts.
|
||||
|
||||
Such counters could even be useful for the main kernel, to know how many
|
||||
times a predicate is called...
|
||||
Then my filtered kernel just takes 2 kernels as parameters, say
|
||||
Cartesian<Interval_nt, Profiler> and Cartesian<ET, Profiler>, then we
|
||||
can obtain the filtering statistics from the the main ones.
|
||||
|
||||
Note : the current kernel uses the same object for several predicates,
|
||||
differentiating by several operators()... It's the same object so it's
|
||||
the same context/counters/... Maybe we should think about splitting these
|
||||
things ? Or we can workaround for the few cases ?
|
||||
Need to think about that more...
|
||||
|
||||
|
||||
class profile_counter
|
||||
{
|
||||
mutable unsigned calls;
|
||||
protected:
|
||||
profile_counter()
|
||||
: calls(0) {}
|
||||
void inc_calls() const { calls++; }
|
||||
public:
|
||||
unsigned get_calls() const { return calls; }
|
||||
};
|
||||
|
||||
A zero cost version when not profiling :
|
||||
|
||||
class Dummy_profile_counter
|
||||
{
|
||||
protected:
|
||||
Dummy_profile_counter() {}
|
||||
void inc_calls() const {}
|
||||
public:
|
||||
unsigned get_calls() const { return 0; }
|
||||
};
|
||||
|
||||
And then something like for each predicate :
|
||||
|
||||
------------
|
||||
currently :
|
||||
template <class Point>
|
||||
struct p_Orientation
|
||||
{
|
||||
Orientation
|
||||
operator()(const Point& p, const Point& q, const Point& r) const
|
||||
{ return orientation(p,q,r); }
|
||||
Orientation
|
||||
operator()(const Point& p, const Point& q, const Point& r, const Point& s) const
|
||||
{ return orientation(p,q,r,s); }
|
||||
};
|
||||
------------
|
||||
template <class Profiler = Dummy_profile_counter>
|
||||
class Orientation_2
|
||||
: public Profiler
|
||||
{
|
||||
|
||||
template <class Point>
|
||||
Orientation
|
||||
operator()(const Point &p, const Point &q, const Point &r)
|
||||
{
|
||||
inc_calls();
|
||||
return orientation(p, q, r);
|
||||
}
|
||||
|
||||
template <class Point>
|
||||
Orientation
|
||||
operator()(const Point &p, const Point &q, const Point &r, const Point &s)
|
||||
{
|
||||
inc_calls(); // same counter as above :( big deal ?
|
||||
return orientation(p, q, r, s);
|
||||
}
|
||||
};
|
||||
|
||||
Sketch for my filtered kernel :
|
||||
-------------------------------
|
||||
|
||||
// Maybe the following can be made by a template ? See below.
|
||||
template <class EK, class IK = Cartesian<Interval_nt> >
|
||||
class Filtered_p_Orientation
|
||||
{
|
||||
IK::Orientation_2 approx;
|
||||
EK::Orientation_2 exact;
|
||||
|
||||
Filtered_p_Orientation()
|
||||
: approx(), exact() {}
|
||||
|
||||
Orientation
|
||||
operator()(const Point &p, const Point &q, const Point &r) const
|
||||
{
|
||||
try
|
||||
{
|
||||
Protect_FPU...
|
||||
return approx(p.approx(), q.approx(), r.approx());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return exact(p.exact(), q.exact(), r.exact());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Full template filtered version...
|
||||
template <class EP, class IP>
|
||||
class Filtered_predicate
|
||||
{
|
||||
IP approx;
|
||||
EP exact;
|
||||
|
||||
typedef IA::result_type result_type; // get it via template param ?
|
||||
|
||||
Filtered_predicate()
|
||||
: approx(), exact() {}
|
||||
|
||||
template <class A1>
|
||||
result_type
|
||||
operator()(const A1 &a1) const
|
||||
{
|
||||
try
|
||||
{
|
||||
Protect_FPU...
|
||||
return approx(p.approx());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return exact(p.exact());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Additional kernel for storage type ?
|
||||
template <class SK, class EK, class IK = Cartesian<Interval_nt> >
|
||||
class Filtered_Point_2
|
||||
|
|
|
|||
Loading…
Reference in New Issue