51 const int local_num_options = 8;
64 const char* local_SOptions[local_num_options] = {
77 namespace NLPInterfacePack {
81 ,
const char opt_grp_name[]
83 :OptionsFromStreamPack::SetOptionsFromStreamNode(opt_grp_name,local_num_options,local_SOptions)
84 ,OptionsFromStreamPack::SetOptionsToTargetBase<
NLPDirectTester>( target )
91 namespace ofsp = OptionsFromStreamPack;
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())));
NLPDirectTesterSetOptions(NLPDirectTester *target=0, const char opt_grp_name[]="NLPDirectTester")
bool StringToBool(const char *opt_name, const char *str)
Convert a string "true" or "false" into bool #true# or #false#.
void abs(DVectorSlice *vs_lhs, const DVectorSlice &vs_rhs)
vs_lhs = abs(vs_rhs)
NLPDirectTester & target()
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.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
const std::string & option_value(OptionsGroup::const_iterator &itr)