47 #include "Teko_DiagonalPreconditionerFactory.hpp"
48 #include "Teko_DiagonalPreconditionerOp.hpp"
49 #include "Thyra_get_Epetra_Operator.hpp"
50 #include "Epetra_CrsMatrix.h"
51 #include "EpetraExt_PointToBlockDiagPermute.h"
53 #include "Teko_TpetraHelpers.hpp"
54 #include "Thyra_TpetraLinearOp.hpp"
61 DiagonalPrecondState::DiagonalPrecondState() {}
65 DiagonalPreconditionerFactory::DiagonalPreconditionerFactory() {}
74 if(diagonalType_==BlkDiag) {
78 TEUCHOS_TEST_FOR_EXCEPTION(TpetraHelpers::isTpetraLinearOp(lo),std::runtime_error,
"BlkDiag not implemented for Tpetra operators");
81 Teuchos::RCP<const Epetra_Operator> eo=Thyra::get_Epetra_Operator(*lo);
82 TEUCHOS_ASSERT(eo!=Teuchos::null);
83 Teuchos::RCP<const Epetra_CrsMatrix> MAT = Teuchos::rcp_dynamic_cast<
const Epetra_CrsMatrix>(eo);
84 TEUCHOS_ASSERT(MAT!=Teuchos::null);
87 Teuchos::RCP<EpetraExt_PointToBlockDiagPermute> BDP;
88 if(MyState.BDP_==Teuchos::null) {
89 BDP = Teuchos::rcp(
new EpetraExt_PointToBlockDiagPermute(*MAT));
90 BDP->SetParameters(
List_);
95 RCP<Epetra_FECrsMatrix> Hcrs=rcp(MyState.BDP_->CreateFECrsMatrix());
96 return Thyra::epetraLinearOp(Hcrs);
102 return getInvDiagonalOp(lo,diagonalType_);
109 diagonalType_ = BlkDiag;
110 if(pl.isParameter(
"Diagonal Type")) {
111 diagonalType_ = getDiagonalType(pl.get<std::string>(
"Diagonal Type"));
112 TEUCHOS_TEST_FOR_EXCEPT(diagonalType_==NotDiag);
115 if(diagonalType_==BlkDiag) {
117 Teuchos::ParameterList & SubList=
List_.sublist(
"blockdiagmatrix: list");
118 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