WIP for bench4

This commit is contained in:
Andreas Fabri 2025-07-02 16:54:47 +01:00
parent 1e991ff6ad
commit b38b13e2ef
4 changed files with 43 additions and 12 deletions

View File

@ -38,25 +38,22 @@ public:
const Point_4 &r, const Point_4 &s,
const Point_4 &t) const
{
std::cout << "XX" << std::endl;
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Orientation_4", tmp);
double p0, p1, p2, p3, p4, q0, q1, q2, q3, q4, r0, r1, r2, r3, r4, s0, s1, s2, s3, s4, t0, t1, t2, t3, t4;
double p0, p1, p2, p3, q0, q1, q2, q3, r0, r1, r2, r3, s0, s1, s2, s3, t0, t1, t2, t3;
if (fit_in_double(p.c0(), p0) && fit_in_double(p.c1(), p1) &&
fit_in_double(p.c2(), p2) && fit_in_double(p.c3(), p3) &&
fit_in_double(p.c4(), p4) &&
fit_in_double(q.c0(), q0) && fit_in_double(q.c1(), q1) &&
fit_in_double(q.c2(), q2) && fit_in_double(q.c3(), q3) &&
fit_in_double(q.c4(), q4) &&
fit_in_double(r.c0(), r0) && fit_in_double(r.c1(), r1) &&
fit_in_double(r.c2(), r2) && fit_in_double(r.c3(), r3) &&
fit_in_double(r.c4(), r4) &&
fit_in_double(s.c0(), s0) && fit_in_double(s.c1(), s1) &&
fit_in_double(s.c2(), s2) && fit_in_double(s.c3(), s3) &&
fit_in_double(s.c4(), s4) &&
fit_in_double(t.c0(), t0) && fit_in_double(t.c1(), t1) &&
fit_in_double(t.c2(), t2) && fit_in_double(t.c3(), t3) &&
fit_in_double(t.c4(), t4) )
fit_in_double(t.c2(), t2) && fit_in_double(t.c3(), t3) )
{
CGAL_assertion_code(Orientation should_be = Base::operator()(p, q, r, s, t));
double m01;

View File

@ -180,6 +180,27 @@ template <class Base_,class R_> struct Adapter_4 {
};
};
template <class Base_,class R_> struct Orientation_of_points_4 : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Orientation_of_points_4)
typedef typename Get_type<R_, Point_tag>::type Point;
typedef typename Get_type<R_, Orientation_tag>::type result_type;
typedef typename Get_functor<R_, Compute_point_cartesian_coordinate_tag>::type CC;
typedef Adapter_4<Base_, R_> Adapter;
template<class Iter> result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{
CC c(this->kernel());
Point const& A=*f;
Point const& B=*++f;
Point const& C=*++f;
Point const& D=*++f;
Point const& E=*++f;
CGAL_assertion(++f==e);
typedef typename Adapter::Point_4 P;
return typename internal::Static_filters_predicates::Orientation_4<Adapter>()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),
P(this->kernel(),c,D),P(this->kernel(),c,E));
}
};
template <class Base_,class R_> struct Adapter_5 {
typedef typename Get_type<R_, Orientation_tag>::type Orientation;
typedef typename Get_type<R_, Oriented_side_tag>::type Oriented_side;
@ -322,6 +343,19 @@ struct Cartesian_static_filters<Dimension_tag<3>, R_, Derived_> : public R_ {
};
#ifndef CGAL_NO_STATIC_FILTER_5
template <class R_, class Derived_>
struct Cartesian_static_filters<Dimension_tag<4>, R_, Derived_> : public R_ {
constexpr Cartesian_static_filters(){}
constexpr Cartesian_static_filters(int d):R_(d){}
typedef Cartesian_static_filters<Dimension_tag<4>, R_, Derived_> Self;
typedef typename Default::Get<Derived_,Self>::type Derived;
template <class T, class=void> struct Functor : Inherit_functor<R_, T> {};
template <class D> struct Functor <Orientation_of_points_tag,D> {
typedef SFA::Orientation_of_points_4<R_,Derived> type;
};
};
template <class R_, class Derived_>
struct Cartesian_static_filters<Dimension_tag<5>, R_, Derived_> : public R_ {
constexpr Cartesian_static_filters(){}

View File

@ -23,18 +23,18 @@ int main()
const int D = 4; // we work in Euclidean 4-space
std::vector<Triangulation::Point> points;
std::ifstream in("points.txt");
std::ifstream in("points_4.txt");
Triangulation::Point p;
int d;
in >> d;
assert(d == D);
int n;
in >> n;
std::cout << n << " points in dimension " << d << std::endl;
points.reserve(n);
while (in >> p) {
points.push_back(p);
}
CGAL::Timer timer;
timer.start();
Triangulation t(D); // create triangulation

View File

@ -5,10 +5,10 @@
int main() {
CGAL::Random rng;
std::cout.precision(17);
std ::cout << 6 << std::endl;
std ::cout << 4 << std::endl;
std::cout << 100000 << std::endl;
for(int i = 0; i < 100000; ++i) {
std::array<double, 6> arr;
std::array<double, 4> arr;
double slength = 0;
for(int i = 0; i < arr.size(); ++i) {
arr[i] = rng.get_double(-1, 1);
@ -18,7 +18,7 @@ int main() {
for(int i = 0; i < arr.size(); ++i) {
arr[i] /= slength;
}
std::cout << "6 " << arr[0] << " " << arr[1] << " " << arr[2] << " " << arr[3] << " " << arr[4]<< " " << arr[5] << std::endl;
std::cout << "4 " << arr[0] << " " << arr[1] << " " << arr[2] << " " << arr[3] /* << " " << arr[4] /* << " " << arr[5] */ << std::endl;
}
return 0;
}