48 #ifndef IFPACK2_DETAILS_LINEARSOLVER_DEF_HPP 
   49 #define IFPACK2_DETAILS_LINEARSOLVER_DEF_HPP 
   52 #include "Tpetra_MultiVector.hpp" 
   65 template<
class SC, 
class LO, 
class GO, 
class NT>
 
   69   solverName_ (solverName)
 
   72   using Teuchos::rcp_dynamic_cast;
 
   73   const char prefix[] = 
"Ifpack2::Details::LinearSolver: ";
 
   75                              prefix << 
"Input solver is NULL.");
 
   77   typedef Tpetra::RowMatrix<SC, LO, GO, NT> row_matrix_type;
 
   78   typedef ::Ifpack2::Details::CanChangeMatrix<row_matrix_type> mixin_type;
 
   79   RCP<mixin_type> innerSolver = rcp_dynamic_cast<mixin_type> (solver);
 
   81     (innerSolver.is_null (), std::invalid_argument, prefix << 
"The input " 
   82      "solver does not implement the setMatrix() feature.  Only Ifpack2 solvers " 
   83      "that inherit from Ifpack2::Details::CanChangeMatrix implement this feature.");
 
   86 template<
class SC, 
class LO, 
class GO, 
class NT>
 
   92   using Teuchos::rcp_dynamic_cast;
 
   93   typedef Tpetra::RowMatrix<SC, LO, GO, NT> row_matrix_type;
 
   94   typedef ::Ifpack2::Details::CanChangeMatrix<row_matrix_type> mixin_type;
 
   95   const char prefix[] = 
"Ifpack2::Details::LinearSolver::setMatrix: ";
 
  102   RCP<const row_matrix_type> A_row;
 
  104     A_row = rcp_dynamic_cast<
const row_matrix_type> (A);
 
  106       (A_row.is_null (), std::invalid_argument, prefix << 
"The input matrix A, " 
  107        "if not null, must be a Tpetra::RowMatrix.");
 
  110     (solver_.is_null (), std::logic_error, prefix << 
"Solver is NULL.  " 
  111      "This should never happen!  Please report this bug to the Ifpack2 " 
  114   RCP<mixin_type> innerSolver = rcp_dynamic_cast<mixin_type> (solver_);
 
  116     (innerSolver.is_null (), std::logic_error, prefix << 
"The solver does not " 
  117      "implement the setMatrix() feature.  Only input preconditioners that " 
  118      "inherit from Ifpack2::Details::CanChangeMatrix implement this.  We should" 
  119      " never get here!  Please report this bug to the Ifpack2 developers.");
 
  120   innerSolver->setMatrix (A_row);
 
  125 template<
class SC, 
class LO, 
class GO, 
class NT>
 
  132 template<
class SC, 
class LO, 
class GO, 
class NT>
 
  137   const char prefix[] = 
"Ifpack2::Details::LinearSolver::solve: ";
 
  139     (solver_.is_null (), std::logic_error, prefix << 
"The solver is NULL!  " 
  140      "This should never happen.  Please report this bug to the Ifpack2 " 
  143     (A_.is_null (), std::runtime_error, prefix << 
"The matrix has not been " 
  144      "set yet.  You must call setMatrix() with a nonnull matrix before you " 
  145      "may call this method.");
 
  146   solver_->apply (B, X);
 
  149 template<
class SC, 
class LO, 
class GO, 
class NT>
 
  154   solver_->setParameters (*params);
 
  157 template<
class SC, 
class LO, 
class GO, 
class NT>
 
  162   const char prefix[] = 
"Ifpack2::Details::LinearSolver::symbolic: ";
 
  164     (solver_.is_null (), std::logic_error, prefix << 
"The solver is NULL!  " 
  165      "This should never happen.  Please report this bug to the Ifpack2 " 
  168     (A_.is_null (), std::runtime_error, prefix << 
"The matrix has not been " 
  169      "set yet.  You must call setMatrix() with a nonnull matrix before you " 
  170      "may call this method.");
 
  171   solver_->initialize ();
 
  174 template<
class SC, 
class LO, 
class GO, 
class NT>
 
  179   const char prefix[] = 
"Ifpack2::Details::LinearSolver::numeric: ";
 
  181     (solver_.is_null (), std::logic_error, prefix << 
"The solver is NULL!  " 
  182      "This should never happen.  Please report this bug to the Ifpack2 " 
  185     (A_.is_null (), std::runtime_error, prefix << 
"The matrix has not been " 
  186      "set yet.  You must call setMatrix() with a nonnull matrix before you " 
  187      "may call this method.");
 
  191 template<
class SC, 
class LO, 
class GO, 
class NT>
 
  196   const char prefix[] = 
"Ifpack2::Details::LinearSolver::description: ";
 
  198     (solver_.is_null (), std::logic_error, prefix << 
"The solver is NULL!  " 
  199      "This should never happen.  Please report this bug to the Ifpack2 " 
  201   return solver_->description ();
 
  204 template<
class SC, 
class LO, 
class GO, 
class NT>
 
  210   const char prefix[] = 
"Ifpack2::Details::LinearSolver::describe: ";
 
  212     (solver_.is_null (), std::logic_error, prefix << 
"The solver is NULL!  " 
  213      "This should never happen.  Please report this bug to the Ifpack2 " 
  215   solver_->describe (out, verbLevel);
 
  224 #define IFPACK2_DETAILS_LINEARSOLVER_INSTANT(SC, LO, GO, NT) \ 
  225   template class Ifpack2::Details::LinearSolver<SC, LO, GO, NT>; 
  227 #endif // IFPACK2_DETAILS_LINEARSOLVER_DEF_HPP 
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
 
void solve(MV &X, const MV &B)
Solve the linear system AX=B for X. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:135
 
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const 
Implementation of Teuchos::Describable::describe. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:207
 
Teuchos::RCP< const OP > getMatrix() const 
Get the solver's matrix. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:128
 
void symbolic()
Precompute for matrix structure changes. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:160
 
void setMatrix(const Teuchos::RCP< const OP > &A)
Set the solver's matrix. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:89
 
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the solver's parameters. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:152
 
void numeric()
Precompute for matrix values' changes. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:177
 
Declaration of interface for preconditioners that can change their matrix after construction. 
 
std::string description() const 
Implementation of Teuchos::Describable::description. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:194
 
LinearSolver(const Teuchos::RCP< prec_type > &solver, const std::string &solverName)
Constructor. 
Definition: Ifpack2_Details_LinearSolver_def.hpp:67