47 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
48 #include "Thyra_EpetraModelEvaluator.hpp"
54 int main(
int argc,
char* argv[] )
61 bool dummySuccess =
true;
66 out = Teuchos::VerboseObjectBase::getDefaultOStream();
70 Stratimikos::DefaultLinearSolverBuilder lowsfCreator;
71 MoochoThyraSolver solver;
96 bool supportDerivs =
true;
98 std::string extraXmlFile =
"";
100 CommandLineProcessor clp(
false);
102 lowsfCreator.setupCLP(&clp);
103 solver.setupCLP(&clp);
105 clp.setOption(
"xt0", &xt0 );
106 clp.setOption(
"xt1", &xt1 );
107 clp.setOption(
"pt0", &pt0 );
108 clp.setOption(
"pt1", &pt1 );
109 clp.setOption(
"d", &d );
110 clp.setOption(
"x00", &x00 );
111 clp.setOption(
"x01", &x01 );
112 clp.setOption(
"p00", &p00 );
113 clp.setOption(
"p01", &p01 );
114 clp.setOption(
"pL0", &pL0 );
115 clp.setOption(
"pL1", &pL1 );
116 clp.setOption(
"pU0", &pU0 );
117 clp.setOption(
"pU1", &pU1 );
118 clp.setOption(
"xL0", &xL0 );
119 clp.setOption(
"xL1", &xL1 );
120 clp.setOption(
"xU0", &xU0 );
121 clp.setOption(
"xU1", &xU1 );
122 clp.setOption(
"support-derivs",
"no-support-derivs", &supportDerivs );
123 clp.setOption(
"extra-xml-file",&extraXmlFile,
"File with extra XML text that will modify the initial XML read in");
125 std::string line(
"");
126 if(extraXmlFile.length()) {
127 std::ifstream myfile(extraXmlFile.c_str());
128 if (myfile.is_open())
130 getline (myfile,line);
131 solver.extraParamsXmlStringOption(line);
132 std::cout << line <<
"\n";
137 CommandLineProcessor::EParseCommandLineReturn
138 parse_return = clp.parse(argc,argv,&std::cerr);
140 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
143 lowsfCreator.readParameters(out.
get());
144 solver.readParameters(out.
get());
161 lowsFactory = lowsfCreator.createLinearSolveStrategy(
"");
164 epetraThyraModel =
Teuchos::rcp(
new Thyra::EpetraModelEvaluator());
166 epetraThyraModel->initialize(epetraModel,lowsFactory);
173 solver.setModel(epetraThyraModel);
176 solver.readInitialGuess(out.
get());
179 const MoochoSolver::ESolutionStatus solution_status = solver.solve();
182 solver.writeFinalSolution(out.
get());
185 lowsfCreator.writeParamsFile(*lowsFactory);
186 solver.writeParamsFile();
192 return solution_status;
197 return MoochoSolver::SOLVE_RETURN_EXCEPTION;
void set_x_bounds(double xL0, double xL1, double xU0, double xU1)
RTOp_value_type value_type
void set_p_bounds(double pL0, double pL1, double pU0, double pU1)
MOOCHO NLP Solver class for models represented through Thyra::ModelEvaluator.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
Universal interface to a MOOCHO solver.
void setSupportDerivs(bool supportDerivs)
int main(int argc, char *argv[])