42 #ifndef THYRA_SOLVE_SUPPORT_TYPES_HPP
43 #define THYRA_SOLVE_SUPPORT_TYPES_HPP
45 #include "Thyra_OperatorVectorTypes.hpp"
46 #include "Teuchos_ParameterList.hpp"
47 #include "Teuchos_FancyOStream.hpp"
48 #include "Teuchos_Describable.hpp"
81 switch(solveMeasureNormType) {
83 return "SOLVE_MEASURE_ONE";
85 return "SOLVE_MEASURE_NORM_RESIDUAL";
87 return "SOLVE_MEASURE_NORM_SOLUTION";
89 return "SOLVE_MEASURE_NORM_INIT_RESIDUAL";
91 return "SOLVE_MEASURE_NORM_RHS";
160 template<
class Scalar>
180 "Error, the vector v="<<v.
description()<<
" is not compatiable with"
311 template <
class Scalar>
360 template<
class Scalar>
363 out <<
typeName(solveCriteria) <<
"{";
406 switch(solveStatus) {
422 template <
class Scalar>
448 std::ostringstream oss; oss <<
achievedTol;
return oss.str();
457 template <
class Scalar>
461 out = Teuchos::getFancyOStream(Teuchos::rcp(&out_arg,
false));
467 if (solveStatus.
message.length()) {
469 *out <<
"\n" << solveStatus.
message <<
"\n";
471 *out <<
"extraParameters:";
511 template <
class Scalar>
536 template <
class Scalar>
549 overallSolveStatus->message = solveStatus.
message;
558 switch(overallSolveStatus->solveStatus) {
566 overallSolveStatus->message = solveStatus.
message;
578 if(overallSolveStatus->message ==
"")
579 overallSolveStatus->message = solveStatus.
message;
586 if( solveStatus.
achievedTol > overallSolveStatus->achievedTol ) {
587 overallSolveStatus->achievedTol = solveStatus.
achievedTol;
590 if(overallSolveStatus->message ==
"")
591 overallSolveStatus->message = solveStatus.
message;
593 if(overallSolveStatus->extraParameters.get()==NULL)
601 #endif // THYRA_SOLVE_SUPPORT_TYPES_HPP
Norm of the initial residual vector given a non-zero guess (i.e. ||A*xo-b||)
ESolveMeasureNormType
Type of solve measure norm.
bool contains(ESolveMeasureNormType measure) const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
How the output LOWSB object will be useded for solves in unspecified.
The output LOWSB object will only be used for forward solves.
ScalarMag requestedTol
The requested solve tolerance (what the client would like to see). Only significant if !...
The output LOWSB object will used for forward and transpose solves.
ESupportSolveUse
Enum that specifies how a LinearOpWithSolveBase object will be used for solves after it is constructe...
ESolveMeasureNormType numerator
virtual std::string description() const
The output LOWSB object will only be used for transpose solves.
bool useDefault() const
Return if this is a default solve measure (default constructed).
static ScalarMag unknownTolerance()
Norm of the right-hand side (i.e. ||b||)
std::string typeName(const T &t)
A general reduction functional to be used in specialized solve convergence criteria.
ScalarTraits< Scalar >::magnitudeType reduce(const VectorBase< Scalar > &v) const
Compute the reduction over a vector.
virtual bool isCompatibleImpl(const VectorBase< Scalar > &v) const =0
Thrown if vector spaces are incompatible.
static std::string achievedTolToString(const ScalarMag &achievedTol)
Output the achieveTol field.
The input preconditioner should just be applied as an operator.
std::ostream & operator<<(std::ostream &out_arg, const SolveStatus< Scalar > &solveStatus)
Print the solve status to a stream.
SolveCriteria(SolveMeasureType solveMeasureType_in, ScalarMag requestedTol_in, const RCP< ParameterList > &extraParameters_in=Teuchos::null, const RCP< ReductionFunctional< Scalar > > &numeratorReductionFunc_in=Teuchos::null, const RCP< ReductionFunctional< Scalar > > &denominatorReductionFunc_in=Teuchos::null)
Construct with a specified solve criteria.
EPreconditionerInputType
Enum defining the status of a preconditioner object.
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
No solve measure (i.e. same as 1.0)
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
ScalarMag achievedTol
The maximum final tolerance actually achieved by the (block) linear solve. A value of unknownToleranc...
void accumulateSolveStatusInit(const Ptr< SolveStatus< Scalar > > &overallSolveStatus)
Initial overallSolveStatus before calling accumulateSolveStatus().
The requested solution criteria has likely been achieved.
void set(ESolveMeasureNormType _numerator, ESolveMeasureNormType _denominator)
static ScalarMag unspecifiedTolerance()
The requested solution criteria has likely not been achieved.
Simple struct for the return status from a solve.
std::ostream & operator<<(std::ostream &out, const SolveCriteria< Scalar > &solveCriteria)
Output operator.
SolveMeasureType(ESolveMeasureNormType _numerator, ESolveMeasureNormType _denominator)
ESolveMeasureNormType denominator
SolveMeasureType solveMeasureType
The type of solve tolerance requested as given in this->requestedTol.
RCP< ParameterList > extraParameters
Any extra status parameters. Note that the contents of this parameter list is totally undefined.
const std::string toString(const ESolveStatus solveStatus)
RCP< const ReductionFunctional< Scalar > > denominatorReductionFunc
Reduction function to be used in place of the natural norm of the numerator.
Simple struct that defines the requested solution criteria for a solve.
bool nonnull(const boost::shared_ptr< T > &p)
bool isCompatible(const VectorBase< Scalar > &v) const
Returns true if v is compatible with *this.
Abstract interface for finite-dimensional dense vectors.
Norm of the current solution vector (i.e. ||x||)
RCP< ParameterList > extraParameters
Any extra control parameters (e.g. max iterations).
Exception type thrown on an catastrophic solve failure.
RCP< const ReductionFunctional< Scalar > > numeratorReductionFunc
Reduction function to be used in place of the natural norm of the numerator.
std::string message
A simple one-line message (i.e. no newlines) returned from the solver.
Norm of the current residual vector (i.e. ||A*x-b||)
The final solution status is unknown but he solve did not totally fail.
The input preconditioner should viewed as a matrix to be factored then backsolved as a preconditioner...
SolveCriteria()
Default construction to use default solve criteria.
ESolveStatus
Solution status.
virtual ScalarTraits< Scalar >::magnitudeType reduceImpl(const VectorBase< Scalar > &v) const =0
bool operator()(ESolveMeasureNormType numerator_in, ESolveMeasureNormType denominator_in) const
Return if (numerator,denominataor) matches this.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void accumulateSolveStatus(const SolveCriteria< Scalar >, const SolveStatus< Scalar > &solveStatus, const Ptr< SolveStatus< Scalar > > &overallSolveStatus)
Accumulate solve status objects for solving a block of RHSs is smaller sub-blocks.
std::ostream & operator<<(std::ostream &out, const SolveMeasureType &solveMeasureType)
Output operator.
ESolveStatus solveStatus
The return status of the solve.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)