// This file is part of Bertini 2. // // fixed_prec_endgame.hpp is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or //(at your option) any later version. // // fixed_prec_endgame.hpp is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with fixed_prec_endgame.hpp. If not, see // . // // Copyright(C) 2015 - 2021 by Bertini2 Development Team // // See for a copy of the license, // as well as COPYING. Bertini2 is provided with permitted // additional terms in the b2/licenses/ directory. // individual authors of this file include: // silviana amethyst, university of wisconsin eau claire // Tim Hodges, Colorado State University #pragma once /** \file fixed_prec_endgame.hpp \brief Contains the policy for fixed precision endgame types. */ #include "endgames/config.hpp" #include "endgames/prec_base.hpp" #include "trackers/fixed_precision_tracker.hpp" #include "trackers/fixed_precision_utilities.hpp" namespace bertini { namespace endgame { template class FixedPrecEndgame : public virtual EndgamePrecPolicyBase { public: using TrackerType = TrackerT; using BaseComplexType = typename tracking::TrackerTraits::BaseComplexType; using BaseRealType = typename tracking::TrackerTraits::BaseRealType; using BCT = BaseComplexType; using BRT = BaseRealType; template static unsigned EnsureAtUniformPrecision(T&... args) { return bertini::tracking::fixed::EnsureAtUniformPrecision(args...); } template static void EnsureAtPrecision(T const& obj, unsigned prec) { using bertini::Precision; if (Precision(obj) != prec) { std::stringstream err_msg; err_msg << "ensuring precision of object failed; precision is " << Precision(obj) << " and required precision is " << prec; throw std::runtime_error(err_msg.str()); } } SuccessCode RefineSampleImpl(Vec& result, Vec const& current_sample, BCT const& current_time, double tol, unsigned max_iterations) const { using RT = mpfr_float; using std::max; auto& TR = this->GetTracker(); auto refinement_success = this->GetTracker().Refine( result, current_sample, current_time, tol, max_iterations); return SuccessCode::Success; } explicit FixedPrecEndgame(TrackerT const& new_tracker) : EndgamePrecPolicyBase(new_tracker) {} virtual ~FixedPrecEndgame() = default; }; // re: fixed prec endgame policy template <> struct EGPrecSelector { using type = FixedPrecEndgame; }; template <> struct EGPrecSelector { using type = FixedPrecEndgame; }; template struct EGPrecSelector> { using type = FixedPrecEndgame>; }; } // namespace endgame } // namespace bertini