10 #include "Teko_ProbingPreconditionerFactory.hpp"
12 #ifdef Teko_ENABLE_Isorropia
14 #include "Teko_EpetraOperatorWrapper.hpp"
16 #include "Thyra_get_Epetra_Operator.hpp"
17 #include "Thyra_EpetraLinearOp.hpp"
18 #include "Epetra_CrsMatrix.h"
22 using Teuchos::rcp_dynamic_cast;
23 using Teuchos::rcpFromRef;
29 ProbingPreconditionerFactory::ProbingPreconditionerFactory() {
30 prober = rcp(
new Isorropia::Epetra::Prober);
33 LinearOp ProbingPreconditionerFactory::buildPreconditionerOperator(
34 LinearOp& lo, PreconditionerState& state)
const {
42 RCP<Epetra_CrsMatrix> retOp = prober->probe(*epetraLo);
43 Teko::LinearOp probedOp = Thyra::epetraLinearOp(retOp);
48 void ProbingPreconditionerFactory::initializeFromParameterList(
const Teuchos::ParameterList& pl) {
49 RCP<const InverseLibrary> invLib = getInverseLibrary();
51 const std::string inverse_type =
"Inverse Type";
52 const std::string probing_graph_operator =
"Probing Graph Operator";
53 const std::string probing_graph =
"Probing Graph";
54 const std::string user_graph =
"User Will Set Probing Graph";
57 std::string invStr =
"Amesos";
58 if (pl.isParameter(inverse_type)) invStr = pl.get<std::string>(inverse_type);
60 if (pl.isParameter(probing_graph_operator))
61 setGraphOperator(pl.get<Teko::LinearOp>(probing_graph_operator));
62 else if (pl.isParameter(probing_graph))
63 setGraph(pl.get<RCP<const Epetra_CrsGraph> >(probing_graph));
64 else if (pl.isParameter(user_graph) && pl.get<
bool>(
"User Will Set Probing Graph")) {
67 Teuchos::RCP<Teko::RequestHandler> rh = getRequestHandler();
68 rh->preRequest<RCP<const Epetra_CrsGraph> >(Teko::RequestMesg(
"Probing Graph"));
69 setGraph(rh->request<RCP<const Epetra_CrsGraph> >(Teko::RequestMesg(
"Probing Graph")));
72 setInverseFactory(invLib->getInverseFactory(invStr));
75 void ProbingPreconditionerFactory::setGraphOperator(
const Teko::LinearOp& graphOp) {
76 RCP<const Epetra_CrsMatrix> crsMatrix =
77 rcp_dynamic_cast<
const Epetra_CrsMatrix>(Thyra::get_Epetra_Operator(*graphOp));
78 setGraph(Teuchos::rcpFromRef(crsMatrix->Graph()));
81 void ProbingPreconditionerFactory::setGraph(
const Teuchos::RCP<const Epetra_CrsGraph>& graph) {
82 prober->setGraph(graph);
85 void ProbingPreconditionerFactory::setProberList(
const Teuchos::ParameterList& list) {
86 prober->setList(list);
Implements the Epetra_Operator interface with a Thyra LinearOperator. This enables the use of absrtac...
InverseLinearOp buildInverse(const InverseFactory &factory, const LinearOp &A)
Build an inverse operator using a factory and a linear operator.