53#ifndef MUELU_PERMUTINGSMOOTHER_DEF_HPP
54#define MUELU_PERMUTINGSMOOTHER_DEF_HPP
56#include <Xpetra_Matrix.hpp>
57#include <Xpetra_MultiVector.hpp>
58#include <Xpetra_MultiVectorFactory.hpp>
59#include <Xpetra_Vector.hpp>
60#include <Xpetra_VectorFactory.hpp>
66#include "MueLu_TrilinosSmoother.hpp"
68#include "MueLu_PermutationFactory.hpp"
73 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
75 : type_(type), overlap_(overlap), permQT_(
Teuchos::null), permP_(
Teuchos::null), diagScalingOp_(
Teuchos::null)
82 newPermFact->SetParameter(
"PermutationRowMapName", Teuchos::ParameterEntry(mapName));
83 newPermFact->SetFactory (
"PermutationRowMapFactory", mapFact);
89#if defined(HAVE_MUELU_EPETRA) && defined(HAVE_MUELU_IFPACK)
103 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
106 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
110 currentLevel.
DeclareInput(
"permScaling", permFact_.get());
112 s_->DeclareInput(currentLevel);
115 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
117 FactoryMonitor monitor(*
this,
"Permuting Smoother", currentLevel);
120 this->GetOStream(
Warnings0) <<
"MueLu::PermutingSmoother::Setup(): Setup() has already been called" << std::endl;
123 permP_ = currentLevel.
Get< RCP<Matrix> > (
"permP", permFact_.get());
124 permQT_ = currentLevel.
Get< RCP<Matrix> > (
"permQT", permFact_.get());
125 diagScalingOp_ = currentLevel.
Get< RCP<Matrix> > (
"permScaling", permFact_.get());
127 s_->Setup(currentLevel);
132 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
136 typedef Teuchos::ScalarTraits<Scalar> STS;
138 Teuchos::RCP<MultiVector> Xtemp = MultiVectorFactory::Build(X.getMap(), 1,
true);
139 Xtemp->update(STS::one(), X, STS::zero());
142 Teuchos::RCP<MultiVector> Btemp = MultiVectorFactory::Build(B.getMap(), 1,
true);
143 Teuchos::RCP<MultiVector> Btemp2 = MultiVectorFactory::Build(B.getMap(), 1,
true);
144 permP_->apply(B, *Btemp, Teuchos::NO_TRANS);
145 diagScalingOp_->apply(*Btemp, *Btemp2, Teuchos::NO_TRANS);
148 s_->Apply(*Xtemp, *Btemp2, InitialGuessIsZero);
151 permQT_->apply(*Xtemp, X, Teuchos::NO_TRANS);
154 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
155 RCP<MueLu::SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
160 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
162 std::ostringstream out;
167 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
#define MUELU_DESCRIBE
Helper macro for implementing Describable::describe() for BaseClass objects.
virtual std::string description() const
Return a simple one-line description of this object.
Exception throws to report errors in the internal logical of the program.
Timer to be used in factories. Similar to Monitor but with additional timers.
Class that holds all level-specific information.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....
virtual void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
virtual const Teuchos::ParameterList & GetParameterList() const
factory generates a row- and column permutation operators P and Q such that P*A*Q^T is a (hopefully) ...
This class first calculates row- and column permutation operators and applies a smoother to the permu...
std::string description() const
Return a simple one-line description of this object.
virtual ~PermutingSmoother()
Destructor.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
RCP< FactoryBase > permFact_
Permutation Factory.
RCP< SmootherPrototype > Copy() const
void DeclareInput(Level ¤tLevel) const
Input.
void Setup(Level ¤tLevel)
Set up the direct solver.
LO overlap_
overlap when using the smoother in additive Schwarz mode
std::string type_
ifpack1/2-specific key phrase that denote smoother type
PermutingSmoother(std::string const &mapName, const RCP< const FactoryBase > &mapFact, std::string const &type="", const Teuchos::ParameterList ¶mList=Teuchos::ParameterList(), LO const &overlap=0, RCP< FactoryBase > permFact=Teuchos::null)
Constructor.
RCP< SmootherPrototype > s_
Smoother.
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply the direct solver. Solves the linear system AX=B using the constructed solver.
bool IsSetup() const
Get the state of a smoother prototype.
Class that encapsulates external library smoothers.
Namespace for MueLu classes and methods.
@ Warnings0
Important warning messages (one line)