45 #include "Thyra_DiagonalQuadraticResponseOnlyModelEvaluator.hpp"
46 #include "Thyra_VectorStdOps.hpp"
55 int main(
int argc,
char* argv[] )
61 typedef Thyra::Ordinal Ordinal;
69 bool dummySuccess =
true;
72 out = Teuchos::VerboseObjectBase::getDefaultOStream();
81 MoochoThyraSolver solver;
88 CommandLineProcessor clp;
89 clp.throwExceptions(
false);
90 clp.addOutputSetupOptions(
true);
93 clp.setOption(
"local-dim", &localDim);
96 clp.setOption(
"ps", &ps);
99 clp.setOption(
"p0", &p0);
101 double condNum = 1.0;
102 clp.setOption(
"cond-num", &condNum);
104 double nonlinearTermFactor = 1e-3;
105 clp.setOption(
"nonlinear-term-factor", &nonlinearTermFactor);
107 double g_offset = 10.0;
108 clp.setOption(
"g-offset", &g_offset);
110 solver.setupCLP(&clp);
112 CommandLineProcessor::EParseCommandLineReturn
113 parse_return = clp.parse(argc,argv,&std::cerr);
115 if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
118 solver.readParameters( out.
get() );
120 const RCP<const Teuchos::Comm<Ordinal> > comm =
127 *out <<
"\nCreate Thyra::DiagonalQuadraticResponseOnlyModelEvaluator object ...\n";
130 thyraModel = Thyra::diagonalQuadraticResponseOnlyModelEvaluator<double> (localDim, comm);
132 const RCP<Thyra::VectorBase<double> > ps_vec = createMember(thyraModel->get_p_space(0));
133 Thyra::V_S<double>(ps_vec.ptr(), ps);
134 thyraModel->setSolutionVector(ps_vec);
140 thyraModel->setNonlinearTermFactor(nonlinearTermFactor);
142 thyraModel->setScalarOffset(g_offset);
149 solver.setModel(thyraModel);
152 solver.readInitialGuess(out.
get());
155 const MoochoSolver::ESolutionStatus solution_status = solver.solve();
158 solver.writeFinalSolution(out.
get());
161 solver.writeParamsFile();
167 if(solution_status == MoochoSolver::SOLVE_RETURN_SOLVED)
168 *out <<
"\nEnd Result: TEST PASSED\n";
170 *out <<
"\nEnd Result: TEST FAILED\n";
172 return solution_status;
177 return MoochoSolver::SOLVE_RETURN_EXCEPTION;
static Teuchos::RCP< const Comm< OrdinalType > > getComm()
MOOCHO NLP Solver class for models represented through Thyra::ModelEvaluator.
basic_OSTab< char > OSTab
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.
int main(int argc, char *argv[])