📄 handle_degeneracy_function_kernel.h
字号:
// Copyright (c) 2005 Stanford University (USA).// All rights reserved.//// This file is part of CGAL (www.cgal.org); you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public License as// published by the Free Software Foundation; version 2.1 of the License.// See the file LICENSE.LGPL distributed with CGAL.//// Licensees holding a valid commercial license may use this file in// accordance with the commercial license agreement provided with the software.//// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.//// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.3-branch/Kinetic_data_structures/include/CGAL/Kinetic/Handle_degeneracy_function_kernel.h $// $Id: Handle_degeneracy_function_kernel.h 35973 2007-01-31 03:15:14Z drussel $// //// Author(s) : Daniel Russel <drussel@alumni.princeton.edu>#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;template <class Traits_t, bool SLOPPY>class HDRS{ private: typedef typename Traits_t::Root_stack Wrapped_solver; typedef typename Traits_t::Function Function; public: typedef typename Wrapped_solver::Root Root; typedef Traits_t Traits; //! Construct and check preconditions /*! */ HDRS(const Function &uf, const Root& lb, const Root& ub, const Traits_t& k): solver_(k.root_stack_object(uf, lb, ub)) { CGAL_KINETIC_LOG(LOG_LOTS, "Function= " << uf << std::endl); CGAL_expensive_precondition(solver_.empty() || solver_.top() >= lb); if (uf.degree() == -1) { CGAL_KINETIC_LOG(LOG_SOME, "Zero function found at time " << lb << std::endl); ++ internal::zero_certificates__; }#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); CGAL_exactness_precondition(k.sign_at_object()(uf, lb) != CGAL::NEGATIVE); }#endif if (solver_.empty()) { CGAL_KINETIC_LOG(LOG_LOTS, "No failure" << std::endl); //sn = k.sign_between_roots_object()(uf, lb, ub); } else if (solver_.top() == lb) { 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); solver_.pop(); } } } HDRS(){} //! Drop even roots const Root& top() const { return solver_.top(); } void pop() { solver_.pop(); } bool empty() const { return solver_.empty(); } /*double estimate() const { return solver_.estimate(); }*/ std::ostream &write(std::ostream& out) const { out << solver_; return out; } protected: Wrapped_solver solver_; };template <class Traits_t, bool SLOPPY>struct Handle_degeneracy_function_kernel: public Traits_t{ typedef HDRS<Traits_t, SLOPPY> Root_stack; Root_stack root_stack_object(const typename Traits_t::Function &f, const typename Traits_t::Root &lb, const typename Traits_t::Root &ub) const { return Root_stack(f, lb, ub, *this); }};template <class T, bool SLOPPY>std::ostream &operator<<(std::ostream &out, const HDRS<T, SLOPPY> &k) { return k.write(out);}CGAL_KINETIC_END_NAMESPACE;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -