48#ifndef IFPACK2_DETAILS_LINEARSOLVERFACTORY_DEF_HPP
49#define IFPACK2_DETAILS_LINEARSOLVERFACTORY_DEF_HPP
51#include "Trilinos_Details_LinearSolverFactory.hpp"
53#include "Ifpack2_Details_LinearSolver.hpp"
54#include "Ifpack2_Factory.hpp"
55#include "Tpetra_RowMatrix.hpp"
61template<
class SC,
class LO,
class GO,
class NT>
62Teuchos::RCP<typename LinearSolverFactory<SC, LO, GO, NT>::solver_type>
68 using Teuchos::rcp_dynamic_cast;
69 using Teuchos::TypeNameTraits;
71 typedef Tpetra::RowMatrix<SC, LO, GO, NT>
ROW;
72 const char prefix[] =
"Ifpack2::Details::LinearSolverFactory::getLinearSolver: ";
82 catch (std::exception&
e) {
84 (
true, std::invalid_argument,
prefix <<
"Failed to create Ifpack2 "
85 "preconditioner named \"" <<
solverName <<
"\", for the following "
86 "template parameters: "
91 <<
". Ifpack2::Factory::create threw an exception: " <<
e.what ());
94 (
solver.is_null (), std::invalid_argument,
prefix <<
"Failed to create "
95 "Ifpack2 preconditioner named \"" <<
solverName <<
"\", for the "
96 "following template parameters: "
101 <<
". Ifpack2::Factory::create returned null.");
107template<
class SC,
class LO,
class GO,
class NT>
112 typedef Tpetra::MultiVector<SC, LO, GO, NT> MV;
113 typedef Tpetra::Operator<SC, LO, GO, NT> OP;
114 typedef typename MV::mag_type mag_type;
115 typedef Trilinos::Details::LinearSolverFactory<MV, OP, mag_type>
factory_base_type;
118#ifdef HAVE_TEUCHOSCORE_CXX11
130 (
factoryBase.get () ==
NULL, std::logic_error,
"Factory is null! This "
131 "should never happen! Please report this bug to the Ifpack2 developers.");
147 Trilinos::Details::registerLinearSolverFactory<MV, OP, mag_type> (
"Ifpack2",
factoryBase);
155#define IFPACK2_DETAILS_LINEARSOLVERFACTORY_INSTANT( SC, LO, GO, NT ) \
156 template class Ifpack2::Details::LinearSolverFactory<SC, LO, GO, NT>;
Declaration of interface for preconditioners that can change their matrix after construction.
virtual Teuchos::RCP< solver_type > getLinearSolver(const std::string &solverName)
Get an instance of a Ifpack2 solver.
Definition Ifpack2_Details_LinearSolverFactory_def.hpp:64
static void registerLinearSolverFactory()
Register this LinearSolverFactory with the central registry.
Definition Ifpack2_Details_LinearSolverFactory_def.hpp:110
Ifpack2's implementation of Trilinos::Details::LinearSolver interface.
Definition Ifpack2_Details_LinearSolver_decl.hpp:110
Interface for all Ifpack2 preconditioners.
Definition Ifpack2_Preconditioner.hpp:108
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:73