46 #include "MoochoPack_CheckConvergenceStd_AddedStepSetOptions.hpp"
47 #include "OptionsFromStreamPack_StringToBool.hpp"
52 const int local_num_options = 2;
59 const char* local_SOptions[local_num_options] = {
61 "scale_opt_error_by_Gf",
66 namespace MoochoPack {
69 CheckConvergenceStd_AddedStep* target
70 ,
const char opt_grp_name[] )
71 : OptionsFromStreamPack::SetOptionsFromStreamNode(
72 opt_grp_name, local_num_options, local_SOptions )
73 , OptionsFromStreamPack::SetOptionsToTargetBase<
74 CheckConvergenceStd_AddedStep >( target )
78 int option_num,
const std::string& option_value )
80 using OptionsFromStreamPack::StringToBool;
82 typedef CheckConvergenceStd_AddedStep target_t;
83 switch( (local_EOptions)option_num ) {
84 case SCALE_KKT_ERROR_BY:
86 const std::string &option = option_value.c_str();
87 if( option ==
"SCALE_BY_ONE" )
88 target().scale_kkt_error_by( target_t::SCALE_BY_ONE );
89 else if( option ==
"SCALE_BY_NORM_2_X" )
90 target().scale_kkt_error_by( target_t::SCALE_BY_NORM_2_X );
91 else if( option ==
"SCALE_BY_NORM_INF_X" )
92 target().scale_kkt_error_by( target_t::SCALE_BY_NORM_INF_X );
94 throw std::invalid_argument(
"Error, incorrect value for "
95 "\"scale_kkt_error_by\". Only the options "
96 "SCALE_BY_ONE, SCALE_BY_NORM_2_X, and SCALE_BY_NORM_INF_X "
100 case SCALE_OPT_ERROR_BY_GF: {
101 target().scale_opt_error_by_Gf(
102 StringToBool(
"scale_opt_error_by_Gf", option_value.c_str() ) );
CheckConvergenceStd_AddedStepSetOptions(CheckConvergenceStd_AddedStep *target=0, const char opt_grp_name[]="CheckConvergenceStd")
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)