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"
64template <
class Scalar>
119template <
class Scalar>
133template<
class Scalar>
140 paramList->validateParametersAndSetDefaults(*getValidParameters(),0);
141 paramList_ = paramList;
143 Teuchos::readVerboseObjectSublist(&*paramList_,
this);
145 paramList_->validateParameters(*getValidParameters(),0);
150template<
class Scalar>
158template<
class Scalar>
168template<
class Scalar>
176template<
class Scalar>
180 using Teuchos::setDoubleParameter;
using Teuchos::setIntParameter;
182 if (is_null(validPL)) {
184 pl = Teuchos::parameterList();
186 Teuchos::setupVerboseObjectSublist(&*pl);
196template <
class Scalar>
207template <
class Scalar>
215template <
class Scalar>
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";
303template <
class Scalar>
314template <
class Scalar>
Concrete nonlinear solver for linear equations.
RCP< const ModelEvaluator< Scalar > > getModel() const
RCP< LinearOpWithSolveBase< Scalar > > get_nonconst_W(const bool forceUpToDate)
RCP< const LinearOpWithSolveBase< Scalar > > get_W() const
void setParameterList(RCP< Teuchos::ParameterList > const ¶mList)
void setModel(const RCP< const ModelEvaluator< Scalar > > &model)
RCP< Teuchos::ParameterList > getNonconstParameterList()
RCP< const Teuchos::ParameterList > getValidParameters() const
RCP< Teuchos::ParameterList > unsetParameterList()
RCP< const Teuchos::ParameterList > getParameterList() const
RCP< LinearNonlinearSolver< Scalar > > linearNonlinearSolver()
SolveStatus< Scalar > solve(VectorBase< Scalar > *x, const SolveCriteria< Scalar > *solveCriteria, VectorBase< Scalar > *delta)
Base class for all linear operators that can support a high-level solve operation.
Base subclass for ModelEvaluator that defines some basic types.
Pure abstract base interface for evaluating a stateless "model" that can be mapped into a number of d...
Base class for all nonlinear equation solvers.
Abstract interface for finite-dimensional dense vectors.
virtual RCP< const VectorSpaceBase< Scalar > > space() const =0
Return a smart pointer to the vector space that this vector belongs to.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
#define THYRA_ASSERT_VEC_SPACES(FUNC_NAME, VS1, VS2)
This is a very useful macro that should be used to validate that two vector spaces are compatible.
@ NOTRANS
Use the non-transposed operator.
TypeTo as(const TypeFrom &t)
T_To & dyn_cast(T_From &from)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOSCORE_LIB_DLL_EXPORT EVerbosityLevel incrVerbLevel(const EVerbosityLevel inputVerbLevel, const int numLevels)
Simple struct that defines the requested solution criteria for a solve.
Simple struct for the return status from a solve.