45 #include "NLPInterfacePack_CalcFiniteDiffProdSetOptions.hpp" 46 #include "Teuchos_Assert.hpp" 51 const int local_num_options = 6;
62 const char* local_SOptions[local_num_options] = {
77 ,
const char opt_grp_name[]
84 int option_num,
const std::string& option_value )
87 switch( (local_EOptions)option_num ) {
90 const std::string &option = option_value.c_str();
91 if( option ==
"FD_ORDER_ONE" )
92 target().fd_method_order( target_t::FD_ORDER_ONE );
93 else if( option ==
"FD_ORDER_TWO" )
94 target().fd_method_order( target_t::FD_ORDER_TWO );
95 else if( option ==
"FD_ORDER_TWO_CENTRAL" )
96 target().fd_method_order( target_t::FD_ORDER_TWO_CENTRAL );
97 else if( option ==
"FD_ORDER_TWO_AUTO" )
98 target().fd_method_order( target_t::FD_ORDER_TWO_AUTO );
99 else if( option ==
"FD_ORDER_FOUR" )
100 target().fd_method_order( target_t::FD_ORDER_FOUR );
101 else if( option ==
"FD_ORDER_FOUR_CENTRAL" )
102 target().fd_method_order( target_t::FD_ORDER_FOUR_CENTRAL );
103 else if( option ==
"FD_ORDER_FOUR_AUTO" )
104 target().fd_method_order( target_t::FD_ORDER_FOUR_AUTO );
106 TEUCHOS_TEST_FOR_EXCEPTION(
107 true, std::invalid_argument
108 ,
"CalcFiniteDiffProdSetOptions::setOption(...) : Error, incorrect value for " 109 "\"fd_method_order\". Only the options FD_ORDER_ONE, FD_ORDER_TWO, " 110 "FD_ORDER_TWO_CENTRAL, FD_ORDER_TWO_AUTO, FD_ORDER_FOUR, FD_ORDER_FOUR_CENTRAL " 111 "and FD_ORDER_FOUR_AUTO are available" );
116 const std::string &option = option_value.c_str();
117 if( option ==
"FD_STEP_ABSOLUTE" )
118 target().fd_step_select( target_t::FD_STEP_ABSOLUTE );
119 else if( option ==
"FD_STEP_RELATIVE" )
120 target().fd_step_select( target_t::FD_STEP_RELATIVE );
122 TEUCHOS_TEST_FOR_EXCEPTION(
123 true, std::invalid_argument
124 ,
"CalcFiniteDiffProdSetOptions::setOption(...) : Error, incorrect value for " 125 "\"fd_step_select\". Only the options are available" );
129 target().fd_step_size(std::atof(option_value.c_str()));
131 case FD_STEP_SIZE_MIN:
132 target().fd_step_size_min(std::atof(option_value.c_str()));
135 target().fd_step_size_f(std::atof(option_value.c_str()));
138 target().fd_step_size_c(std::atof(option_value.c_str()));
141 TEUCHOS_TEST_FOR_EXCEPT(
true);
Strategy interface for computing the product of the derivatives of the functions of an NLP along give...
CalcFiniteDiffProdSetOptions(CalcFiniteDiffProd *target=0, const char opt_grp_name[]="CalcFiniteDiffProd")
void setOption(int option_num, const std::string &option_value)
Overridden from SetOptionsFromStreamNode.