Go to the documentation of this file.
50 #if defined(HAVE_MUELU_EPETRA) && defined(HAVE_MUELU_AMESOS)
52 #include <Epetra_LinearProblem.h>
54 #include <Amesos_config.h>
61 #include "MueLu_Utilities.hpp"
74 std::transform(
type_.begin(), ++
type_.begin(),
type_.begin(), ::toupper);
78 if (
type_ ==
"Amesos_umfpack")
type_ =
"Umfpack";
79 if (
type_ ==
"Superlu_dist")
type_ =
"Superludist";
85 std::string oldtype =
type_;
87 #if defined(HAVE_AMESOS_SUPERLU)
89 #elif defined(HAVE_AMESOS_KLU)
91 #elif defined(HAVE_AMESOS_SUPERLUDIST)
92 type_ =
"Superludist";
93 #elif defined(HAVE_AMESOS_UMFPACK)
96 throw Exceptions::RuntimeError(
"Amesos has been compiled without SuperLU_DIST, SuperLU, Umfpack or Klu. By default, MueLu tries"
97 "to use one of these libraries. Amesos must be compiled with one of these solvers, "
98 "or a valid Amesos solver has to be specified explicitly.");
101 this->
GetOStream(
Warnings0) <<
"MueLu::AmesosSmoother: \"" << oldtype <<
"\" is not available. Using \"" <<
type_ <<
"\" instead" << std::endl;
107 template <
class Node>
109 this->Input(currentLevel,
"A");
112 template <
class Node>
117 this->GetOStream(
Warnings0) <<
"MueLu::AmesosSmoother::Setup(): Setup() has already been called" << std::endl;
119 A_ = Factory::Get< RCP<Matrix> >(currentLevel,
"A");
123 linearProblem_->SetOperator(epA.get());
126 prec_ = rcp(factory.
Create(type_, *linearProblem_));
127 TEUCHOS_TEST_FOR_EXCEPTION(prec_ == Teuchos::null,
Exceptions::RuntimeError,
"MueLu::AmesosSmoother::Setup(): Solver '" + type_ +
"' not supported by Amesos");
131 if (A_->getRowMap()->isDistributed() ==
true && A_->getRowMap()->isContiguous() ==
false)
132 const_cast<ParameterList&>(this->GetParameterList()).set(
"Reindex",
true);
134 const ParameterList& paramList = this->GetParameterList();
135 RCP<ParameterList> precList = this->RemoveFactoriesFromList(paramList);
137 prec_->SetParameters(*precList);
139 const_cast<ParameterList&>(paramList).setParameters(*precList);
141 int r = prec_->NumericFactorization();
142 TEUCHOS_TEST_FOR_EXCEPTION(r != 0,
Exceptions::RuntimeError,
"MueLu::AmesosSmoother::Setup(): Amesos solver returns value of " +
148 template <
class Node>
158 linearProblem_->SetLHS(&epX);
159 linearProblem_->SetRHS(&nonconstB);
164 linearProblem_->SetLHS(0);
165 linearProblem_->SetRHS(0);
168 template <
class Node>
173 template <
class Node>
175 std::ostringstream out;
177 out <<
"{type = " << type_ <<
"}";
182 template <
class Node>
187 out0 <<
"Prec. type: " << type_ << std::endl;
190 out0 <<
"Parameter list: " << std::endl;
191 Teuchos::OSTab tab2(out);
192 out << this->GetParameterList();
196 if (prec_ != Teuchos::null) {
197 prec_->PrintStatus();
198 prec_->PrintTiming();
201 if (verbLevel &
Debug) {
204 <<
"RCP<A_>: " << A_ << std::endl
205 <<
"RCP<linearProblem__>: " << linearProblem_ << std::endl
206 <<
"RCP<prec_>: " << prec_ << std::endl;
210 template <
class Node>
213 return Teuchos::OrdinalTraits<size_t>::invalid();
223 #if defined(HAVE_MUELU_EPETRA)
228 #endif // HAVE_MUELU_EPETRA && HAVE_MUELU_AMESOS
Description of what is happening (more verbose)
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
Class that encapsulates Amesos direct solvers.
virtual std::string description() const
Return a simple one-line description of this object.
std::string description() const
Return a simple one-line description of this object.
Timer to be used in factories. Similar to Monitor but with additional timers.
Important warning messages (one line)
Print class parameters (more parameters, more verbose)
Print external lib objects.
RCP< SmootherPrototype > Copy() const
std::string tolower(const std::string &str)
Namespace for MueLu classes and methods.
Print additional debugging information.
static RCP< Epetra_MultiVector > MV2NonConstEpetraMV(RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > vec)
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply the direct solver.
static RCP< const Epetra_MultiVector > MV2EpetraMV(RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > const vec)
Helper utility to pull out the underlying Epetra objects from an Xpetra object.
#define MUELU_DESCRIBE
Helper macro for implementing Describable::describe() for BaseClass objects.
void Setup(Level ¤tLevel)
Set up the direct solver. This creates the underlying Amesos solver object according to the parameter...
bool Query(const char *ClassType)
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
Exception throws to report errors in the internal logical of the program.
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
static RCP< Epetra_CrsMatrix > Op2NonConstEpetraCrs(RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Op)
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
std::string type_
amesos-specific key phrase that denote smoother type
Amesos_BaseSolver * Create(const char *ClassType, const Epetra_LinearProblem &LinearProblem)
bool IsSetup() const
Get the state of a smoother prototype.
AmesosSmoother(const std::string &type="", const Teuchos::ParameterList ¶mList=Teuchos::ParameterList())
Constructor.
virtual void SetParameterList(const ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
Class that holds all level-specific information.
void DeclareInput(Level ¤tLevel) const
Input.