10 #include "Teko_DiagonalPreconditionerOp.hpp"
11 #include "Thyra_EpetraThyraWrappers.hpp"
12 #include "EpetraExt_PointToBlockDiagPermute.h"
13 #include "Epetra_MultiVector.h"
16 using Teuchos::rcp_const_cast;
17 using Teuchos::rcp_dynamic_cast;
18 using Teuchos::rcpFromRef;
20 using Thyra::MultiVectorBase;
24 DiagonalPreconditionerOp::DiagonalPreconditionerOp(
25 Teuchos::RCP<EpetraExt_PointToBlockDiagPermute> BDP,
const VectorSpace range,
26 const VectorSpace domain)
27 : BDP_(BDP), range_(range), domain_(domain) {}
29 void DiagonalPreconditionerOp::implicitApply(
const MultiVector& x, MultiVector& y,
30 const double alpha,
const double beta)
const {
33 const Epetra_Map& rangemap_ = BDP_->OperatorRangeMap();
34 const Epetra_Map& domainmap_ = BDP_->OperatorDomainMap();
36 RCP<const Epetra_MultiVector> x_ = Thyra::get_Epetra_MultiVector(domainmap_, x);
37 RCP<Epetra_MultiVector> y_ = Thyra::get_Epetra_MultiVector(rangemap_, y);
38 TEUCHOS_ASSERT(x_ != Teuchos::null);
39 TEUCHOS_ASSERT(y_ != Teuchos::null);
43 BDP_->ApplyInverse(*x_, *y_);
46 MultiVector y0 = deepcopy(y);
47 BDP_->ApplyInverse(*x_, *y_);
48 update(alpha, y, beta, y0);
52 void DiagonalPreconditionerOp::describe(Teuchos::FancyOStream& out_arg,
53 const Teuchos::EVerbosityLevel verbLevel)
const {
57 case Teuchos::VERB_DEFAULT:
58 case Teuchos::VERB_LOW: out_arg << this->description() << std::endl;
break;
59 case Teuchos::VERB_MEDIUM:
60 case Teuchos::VERB_HIGH:
61 case Teuchos::VERB_EXTREME:
62 if (BDP_ != Teuchos::null) BDP_->Print(out_arg);
64 default: TEUCHOS_TEST_FOR_EXCEPT(
true);