Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_PreconditionerFactory.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
13 #include "Teuchos_Assert.hpp"
14 
16 PreconditionerFactory(const std::string& prec_name,
18 {
19  if (prec_name == "Ifpack")
20  factory =
22  else if (prec_name == "ML")
23  factory =
25  else
26  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
27  "Error! Unknown preconditioner type " << prec_name
28  << ". Valid choices are \"Ifpack\" and \"ML\".");
29 }
30 
33 compute(const Teuchos::RCP<Epetra_Operator>& mat, bool compute_prec)
34 {
35  return factory->compute(mat, compute_prec);
36 }
37 
38 void
42 {
43  factory->recompute(mat, prec);
44 }
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
A factory for building ML preconditioners.
virtual Teuchos::RCP< Epetra_Operator > compute(const Teuchos::RCP< Epetra_Operator > &mat, bool compute_prec=true)
Compute preconditioner operator.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual void recompute(const Teuchos::RCP< Epetra_Operator > &mat, const Teuchos::RCP< Epetra_Operator > &prec)
Recompute preconditioner operator for a new matrix.
A factory for building Ifpack preconditioners.
PreconditionerFactory(const std::string &prec_name, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor.
Teuchos::RCP< Stokhos::AbstractPreconditionerFactory > factory
Preconditioner factory.