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 )
82 typedef CheckConvergenceStd_AddedStep target_t;
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() ) );
bool StringToBool(const char *opt_name, const char *str)
Convert a string "true" or "false" into bool #true# or #false#.
CheckConvergenceStd_AddedStep & target()
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)
const std::string & option_value(OptionsGroup::const_iterator &itr)