45 #include "NLPInterfacePack_NLPDirectTesterSetOptions.hpp" 46 #include "OptionsFromStreamPack_StringToBool.hpp" 51 const int local_num_options = 8;
64 const char* local_SOptions[local_num_options] = {
81 ,
const char opt_grp_name[]
88 int option_num,
const std::string& option_value
92 using ofsp::StringToBool;
94 switch( (local_EOptions)option_num ) {
95 case GF_TESTING_METHOD:
97 const std::string &option = option_value.c_str();
98 if( option ==
"FD_COMPUTE_ALL" )
99 target().Gf_testing_method( target_t::FD_COMPUTE_ALL );
100 else if( option ==
"FD_DIRECTIONAL" )
101 target().Gf_testing_method( target_t::FD_DIRECTIONAL );
103 throw std::invalid_argument(
"Error, incorrect value for " 104 "\"Gf_testing_method\". Only the options " 105 "FD_COMPUTE_ALL and FD_DIRECTIONAL are available" );
109 target().Gf_warning_tol(std::fabs(std::atof(option_value.c_str())));
112 target().Gf_error_tol(std::fabs(std::atof(option_value.c_str())));
114 case GC_TESTING_METHOD:
116 const std::string &option = option_value.c_str();
117 if( option ==
"FD_COMPUTE_ALL" )
118 target().Gc_testing_method( target_t::FD_COMPUTE_ALL );
119 else if( option ==
"FD_DIRECTIONAL" )
120 target().Gc_testing_method( target_t::FD_DIRECTIONAL );
122 throw std::invalid_argument(
"Error, incorrect value for " 123 "\"Gc_testing_method\". Only the options " 124 "FD_COMPUTE_ALL and FD_DIRECTIONAL are available" );
128 target().Gc_warning_tol(std::fabs(std::atof(option_value.c_str())));
131 target().Gc_error_tol(std::fabs(std::atof(option_value.c_str())));
133 case NUM_FD_DIRECTIONS:
134 target().num_fd_directions(std::abs(std::atoi(option_value.c_str())));
137 target().dump_all(StringToBool(
"dump_all",option_value.c_str()));
140 TEUCHOS_TEST_FOR_EXCEPT(
true);
NLPDirectTesterSetOptions(NLPDirectTester *target=0, const char opt_grp_name[]="NLPDirectTester")
Concrete class that tests the computed values of the NLPDirect interface using finite differences...
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.