19 #ifndef TERMINATIONREASON_HH_JW17MC8V
20 #define TERMINATIONREASON_HH_JW17MC8V
26 #include <petscsnes.h>
49 std::stringstream sdesc;
56 std::stringstream sdesc;
65 this->
root_cause()->get_nested_description(desc,indent_level);
90 return (this->
reason())!= 0;
131 return sm_keep_iterating;
134 static std::shared_ptr<TerminationReason>
max_iter() {
135 static std::shared_ptr<TerminationReason> sm_max_iter(
new GenericTerminationReason(-1,
"Iteration count exceeded."));
139 static std::shared_ptr<TerminationReason>
success() {
144 static std::shared_ptr<TerminationReason>
failure() {
virtual ~GenericTerminationReason()
virtual void get_description(std::ostream &desc, int indent_level=0)
GenericTerminationReason(int code, std::string &desc)
static std::shared_ptr< TerminationReason > max_iter()
static std::shared_ptr< TerminationReason > keep_iterating()
static std::shared_ptr< TerminationReason > success()
std::string m_description
static std::shared_ptr< TerminationReason > failure()
GenericTerminationReason(int code, const std::string &desc)
KSPTerminationReason(KSPConvergedReason r)
virtual void get_description(std::ostream &desc, int indent_level=0)
virtual void get_description(std::ostream &desc, int indent_level=0)
SNESTerminationReason(SNESConvergedReason r)
virtual void get_nested_description(std::ostream &desc, int indent_level=0)
virtual void get_description(std::ostream &desc, int indent_level=0)=0
std::shared_ptr< TerminationReason > m_root_cause
virtual bool has_root_cause()
void set_root_cause(std::shared_ptr< TerminationReason > cause)
virtual std::string description()
virtual std::string nested_description(int indent_level=0)
virtual ~TerminationReason()
static const char * sm_indent
TerminationReason & operator=(TerminationReason const &reason)
std::shared_ptr< TerminationReason > root_cause()
TerminationReason(int code)
TerminationReason(TerminationReason const &reason)