45 #include "NLPInterfacePack_NLPFirstDerivTesterSetOptions.hpp"
50 const int local_num_options = 4;
59 const char* local_SOptions[local_num_options] = {
68 namespace NLPInterfacePack {
72 ,
const char opt_grp_name[] )
73 : OptionsFromStreamPack::SetOptionsFromStreamNode(
74 opt_grp_name, local_num_options, local_SOptions )
75 , OptionsFromStreamPack::SetOptionsToTargetBase<
80 int option_num,
const std::string& option_value )
83 switch( (local_EOptions)option_num ) {
84 case FD_TESTING_METHOD:
86 const std::string &option = option_value.c_str();
87 if( option ==
"FD_COMPUTE_ALL" )
88 target().fd_testing_method( target_t::FD_COMPUTE_ALL );
89 else if( option ==
"FD_DIRECTIONAL" )
90 target().fd_testing_method( target_t::FD_DIRECTIONAL );
92 throw std::invalid_argument(
"Error, incorrect value for "
93 "\"fd_testing_method\". Only the options "
94 "FD_COMPUTE_ALL and FD_DIRECTIONAL are available" );
97 case NUM_FD_DIRECTIONS:
98 target().num_fd_directions(std::atoi(option_value.c_str()));
101 target().warning_tol(std::fabs(std::atof(option_value.c_str())));
104 target().error_tol(std::fabs(std::atof(option_value.c_str())));
NLPFirstDerivTesterSetOptions(NLPFirstDerivTester *target=0, const char opt_grp_name[]="NLPFirstDerivTester")
Concrete class that tests the derivatives using finite differences.
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)