Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <iosfwd>
7 :
8 : /// \cond
9 : namespace Options {
10 : class Option;
11 : template <typename T>
12 : struct create_from_yaml;
13 : } // namespace Options
14 : /// \endcond
15 :
16 : namespace Convergence {
17 :
18 : /*!
19 : * \brief The reason the algorithm has converged or terminated.
20 : *
21 : * \see Convergence::Criteria
22 : */
23 1 : enum class Reason {
24 : /// Reached the target number of iterations
25 : NumIterations,
26 : /// Reached the maximum number of iterations. Can be interpreted as an error
27 : /// condition.
28 : MaxIterations,
29 : /// Residual converged below absolute tolerance
30 : AbsoluteResidual,
31 : /// Residual converged below relative tolerance
32 : RelativeResidual,
33 : /// An error occurred during the algorithm
34 : Error
35 : };
36 :
37 0 : std::ostream& operator<<(std::ostream& os, const Reason& reason);
38 :
39 : } // namespace Convergence
40 :
41 : template <>
42 0 : struct Options::create_from_yaml<Convergence::Reason> {
43 : template <typename Metavariables>
44 0 : static Convergence::Reason create(const Options::Option& options) {
45 : return create<void>(options);
46 : }
47 : };
48 : template <>
49 0 : Convergence::Reason
50 : Options::create_from_yaml<Convergence::Reason>::create<void>(
51 : const Options::Option& options);
|