SpECTRE Documentation Coverage Report
Current view: top level - NumericalAlgorithms/RootFinding - GslMultiRoot.cpp Hit Total Coverage
Commit: 2db722c93a8e9b106e406b439b79c8e05c2057fb Lines: 0 5 0.0 %
Date: 2021-03-03 22:01:00
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #include "NumericalAlgorithms/RootFinding/GslMultiRoot.hpp"
       5             : 
       6             : #include <ostream>
       7             : 
       8             : #include "Utilities/ErrorHandling/Error.hpp"
       9             : 
      10           0 : namespace RootFinder {
      11           0 : std::ostream& operator<<(std::ostream& os,
      12             :                          const Verbosity& verbosity) noexcept {
      13             :   switch (verbosity) {
      14             :     case Verbosity::Silent:
      15             :       return os << "Silent";
      16             :     case Verbosity::Quiet:
      17             :       return os << "Quiet";
      18             :     case Verbosity::Verbose:
      19             :       return os << "Verbose";
      20             :     case Verbosity::Debug:
      21             :       return os << "Debug";
      22             :     default:
      23             :       ERROR("Invalid verbosity value specified.");
      24             :   }
      25             :   return os;
      26             : }
      27             : 
      28           0 : std::ostream& operator<<(std::ostream& os, const Method& method) noexcept {
      29             :   switch (method) {
      30             :     case Method::Hybrids:
      31             :       return os << "Hybrids";
      32             :     case Method::Hybrid:
      33             :       return os << "Hybrid";
      34             :     case Method::Newton:
      35             :       return os << "Newton";
      36             :     default:
      37             :       ERROR("Invalid method value specified.");
      38             :   }
      39             :   return os;
      40             : }
      41             : 
      42           0 : std::ostream& operator<<(std::ostream& os,
      43             :                          const StoppingCondition& condition) noexcept {
      44             :   switch (condition) {
      45             :     case StoppingCondition::AbsoluteAndRelative:
      46             :       return os << "AbsoluteAndRelative";
      47             :     case StoppingCondition::Absolute:
      48             :       return os << "Absolute";
      49             :     default:
      50             :       ERROR("Invalid stopping condition specified.");
      51             :   }
      52             :   return os;
      53             : }
      54             : 
      55             : namespace gsl_multiroot_detail {
      56             : void print_rootfinding_parameters(const Method method,
      57             :                                   const double absolute_tolerance,
      58             :                                   const double relative_tolerance,
      59             :                                   const double maximum_absolute_tolerance,
      60             :                                   const StoppingCondition condition) noexcept {
      61             :   Parallel::printf("\nAttempting a root find.\n");
      62             :   if (method == Method::Newton) {
      63             :     Parallel::printf(
      64             :         "Method: Newton. Modified to improve global convergence if analytic\n"
      65             :         "jacobian is provided.\n");
      66             :   } else if (method == Method::Hybrids) {
      67             :     Parallel::printf("Method: Scaled Hybrid.\n");
      68             :   } else if (method == Method::Hybrid) {
      69             :     Parallel::printf("Method: Unscaled Hybrid.\n");
      70             :   }
      71             :   if (condition == StoppingCondition::Absolute) {
      72             :     Parallel::printf(
      73             :         "Stopping condition: Absolute. Convergence will be determined\n"
      74             :         "according to gsl_multiroot_test_residual.\n");
      75             :     Parallel::printf("Absolute tolerance: %.17g\n", absolute_tolerance);
      76             :   } else if (condition == StoppingCondition::AbsoluteAndRelative) {
      77             :     Parallel::printf(
      78             :         "Stopping condition: AbsoluteAndRelative. Convergence will be\n"
      79             :         "determined according to gsl_multiroot_test_delta.\n");
      80             :     Parallel::printf("Absolute tolerance: %.17g\n", absolute_tolerance);
      81             :     Parallel::printf("Relative tolerance: %.17g\n", relative_tolerance);
      82             :     if (relative_tolerance < 1.0e-13) {
      83             :       Parallel::printf(
      84             :           "Warning: using a relative tolerance below 1.0e-13 can result\n"
      85             :           "in an FPE coming from within gsl itself. Be wary of this if the\n"
      86             :           "root find FPEs without reporting any other error messages.");
      87             :     }
      88             :   }
      89             :   Parallel::printf(
      90             :       "A failed root find may still be \"forgiven\" (said to converge) if\n"
      91             :       "each component of f is below the maximum_absolute_tolerance provided.\n"
      92             :       "This value is zero by default, meaning that no failed root finds will\n"
      93             :       "be forgiven. Maximum absolute tolerance: %.17g\n",
      94             :       maximum_absolute_tolerance);
      95             : }
      96             : }  // namespace gsl_multiroot_detail
      97             : }  // namespace RootFinder

Generated by: LCOV version 1.14