11 #include "Thyra_MultiVectorStdOps.hpp"
22 template<
typename Scalar>
27 template<
typename Scalar>
30 const Teuchos::RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
36 this->initialize(fwdOp,fwdOpSrc,amesos2Solver);
40 template<
typename Scalar>
43 const Teuchos::RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
49 amesos2Solver_ = amesos2Solver;
50 const std::string fwdOpLabel = fwdOp_->getObjectLabel();
51 if(fwdOpLabel.length())
52 this->setObjectLabel(
"lows("+fwdOpLabel+
")" );
56 template<
typename Scalar>
61 _fwdOpSrc = fwdOpSrc_;
70 template<
typename Scalar>
78 template<
typename Scalar>
86 template<
typename Scalar>
97 template<
typename Scalar>
100 std::ostringstream oss;
104 <<
"{fwdOp="<<fwdOp_->description()
105 <<
",amesos2Solver="<<
typeName(*amesos2Solver_)<<
"}";
111 template<
typename Scalar>
119 using Teuchos::describe;
123 out << this->description() << std::endl;
131 <<
"rangeDim=" << this->range()->dim()
132 <<
",domainDim="<< this->domain()->dim() <<
"}\n";
135 out <<
"fwdOp = " << describe(*fwdOp_,verbLevel);
138 out <<
"amesos2Solver=" <<
typeName(*amesos2Solver_) <<
"\n";
154 template<
typename Scalar>
157 return ::Thyra::opSupported(*fwdOp_,M_trans);
161 template<
typename Scalar>
163 const EOpTransp M_trans,
164 const MultiVectorBase<Scalar> &X,
165 const Ptr<MultiVectorBase<Scalar> > &Y,
170 Thyra::apply( *fwdOp_, M_trans, X, Y, alpha, beta );
176 template<
typename Scalar>
179 if (Thyra::real_trans(M_trans) == Thyra::NOTRANS) {
188 template<
typename Scalar>
190 EOpTransp ,
const SolveMeasureType&
197 template<
typename Scalar>
201 const MultiVectorBase<Scalar> &
B,
202 const Ptr<MultiVectorBase<Scalar> > &X,
203 const Ptr<
const SolveCriteria<Scalar> >
206 auto Btpetra = ConverterT::getConstTpetraMultiVector(Teuchos::rcpFromRef(B));
208 auto Xtpetra = ConverterT::getTpetraMultiVector(Teuchos::rcpFromPtr(X));
214 *out <<
"\nSolving system using Amesos2 solver "
215 <<
typeName(*amesos2Solver_) <<
" ...\n\n";
217 amesos2Solver_->solve(Xtpetra.ptr(), Btpetra.ptr());
219 SolveStatus<Scalar> solveStatus;
220 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...