46 #ifndef MUELU_TRILINOSSMOOTHER_DECL_HPP
47 #define MUELU_TRILINOSSMOOTHER_DECL_HPP
49 #include <Teuchos_ParameterList.hpp>
51 #include <Xpetra_Matrix_fwd.hpp>
55 #include "MueLu_SmootherPrototype.hpp"
60 #if defined(HAVE_MUELU_IFPACK2)
62 #include "MueLu_Ifpack2Smoother.hpp"
79 template <class Scalar = SmootherPrototype<>::scalar_type,
84 #undef MUELU_TRILINOSSMOOTHER_SHORT
104 TrilinosSmoother(
const std::string& type =
"",
const Teuchos::ParameterList& paramList = Teuchos::ParameterList(),
const LO& overlap = 0);
125 void Apply(MultiVector& X,
const MultiVector& B,
bool InitialGuessIsZero =
false)
const;
130 void SetFactory(
const std::string& varName,
const RCP<const FactoryBase>& factory);
133 RCP<SmootherPrototype>
Copy()
const;
137 template<
class Scalar2,
class LocalOrdinal2,
class GlobalOrdinal2,
class Node2>
141 #ifdef HAVE_MUELU_DEPRECATED_CODE
142 template<
typename Node2>
143 RCP<MueLu::TrilinosSmoother<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
145 clone(
const RCP<Node2>& node2,
const Teuchos::RCP<
const Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >& A_newnode)
const;
202 RCP<SmootherPrototype>
s_;
210 #ifdef HAVE_MUELU_DEPRECATED_CODE
211 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
212 template<
typename Node2>
214 Teuchos::RCP<MueLu::TrilinosSmoother<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
216 #if defined(HAVE_MUELU_IFPACK2)
217 RCP<TrilinosSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > cloneSmoother =
219 Teuchos::RCP<MueLu::SmootherBase<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > cloneSB;
221 Teuchos::RCP<MueLu::Ifpack2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node> > ifpack2Smoother =
222 Teuchos::rcp_dynamic_cast<MueLu::Ifpack2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node> >(this->s_);
223 if (ifpack2Smoother != Teuchos::null){
224 cloneSB = ifpack2Smoother->template clone<Node2>(node2, A_newnode);
227 TEUCHOS_TEST_FOR_EXCEPTION(
228 true, std::invalid_argument,
"MueLu::TrilinosSmoother: "
229 "Invalid smoother type to clone (not type Ifpack2)\"");
231 RCP<MueLu::SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > clonedProto =
232 Teuchos::rcp_dynamic_cast<MueLu::SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node2> >(cloneSB);
233 cloneSmoother->s_ = clonedProto;
234 cloneSmoother->IsSetup(
true);
235 return cloneSmoother;
237 TEUCHOS_TEST_FOR_EXCEPTION(
238 true, std::invalid_argument,
"MueLu::SmootherClone: "
239 "clone() only available with IFPACK2 enabled.");
246 #define MUELU_TRILINOSSMOOTHER_SHORT
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
Base class for smoother prototypes.
GlobalOrdinal global_ordinal_type
LocalOrdinal local_ordinal_type
Class that encapsulates external library smoothers.
RCP< SmootherPrototype > Copy() const
When this prototype is cloned using Copy(), the clone is an Ifpack or an Ifpack2 smoother.
void Setup(Level ¤tLevel)
TrilinosSmoother cannot be turned into a smoother using Setup(). Setup() always returns a RuntimeErro...
LO overlap_
overlap when using the smoother in additive Schwarz mode
static Teuchos::ParameterList Ifpack2ToIfpack1Param(const Teuchos::ParameterList &ifpack2List)
Convert an Ifpack2 parameter list to Ifpack.
static std::string Ifpack2ToIfpack1Type(const std::string &type)
Convert an Ifpack2 preconditioner name to Ifpack.
std::string type_
ifpack1/2-specific key phrase that denote smoother type
friend class TrilinosSmoother
Friend declaration required for clone() functionality.
RCP< SmootherPrototype > getSmoother()
For diagnostic purposes.
void DeclareInput(Level ¤tLevel) const
Input.
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
virtual ~TrilinosSmoother()
Destructor.
RCP< SmootherPrototype > sEpetra_
Smoother.
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Custom SetFactory.
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
TrilinosSmoother cannot be applied. Apply() always returns a RuntimeError exception.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
RCP< SmootherPrototype > s_
RCP< FactoryBase > AFact_
A Factory.
std::string description() const
Return a simple one-line description of this object.
RCP< SmootherPrototype > sTpetra_
Namespace for MueLu classes and methods.