46 #ifndef MUELU_IFPACK2SMOOTHER_DECL_HPP
47 #define MUELU_IFPACK2SMOOTHER_DECL_HPP
49 #include <Teuchos_ParameterList.hpp>
51 #include <Xpetra_BlockedCrsMatrix_fwd.hpp>
52 #include <Xpetra_CrsMatrixWrap.hpp>
53 #include <Xpetra_Matrix_fwd.hpp>
54 #include <Xpetra_Matrix.hpp>
55 #include <Xpetra_MultiVectorFactory_fwd.hpp>
56 #ifdef HAVE_XPETRA_TPETRA
57 #include <Xpetra_TpetraCrsMatrix.hpp>
63 #if defined(HAVE_MUELU_TPETRA) && defined(HAVE_MUELU_IFPACK2)
65 #include <Tpetra_CrsMatrix.hpp>
67 #include <Ifpack2_Factory_decl.hpp>
68 #include <Ifpack2_Factory_def.hpp>
74 #include "MueLu_SmootherPrototype.hpp"
89 template <class Scalar = SmootherPrototype<>::scalar_type,
94 #undef MUELU_IFPACK2SMOOTHER_SHORT
139 template<
class Scalar2,
class LocalOrdinal2,
class GlobalOrdinal2,
class Node2>
143 Ifpack2Smoother(
const std::string& type,
const Teuchos::ParameterList& paramList = Teuchos::ParameterList(),
const LO& overlap = 0);
179 void Apply(MultiVector& X,
const MultiVector& B,
bool InitialGuessIsZero =
false)
const;
186 RCP<SmootherPrototype>
Copy()
const;
190 #ifdef HAVE_MUELU_DEPRECATED_CODE
192 template<
typename Node2>
193 RCP<MueLu::Ifpack2Smoother<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
195 clone(
const RCP<Node2>& node2,
const Teuchos::RCP<
const Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >& A_newnode)
const;
218 void SetPrecParameters(
const Teuchos::ParameterList& list = Teuchos::ParameterList())
const;
236 RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
prec_;
243 #ifdef HAVE_MUELU_DEPRECATED_CODE
244 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
245 template<
typename Node2>
246 RCP<MueLu::Ifpack2Smoother<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
249 #ifdef HAVE_XPETRA_TPETRA
250 const ParameterList& paramList = this->GetParameterList();
251 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> Matrix1;
252 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> Matrix2;
253 RCP<Ifpack2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > cloneSmoother =
257 RCP<const Xpetra::CrsMatrixWrap<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > crsOp =
258 rcp_dynamic_cast<const Xpetra::CrsMatrixWrap<Scalar, LocalOrdinal, GlobalOrdinal, Node2> >(A_newnode);
259 const RCP<const Xpetra::TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node2> >& tmp =
260 rcp_dynamic_cast<const Xpetra::TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node2> >(crsOp->getCrsMatrix());
263 cloneSmoother->prec_ = factory.
clone<Matrix1, Matrix2>(prec_, tmp->getTpetra_CrsMatrix(), paramList);
264 cloneSmoother->type_ = type_;
265 cloneSmoother->SetParameterList(paramList);
266 cloneSmoother->IsSetup(this->IsSetup());
267 return cloneSmoother;
270 "MueLu::Ifpack2Smoother::clone(): clone only available with Tpetra.");
275 #ifdef HAVE_MUELU_EPETRA
277 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
278 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
286 #undef MUELU_AMESOS2SMOOTHER_SHORT
292 template<
class Scalar2,
class LocalOrdinal2,
class GlobalOrdinal2,
class Node2>
305 void Apply(MultiVector& X,
const MultiVector& B,
bool InitialGuessIsZero =
false)
const {}
306 RCP<SmootherPrototype>
Copy()
const {
return Teuchos::null;}
308 #ifdef HAVE_MUELU_DEPRECATED_CODE
309 template<
typename Node2>
310 RCP<MueLu::Ifpack2Smoother<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
312 clone(
const RCP<Node2>& node2,
const Teuchos::RCP<const Matrix >& A_newnode)
const {
return Teuchos::null; }
329 #define MUELU_IFPACK2SMOOTHER_SHORT
Kokkos::Compat::KokkosSerialWrapperNode EpetraNode
#define MUELU_TPETRA_ETI_EXCEPTION(cl, obj, go)
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
static Teuchos::RCP< Preconditioner< typename OutputMatrixType::scalar_type, typename OutputMatrixType::local_ordinal_type, typename OutputMatrixType::global_ordinal_type, typename OutputMatrixType::node_type > > clone(const Teuchos::RCP< Preconditioner< typename InputMatrixType::scalar_type, typename InputMatrixType::local_ordinal_type, typename InputMatrixType::global_ordinal_type, typename InputMatrixType::node_type > > &prec, const Teuchos::RCP< const OutputMatrixType > &matrix, const Teuchos::ParameterList ¶ms=Teuchos::ParameterList())
Exception throws to report errors in the internal logical of the program.
void DeclareInput(Level ¤tLevel) const
Input.
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply smoother.
virtual ~Ifpack2Smoother()
Ifpack2Smoother(const std::string &type, const Teuchos::ParameterList ¶mList=Teuchos::ParameterList(), const LocalOrdinal &overlap=0)
void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
void Setup(Level ¤tLevel)
std::string description() const
Return a simple one-line description of this object.
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
void SetPrecParameters(const Teuchos::ParameterList &list=Teuchos::ParameterList()) const
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
RCP< SmootherPrototype > Copy() const
Class that encapsulates Ifpack2 smoothers.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
void SetupSchwarz(Level ¤tLevel)
void Setup(Level ¤tLevel)
Set up the smoother.
void SetupBlockRelaxation(Level ¤tLevel)
virtual ~Ifpack2Smoother()
Destructor.
void SetupChebyshev(Level ¤tLevel)
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
RCP< SmootherPrototype > Copy() const
std::string description() const
Return a simple one-line description of this object.
LO overlap_
overlap when using the smoother in additive Schwarz mode
void SetPrecParameters(const Teuchos::ParameterList &list=Teuchos::ParameterList()) const
void SetupTopological(Level ¤tLevel)
RCP< Ifpack2::Preconditioner< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getPreconditioner()
For diagnostic purposes.
RCP< Ifpack2::Preconditioner< Scalar, LocalOrdinal, GlobalOrdinal, Node > > prec_
pointer to Ifpack2 preconditioner object
std::string type_
ifpack2-specific key phrase that denote smoother type
friend class Ifpack2Smoother
Constructor.
void DeclareInput(Level ¤tLevel) const
Input.
RCP< Matrix > A_
matrix, used in apply if solving residual equation
void SetupLineSmoothing(Level ¤tLevel)
void SetupGeneric(Level ¤tLevel)
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply the preconditioner.
Class that holds all level-specific information.
Base class for smoother prototypes.
GlobalOrdinal global_ordinal_type
LocalOrdinal local_ordinal_type
Namespace for MueLu classes and methods.