44 #include "NLPInterfacePack_NLPFirstOrderThyraModelEvaluator.hpp"
50 #include "MoochoPack_MoochoThyraSolver.hpp"
51 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
52 #include "Thyra_EpetraModelEvaluator.hpp"
53 #include "Teuchos_RCP.hpp"
54 #include "Teuchos_GlobalMPISession.hpp"
55 #include "Teuchos_VerboseObject.hpp"
56 #include "Teuchos_CommandLineProcessor.hpp"
57 #include "Teuchos_StandardCatchMacros.hpp"
59 int main(
int argc,
char* argv[] )
63 typedef AbstractLinAlgPack::value_type Scalar;
67 bool dummySuccess =
true;
77 MoochoThyraSolver solver;
103 CommandLineProcessor clp(
false);
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 )
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));
184 epetraThyraModel->
initialize(multiPointModel,lowsFactory);
191 solver.setModel(epetraThyraModel);
194 solver.readInitialGuess(out.
get());
197 const MoochoSolver::ESolutionStatus solution_status = solver.solve();
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
void setupCLP(Teuchos::CommandLineProcessor *clp)
virtual Epetra_Comm & SubDomainComm() const
virtual int NumTimeStepsOnDomain() const
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
void readParameters(std::ostream *out)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RCP< Thyra::LinearOpWithSolveFactoryBase< double > > createLinearSolveStrategy(const std::string &linearSolveStrategyName) const
static RCP< FancyOStream > getDefaultOStream()
void initialize(const RCP< const EpetraExt::ModelEvaluator > &epetraModel, const RCP< LinearOpWithSolveFactoryBase< double > > &W_factory)
void writeParamsFile(const Thyra::LinearOpWithSolveFactoryBase< double > &lowsFactory, const std::string &outputXmlFileName="") const
void set_p_bounds(double pL0, double pL1, double pU0, double pU1)
void set_x_bounds(double xL0, double xL1, double xU0, double xU1)
#define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG)
Teuchos::RCP< const Epetra_Vector > get_x_init() const