51 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
52 #include "Thyra_EpetraModelEvaluator.hpp"
59 int main(
int argc,
char* argv[] )
67 bool dummySuccess =
true;
72 out = Teuchos::VerboseObjectBase::getDefaultOStream();
76 Stratimikos::DefaultLinearSolverBuilder lowsfCreator;
77 MoochoThyraSolver solver;
103 CommandLineProcessor clp(
false);
105 lowsfCreator.setupCLP(&clp);
106 solver.setupCLP(&clp);
108 clp.setOption(
"xt0", &xt0 );
109 clp.setOption(
"xt1", &xt1 );
110 clp.setOption(
"pt0", &pt0 );
111 clp.setOption(
"pt1", &pt1 );
112 clp.setOption(
"d", &d );
113 clp.setOption(
"x00", &x00 );
114 clp.setOption(
"x01", &x01 );
115 clp.setOption(
"p00", &p00 );
116 clp.setOption(
"q0", &q0 );
117 clp.setOption(
"p01", &p01 );
118 clp.setOption(
"pL0", &pL0 );
119 clp.setOption(
"pL1", &pL1 );
120 clp.setOption(
"pU0", &pU0 );
121 clp.setOption(
"pU1", &pU1 );
122 clp.setOption(
"xL0", &xL0 );
123 clp.setOption(
"xL1", &xL1 );
124 clp.setOption(
"xU0", &xU0 );
125 clp.setOption(
"xU1", &xU1 );
127 CommandLineProcessor::EParseCommandLineReturn
128 parse_return = clp.parse(argc,argv,&std::cerr);
130 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
133 lowsfCreator.readParameters(out.
get());
134 solver.readParameters(out.
get());
154 epetraModel =
Teuchos::rcp(
new EpetraMultiPointModelEval4DOpt(epetra_comm,xt0,xt1,pt0,pt1,d,x00,x01,p00,p01, q0));
159 std::vector<Epetra_Vector*> multi_x_init(myPoints);
161 for (
int i=0; i<myPoints; i++) { multi_x_init[i] = &init_vec;}
166 for (
int i=0; i<myPoints; i++) {
168 q_vec->operator[](i)->
operator[](0) = 0.0 + 0.1*(i+myFirstPoint);
174 epetraModel, globalComm, multi_x_init, q_vec));
179 lowsFactory = lowsfCreator.createLinearSolveStrategy(
"");
182 epetraThyraModel =
rcp(
new Thyra::EpetraModelEvaluator());
184 epetraThyraModel->initialize(multiPointModel,lowsFactory);
191 solver.setModel(epetraThyraModel);
194 solver.readInitialGuess(out.
get());
197 const MoochoSolver::ESolutionStatus solution_status = solver.solve();
200 lowsfCreator.writeParamsFile(*lowsFactory);
201 solver.writeParamsFile();
207 return solution_status;
212 return MoochoSolver::SOLVE_RETURN_EXCEPTION;
217 cout <<
"NLPThyraEpetraModelEval4DOpt does nothing when HAVE_MPI is not defined" << endl;
virtual int FirstTimeStepOnDomain() const
virtual Epetra_Comm & SubDomainComm() const
RTOp_value_type value_type
virtual int NumTimeStepsOnDomain() const
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
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)
void set_p_bounds(double pL0, double pL1, double pU0, double pU1)
Universal interface to a MOOCHO solver.
int main(int argc, char *argv[])
void set_x_bounds(double xL0, double xL1, double xU0, double xU1)
Teuchos::RCP< const Epetra_Vector > get_x_init() const