42 #ifndef THYRA_LINEAR_NONLINEAR_SOLVER_BASE_HPP
43 #define THYRA_LINEAR_NONLINEAR_SOLVER_BASE_HPP
46 #include "Thyra_NonlinearSolverBase.hpp"
47 #include "Thyra_ModelEvaluatorHelpers.hpp"
48 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
49 #include "Teuchos_StandardParameterEntryValidators.hpp"
50 #include "Teuchos_as.hpp"
64 template <
class Scalar>
119 template <
class Scalar>
133 template<
class Scalar>
141 paramList_ = paramList;
143 Teuchos::readVerboseObjectSublist(&*paramList_,
this);
145 paramList_->validateParameters(*getValidParameters(),0);
146 #endif // TEUCHOS_DEBUG
150 template<
class Scalar>
158 template<
class Scalar>
163 paramList_ = Teuchos::null;
168 template<
class Scalar>
176 template<
class Scalar>
180 using Teuchos::setDoubleParameter;
using Teuchos::setIntParameter;
184 pl = Teuchos::parameterList();
186 Teuchos::setupVerboseObjectSublist(&*pl);
196 template <
class Scalar>
207 template <
class Scalar>
215 template <
class Scalar>
224 using Teuchos::incrVerbLevel;
225 using Teuchos::describe;
229 using Teuchos::getFancyOStream;
239 "TimeStepNonlinearSolver<Scalar>::solve(...)",
240 *x->
space(),*model_->get_x_space() );
242 0!=solveCriteria &&
"ToDo: Support passed in solve criteria!" );
250 VOTSME stateModel_outputTempState(model_,out,
incrVerbLevel(verbLevel,-1));
251 if(out.
get() && showTrace)
253 <<
"\nEntering LinearNonlinearSolver::solve(...) ...\n"
254 <<
"\nmodel = " << describe(*model_,verbLevel);
256 if(out.
get() && dumpAll) {
257 *out <<
"\nInitial guess:\n";
258 *out <<
"\nx = " << *x;
262 if(!J_.get()) J_ = model_->create_W();
264 f = createMember(model_->get_f_space());
265 if(out.
get() && showTrace)
266 *out <<
"\nEvaluating the model f and W ...\n";
267 eval_f_W( *model_, *x, &*f, &*J_ );
271 dx = createMember(model_->get_x_space());
272 if(out.
get() && showTrace)
273 *out <<
"\nSolving the system J*dx = -f ...\n";
274 VOTSLOWSB J_outputTempState(J_,out,
incrVerbLevel(verbLevel,-1));
275 assign( dx.
ptr(), ST::zero() );
277 linearSolveStatus = J_->solve(
NOTRANS, *f, dx.
ptr() );
278 if(out.
get() && showTrace)
279 *out <<
"\nLinear solve status:\n" << linearSolveStatus;
280 Vt_S( dx.
ptr(), Scalar(-ST::one()) );
281 if(out.
get() && dumpAll)
282 *out <<
"\ndx = " << Teuchos::describe(*dx,verbLevel);
284 Thyra::assign( ptr(delta), *dx );
285 if(out.
get() && dumpAll)
286 *out <<
"\ndelta = " << Teuchos::describe(*delta,verbLevel);
291 if(out.
get() && dumpAll)
292 *out <<
"\nUpdated solution x = " << Teuchos::describe(*x,verbLevel);
294 if(out.
get() && showTrace)
295 *out <<
"\nLeaving LinearNonlinearSolver::solve(...) ...\n";
303 template <
class Scalar>
314 template <
class Scalar>
325 #endif // THYRA_LINEAR_NONLINEAR_SOLVER_BASE_HPP