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;
136 template<
class Scalar2,
class LocalOrdinal2,
class GlobalOrdinal2,
class Node2>
141 template<
typename Node2>
142 RCP<MueLu::TrilinosSmoother<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
clone(
const RCP<Node2>& node2,
const Teuchos::RCP<
const Xpetra::Matrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >& A_newnode)
const;
199 RCP<SmootherPrototype>
s_;
207 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
208 template<
typename Node2>
209 Teuchos::RCP<MueLu::TrilinosSmoother<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
211 #if defined(HAVE_MUELU_IFPACK2) 212 RCP<TrilinosSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > cloneSmoother =
214 Teuchos::RCP<MueLu::SmootherBase<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > cloneSB;
216 Teuchos::RCP<MueLu::Ifpack2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node> > ifpack2Smoother =
218 if (ifpack2Smoother != Teuchos::null){
219 cloneSB = ifpack2Smoother->template clone<Node2>(node2, A_newnode);
222 TEUCHOS_TEST_FOR_EXCEPTION(
223 true, std::invalid_argument,
"MueLu::TrilinosSmoother: " 224 "Invalid smoother type to clone (not type Ifpack2)\"");
226 RCP<MueLu::SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node2> > clonedProto =
228 cloneSmoother->s_ = clonedProto;
230 return cloneSmoother;
232 TEUCHOS_TEST_FOR_EXCEPTION(
233 true, std::invalid_argument,
"MueLu::SmootherClone: " 234 "clone() only available with IFPACK2 enabled.");
241 #define MUELU_TRILINOSSMOOTHER_SHORT 242 #endif // MUELU_TRILINOSSMOOTHER_DECL_HPP size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
RCP< SmootherPrototype > Copy() const
When this prototype is cloned using Copy(), the clone is an Ifpack or an Ifpack2 smoother.
RCP< MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node2 > > clone(const RCP< Node2 > &node2, const Teuchos::RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node2 > > &A_newnode) const
RCP< SmootherPrototype > sTpetra_
virtual ~TrilinosSmoother()
Destructor.
bool IsSetup() const
Get the state of a smoother prototype.
Class that encapsulates external library smoothers.
static std::string Ifpack2ToIfpack1Type(const std::string &type)
Convert an Ifpack2 preconditioner name to Ifpack.
static Teuchos::ParameterList Ifpack2ToIfpack1Param(const Teuchos::ParameterList &ifpack2List)
Convert an Ifpack2 parameter list to Ifpack.
Base class for smoother prototypes.
void DeclareInput(Level ¤tLevel) const
Input.
Namespace for MueLu classes and methods.
LocalOrdinal local_ordinal_type
void Setup(Level ¤tLevel)
TrilinosSmoother cannot be turned into a smoother using Setup(). Setup() always returns a RuntimeErro...
friend class TrilinosSmoother
Friend declaration required for clone() functionality.
std::string description() const
Return a simple one-line description of this object.
RCP< SmootherPrototype > s_
Class that holds all level-specific information.
std::string type_
ifpack1/2-specific key phrase that denote smoother type
RCP< FactoryBase > AFact_
A Factory.
RCP< SmootherPrototype > sEpetra_
Smoother.
GlobalOrdinal global_ordinal_type
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
LO overlap_
overlap when using the smoother in additive Schwarz mode
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
TrilinosSmoother cannot be applied. Apply() always returns a RuntimeError exception.
Class that encapsulates Ifpack2 smoothers.
RCP< SmootherPrototype > getSmoother()
For diagnostic purposes.
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Custom SetFactory.