44 #include "MoochoPack_ReducedHessianSerialization_StepSetOptions.hpp"
45 #include "OptionsFromStreamPack_StringToBool.hpp"
46 #include "Teuchos_Assert.hpp"
51 const int local_num_options = 2;
54 REDUCED_HESSIAN_INPUT_FILE_NAME
55 ,REDUCED_HESSIAN_OUTPUT_FILE_NAME
58 const char* local_SOptions[local_num_options] = {
59 "reduced_hessian_input_file_name"
60 ,
"reduced_hessian_output_file_name"
64 std::string remove_quotes(
const std::string &option_name,
const std::string &str )
67 str[0]!=
'\"' || str[str.length()-1]!=
'\"', std::logic_error
68 ,
"Error, the option \'" << option_name <<
"\' must have a single set of quotes around it!"
71 return std::string(
"");
72 return str.substr(1,str.length()-2);
77 namespace MoochoPack {
79 ReducedHessianSerialization_StepSetOptions::ReducedHessianSerialization_StepSetOptions(
80 ReducedHessianSerialization_Step* target
81 ,
const char opt_grp_name[] )
82 : OptionsFromStreamPack::SetOptionsFromStreamNode(
83 opt_grp_name, local_num_options, local_SOptions )
84 , OptionsFromStreamPack::SetOptionsToTargetBase<
85 ReducedHessianSerialization_Step >( target )
88 void ReducedHessianSerialization_StepSetOptions::setOption(
89 int option_num,
const std::string& option_value )
91 using OptionsFromStreamPack::StringToBool;
93 typedef ReducedHessianSerialization_Step target_t;
94 switch( (local_EOptions)option_num ) {
95 case REDUCED_HESSIAN_INPUT_FILE_NAME : {
96 target().reduced_hessian_input_file_name(remove_quotes(
"reduced_hessian_input_file_name",option_value));
99 case REDUCED_HESSIAN_OUTPUT_FILE_NAME : {
100 target().reduced_hessian_output_file_name(remove_quotes(
"reduced_hessian_output_file_name",option_value));
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)