46 #include <Xpetra_Matrix.hpp> 47 #include <Xpetra_CrsMatrixWrap.hpp> 48 #include <Xpetra_BlockedCrsMatrix.hpp> 49 #include <Xpetra_EpetraMultiVector.hpp> 53 #include "MueLu_Utilities.hpp" 60 const Xpetra::EpetraMultiVector eX(rcpFromRef(const_cast<Epetra_MultiVector&>(X)));
61 Xpetra::EpetraMultiVector eY(rcpFromRef(Y));
64 if (X.Values() == Y.Values()) {
66 RCP<Xpetra::EpetraMultiVector> tmpY = Teuchos::rcp(
new Xpetra::EpetraMultiVector(eY.getMap(), eY.getNumVectors()));
70 bool initialGuessZero =
true;
74 Hierarchy_->Iterate(eX, *tmpY, 1, initialGuessZero);
77 eY.update(1.0, *tmpY, 0.0);
84 bool initialGuessZero =
true;
87 Hierarchy_->Iterate(eX, eY, 1, initialGuessZero);
90 }
catch (std::exception& e) {
92 std::cerr <<
"Caught an exception in MueLu::EpetraOperator::ApplyInverse():" << std::endl
93 << e.what() << std::endl;
101 RCP<Matrix> A =
Hierarchy_->GetLevel(0)->Get<RCP<Matrix> >(
"A");
104 RCP<Xpetra::BlockedCrsMatrix<double, int, int> > epbA = Teuchos::rcp_dynamic_cast<Xpetra::BlockedCrsMatrix<double, int, int> >(A);
105 if (epbA != Teuchos::null) {
106 RCP<const Xpetra::EpetraCrsMatrix> tmp_ECrsMtx = rcp_dynamic_cast<Xpetra::EpetraCrsMatrix >(epbA->getMatrix(0,0));
107 if (tmp_ECrsMtx == Teuchos::null)
108 throw Exceptions::BadCast(
"Cast from Xpetra::CrsMatrix to Xpetra::EpetraCrsMatrix failed");
110 RCP<Epetra_CrsMatrix> epA = tmp_ECrsMtx->getEpetra_CrsMatrixNonConst();
119 RCP<Matrix> A =
Hierarchy_->GetLevel(0)->Get<RCP<Matrix> >(
"A");
121 RCP<Xpetra::BlockedCrsMatrix<double, int, int> > epbA = Teuchos::rcp_dynamic_cast<Xpetra::BlockedCrsMatrix<double, int, int> >(A);
122 if (epbA != Teuchos::null)
123 return Xpetra::toEpetra(epbA->getDomainMap());
126 return epA->DomainMap();
130 RCP<Matrix> A =
Hierarchy_->GetLevel(0)->Get<RCP<Matrix> >(
"A");
132 RCP<Xpetra::BlockedCrsMatrix<double, int, int> > epbA = Teuchos::rcp_dynamic_cast<Xpetra::BlockedCrsMatrix<double, int, int> >(A);
133 if (epbA != Teuchos::null)
134 return Xpetra::toEpetra(epbA->getRangeMap());
137 return epA->RangeMap();
Exception indicating invalid cast attempted.
Namespace for MueLu classes and methods.
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y...
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
static RCP< Epetra_CrsMatrix > Op2NonConstEpetraCrs(RCP< Matrix > Op)
RCP< Hierarchy > Hierarchy_