45 #include "Thyra_MultiVectorStdOps.hpp"
56 template<
typename Scalar>
61 template<
typename Scalar>
64 const Teuchos::RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
70 this->initialize(fwdOp,fwdOpSrc,amesos2Solver);
74 template<
typename Scalar>
77 const Teuchos::RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
83 amesos2Solver_ = amesos2Solver;
84 const std::string fwdOpLabel = fwdOp_->getObjectLabel();
85 if(fwdOpLabel.length())
86 this->setObjectLabel(
"lows("+fwdOpLabel+
")" );
90 template<
typename Scalar>
95 _fwdOpSrc = fwdOpSrc_;
104 template<
typename Scalar>
112 template<
typename Scalar>
120 template<
typename Scalar>
131 template<
typename Scalar>
134 std::ostringstream oss;
138 <<
"{fwdOp="<<fwdOp_->description()
139 <<
",amesos2Solver="<<
typeName(*amesos2Solver_)<<
"}";
145 template<
typename Scalar>
153 using Teuchos::describe;
157 out << this->description() << std::endl;
165 <<
"rangeDim=" << this->range()->dim()
166 <<
",domainDim="<< this->domain()->dim() <<
"}\n";
169 out <<
"fwdOp = " << describe(*fwdOp_,verbLevel);
172 out <<
"amesos2Solver=" <<
typeName(*amesos2Solver_) <<
"\n";
188 template<
typename Scalar>
191 return ::Thyra::opSupported(*fwdOp_,M_trans);
195 template<
typename Scalar>
197 const EOpTransp M_trans,
198 const MultiVectorBase<Scalar> &X,
199 const Ptr<MultiVectorBase<Scalar> > &Y,
204 Thyra::apply( *fwdOp_, M_trans, X, Y, alpha, beta );
210 template<
typename Scalar>
213 if (Thyra::real_trans(M_trans) == Thyra::NOTRANS) {
222 template<
typename Scalar>
224 EOpTransp ,
const SolveMeasureType&
231 template<
typename Scalar>
235 const MultiVectorBase<Scalar> &
B,
236 const Ptr<MultiVectorBase<Scalar> > &X,
237 const Ptr<
const SolveCriteria<Scalar> >
240 auto Btpetra = ConverterT::getConstTpetraMultiVector(Teuchos::rcpFromRef(B));
242 auto Xtpetra = ConverterT::getTpetraMultiVector(Teuchos::rcpFromPtr(X));
248 *out <<
"\nSolving system using Amesos2 solver "
249 <<
typeName(*amesos2Solver_) <<
" ...\n\n";
251 amesos2Solver_->solve(Xtpetra.ptr(), Btpetra.ptr());
253 SolveStatus<Scalar> solveStatus;
254 solveStatus.solveStatus = SOLVE_STATUS_CONVERGED;
virtual bool solveSupportsSolveMeasureTypeImpl(EOpTransp M_trans, const SolveMeasureType &solveMeasureType) const
void initialize(const Teuchos::RCP< const LinearOpBase< Scalar > > &fwdOp, const Teuchos::RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const Teuchos::RCP< Solver > &amesos2Solver)
Initialize after construction.
std::string typeName(const T &t)
SolveStatus< Scalar > solveImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &B, const Ptr< MultiVectorBase< Scalar > > &X, const Ptr< const SolveCriteria< Scalar > > solveCriteria) const
bool is_null(const boost::shared_ptr< T > &p)
virtual void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
std::string description() const
virtual bool opSupportedImpl(EOpTransp M_trans) const
basic_OSTab< char > OSTab
Teuchos::RCP< const VectorSpaceBase< Scalar > > domain() const
Teuchos::RCP< const LinearOpBase< Scalar > > clone() const
virtual std::string description() const
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Teuchos::RCP< const VectorSpaceBase< Scalar > > range() const
virtual bool solveSupportsImpl(EOpTransp M_trans) const
Amesos2LinearOpWithSolve()
Construct to uninitialized.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Teuchos::RCP< const LinearOpSourceBase< Scalar > > extract_fwdOpSrc()
Extract the forward LinearOpSourceBase<double> object so that it can be modified and remove it from t...