10#ifndef THYRA_LINEAR_NONLINEAR_SOLVER_BASE_HPP
11#define THYRA_LINEAR_NONLINEAR_SOLVER_BASE_HPP
14#include "Thyra_NonlinearSolverBase.hpp"
15#include "Thyra_ModelEvaluatorHelpers.hpp"
16#include "Teuchos_VerboseObjectParameterListHelpers.hpp"
17#include "Teuchos_StandardParameterEntryValidators.hpp"
32template <
class Scalar>
87template <
class Scalar>
101template<
class Scalar>
109 paramList_ = paramList;
111 Teuchos::readVerboseObjectSublist(&*paramList_,
this);
118template<
class Scalar>
126template<
class Scalar>
131 paramList_ = Teuchos::null;
136template<
class Scalar>
144template<
class Scalar>
148 using Teuchos::setDoubleParameter;
using Teuchos::setIntParameter;
150 if (is_null(validPL)) {
152 pl = Teuchos::parameterList();
154 Teuchos::setupVerboseObjectSublist(&*pl);
164template <
class Scalar>
175template <
class Scalar>
183template <
class Scalar>
193 using Teuchos::describe;
197 using Teuchos::getFancyOStream;
207 "TimeStepNonlinearSolver<Scalar>::solve(...)",
208 *x->
space(),*model_->get_x_space() );
210 0!=solveCriteria &&
"ToDo: Support passed in solve criteria!" );
218 VOTSME stateModel_outputTempState(model_,out,incrVerbLevel(verbLevel,-1));
219 if(out.
get() && showTrace)
221 <<
"\nEntering LinearNonlinearSolver::solve(...) ...\n"
222 <<
"\nmodel = " <<
describe(*model_,verbLevel);
224 if(out.
get() && dumpAll) {
225 *out <<
"\nInitial guess:\n";
226 *out <<
"\nx = " << *x;
230 if(!J_.get()) J_ = model_->create_W();
233 if(out.
get() && showTrace)
234 *out <<
"\nEvaluating the model f and W ...\n";
235 eval_f_W( *model_, *x, &*f, &*J_ );
240 if(out.
get() && showTrace)
241 *out <<
"\nSolving the system J*dx = -f ...\n";
242 VOTSLOWSB J_outputTempState(J_,out,incrVerbLevel(verbLevel,-1));
245 linearSolveStatus = J_->solve(
NOTRANS, *f, dx.
ptr() );
246 if(out.
get() && showTrace)
247 *out <<
"\nLinear solve status:\n" << linearSolveStatus;
248 Vt_S( dx.
ptr(), Scalar(-ST::one()) );
249 if(out.
get() && dumpAll)
250 *out <<
"\ndx = " << Teuchos::describe(*dx,verbLevel);
253 if(out.
get() && dumpAll)
254 *out <<
"\ndelta = " << Teuchos::describe(*delta,verbLevel);
259 if(out.
get() && dumpAll)
260 *out <<
"\nUpdated solution x = " << Teuchos::describe(*x,verbLevel);
262 if(out.
get() && showTrace)
263 *out <<
"\nLeaving LinearNonlinearSolver::solve(...) ...\n";
271template <
class Scalar>
282template <
class Scalar>
virtual void describe(FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
virtual RCP< FancyOStream > getOStream() const
virtual EVerbosityLevel getVerbLevel() const
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...
void assign(const Ptr< MultiVectorBase< Scalar > > &V, Scalar alpha)
V = alpha.
void Vt_S(const Ptr< MultiVectorBase< Scalar > > &Z, const Scalar &alpha)
Z(i,j) *= alpha, i = 0...Z->range()->dim()-1, j = 0...Z->domain()->dim()-1.
void Vp_V(const Ptr< MultiVectorBase< Scalar > > &Z, const MultiVectorBase< Scalar > &X)
Z(i,j) += X(i,j), i = 0...Z->range()->dim()-1, j = 0...Z->domain()->dim()-1.
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.
RCP< VectorBase< Scalar > > createMember(const RCP< const VectorSpaceBase< Scalar > > &vs, const std::string &label="")
Create a vector member from the vector space.
#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
Type for the dimension of a vector space. `**/ typedef Teuchos::Ordinal Ordinal;.
TypeTo as(const TypeFrom &t)
basic_OSTab< char > OSTab
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.