10 #include "Teko_DiagonalPreconditionerFactory.hpp"
11 #include "Teko_DiagonalPreconditionerOp.hpp"
12 #ifdef TEKO_HAVE_EPETRA
13 #include "Thyra_get_Epetra_Operator.hpp"
14 #include "Epetra_CrsMatrix.h"
15 #include "EpetraExt_PointToBlockDiagPermute.h"
18 #include "Teko_TpetraHelpers.hpp"
19 #ifdef TEKO_HAVE_EPETRA
20 #include "Thyra_EpetraLinearOp.hpp"
22 #include "Thyra_TpetraLinearOp.hpp"
29 DiagonalPrecondState::DiagonalPrecondState() {}
33 DiagonalPreconditionerFactory::DiagonalPreconditionerFactory() {}
41 if (diagonalType_ == BlkDiag) {
42 TEUCHOS_TEST_FOR_EXCEPTION(TpetraHelpers::isTpetraLinearOp(lo), std::runtime_error,
43 "BlkDiag not implemented for Tpetra operators");
44 #ifdef TEKO_HAVE_EPETRA
49 Teuchos::RCP<const Epetra_Operator> eo = Thyra::get_Epetra_Operator(*lo);
50 TEUCHOS_ASSERT(eo != Teuchos::null);
51 Teuchos::RCP<const Epetra_CrsMatrix> MAT =
52 Teuchos::rcp_dynamic_cast<
const Epetra_CrsMatrix>(eo);
53 TEUCHOS_ASSERT(MAT != Teuchos::null);
56 Teuchos::RCP<EpetraExt_PointToBlockDiagPermute> BDP;
57 if (MyState.BDP_ == Teuchos::null) {
58 BDP = Teuchos::rcp(
new EpetraExt_PointToBlockDiagPermute(*MAT));
59 BDP->SetParameters(
List_);
64 RCP<Epetra_FECrsMatrix> Hcrs = rcp(MyState.BDP_->CreateFECrsMatrix());
65 return Thyra::epetraLinearOp(Hcrs);
73 return getInvDiagonalOp(lo, diagonalType_);
79 diagonalType_ = BlkDiag;
80 if (pl.isParameter(
"Diagonal Type")) {
81 diagonalType_ = getDiagonalType(pl.get<std::string>(
"Diagonal Type"));
82 TEUCHOS_TEST_FOR_EXCEPT(diagonalType_ == NotDiag);
85 if (diagonalType_ == BlkDiag) {
87 Teuchos::ParameterList& SubList =
List_.sublist(
"blockdiagmatrix: list");
88 SubList.set(
"apply mode", SubList.get(
"apply mode",
"invert"));
Teuchos::RCP< PreconditionerState > buildPreconditionerState() const
Builds a preconditioner state object.
Teuchos::ParameterList List_
some members
virtual void initializeFromParameterList(const Teuchos::ParameterList &pl)
Initialize from a parameter list.
An implementation of a state object preconditioners.
LinearOp buildPreconditionerOperator(LinearOp &lo, PreconditionerState &state) const