Public Member Functions | Friends | List of all members
Convergence::HasConverged Struct Reference

Signals convergence of the algorithm. More...

#include <HasConverged.hpp>

Public Member Functions

 HasConverged (const Criteria &criteria, size_t iteration_id, double residual_magnitude, double initial_residual_magnitude) noexcept
 Determine whether the criteria are met by means of Convergence::criteria_match.
 
 HasConverged (size_t num_iterations, size_t iteration_id) noexcept
 Construct at a state where iteration_id iterations of a total of num_iterations have completed.
 
 operator bool () const noexcept
 
Reason reason () const noexcept
 The reason the algorithm has converged. More...
 
size_t num_iterations () const noexcept
 The number of iterations the algorithm has completed.
 
double residual_magnitude () const noexcept
 The residual magnitude after the last iteration. NaN if no iteration has completed yet.
 
double initial_residual_magnitude () const noexcept
 The residual magnitude before the first iteration. NaN if this information is not available yet.
 
void pup (PUP::er &p) noexcept
 

Friends

bool operator== (const HasConverged &lhs, const HasConverged &rhs) noexcept
 
bool operator!= (const HasConverged &lhs, const HasConverged &rhs) noexcept
 
std::ostreamoperator<< (std::ostream &os, const HasConverged &has_converged) noexcept
 

Detailed Description

Signals convergence of the algorithm.

Details

Evaluates to true if the algorithm has converged and no further iterations should be performed. In this case, the reason() member function provides more information. If false, calling reason() is an error.

The stream operator provides a human-readable description of the convergence status.

This type default-constructs to a state that signals the algorithm has not yet converged.

Member Function Documentation

◆ reason()

Reason Convergence::HasConverged::reason ( ) const
noexcept

The reason the algorithm has converged.

Warning
Calling this function is an error if the algorithm has not yet converged.

The documentation for this struct was generated from the following files: