46 #ifndef MUELU_DIRECTSOLVER_DEF_HPP 47 #define MUELU_DIRECTSOLVER_DEF_HPP 49 #include <Xpetra_Utils.hpp> 50 #include <Xpetra_Matrix.hpp> 57 #include "MueLu_Amesos2Smoother.hpp" 62 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
75 ParameterList paramList = paramListIn;
80 #if defined(HAVE_MUELU_TPETRA) && defined(HAVE_MUELU_AMESOS2) 89 #if defined(HAVE_MUELU_EPETRA) && defined(HAVE_MUELU_AMESOS) 104 "Plase enable (TPETRA and AMESOS2) or (EPETRA and AMESOS)");
107 "Could not enable any direct solver:\n" 108 << (
triedEpetra_ ?
"Epetra mode was disabled due to an error:\n" :
"")
110 << (
triedTpetra_ ?
"Tpetra mode was disabled due to an error:\n" :
"")
116 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
123 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
130 bool useTpetra = (currentLevel.
lib() == Xpetra::UseTpetra);
134 #if not defined(HAVE_MUELU_AMESOS2) 136 "Error: running in Tpetra mode, but MueLu with Amesos2 was disabled during the configure stage.\n" 137 "Please make sure that:\n" 138 " - Amesos2 is enabled (Trilinos_ENABLE_Amesos2=ON),\n" 139 " - Amesos2 is available for MueLu to use (MueLu_ENABLE_Amesos2=ON)\n");
146 #if not defined(HAVE_MUELU_AMESOS) 148 "Error: running in Epetra mode, but MueLu with Amesos was disabled during the configure stage.\n" 149 "Please make sure that:\n" 150 " - Amesos is enabled (you can do that with Trilinos_ENABLE_Amesos=ON),\n" 151 " - Amesos is available for MueLu to use (MueLu_ENABLE_Amesos=ON)\n");
158 "Direct solver for " << (useTpetra ?
"Tpetra" :
"Epetra") <<
" was not constructed");
161 s_->DeclareInput(currentLevel);
164 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
167 this->
GetOStream(
Warnings0) <<
"MueLu::DirectSolver::Setup(): Setup() has already been called";
171 s_->Setup(currentLevel);
173 s_->SetProcRankVerbose(oldRank);
180 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
184 s_->Apply(X, B, InitialGuessIsZero);
187 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
189 RCP<DirectSolver> newSmoo = rcp(
new DirectSolver(*
this));
194 newSmoo->sEpetra_ =
sEpetra_->Copy();
196 newSmoo->sTpetra_ =
sTpetra_->Copy();
199 newSmoo->s_ = (
s_.get() ==
sTpetra_.get() ? newSmoo->sTpetra_ : newSmoo->sEpetra_);
205 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
207 std::ostringstream out;
208 if (
s_ != Teuchos::null) {
209 out <<
s_->description();
212 out <<
"{type = " <<
type_ <<
"}";
217 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
222 out0 <<
"Prec. type: " <<
type_ << std::endl;
225 out0 <<
"Parameter list: " << std::endl;
226 Teuchos::OSTab tab3(out);
230 if (verbLevel &
Debug)
236 #endif // MUELU_DIRECTSOLVER_DEF_HPP Important warning messages (one line)
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
DirectSolver cannot be applied. Apply() always returns a RuntimeError exception.
void Setup(Level ¤tLevel)
DirectSolver cannot be turned into a smoother using Setup(). Setup() always returns a RuntimeError ex...
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
void DeclareInput(Level ¤tLevel) const
Input.
Print additional debugging information.
Namespace for MueLu classes and methods.
virtual const Teuchos::ParameterList & GetParameterList() const
std::string type_
amesos1/2-specific key phrase that denote smoother type
DirectSolver(const std::string &type="", const Teuchos::ParameterList ¶mList=Teuchos::ParameterList())
Constructor Note: only parameters shared by Amesos and Amesos2 should be used for type and paramList ...
RCP< SmootherPrototype > Copy() const
When this prototype is cloned using Copy(), the clone is an Amesos or an Amesos2 smoother.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
std::string description() const
Return a simple one-line description of this object.
virtual void SetParameterList(const ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
Class that holds all level-specific information.
Class that encapsulates Amesos2 direct solvers.
bool IsSetup() const
Get the state of a smoother prototype.
Xpetra::UnderlyingLib lib()
#define MUELU_DESCRIBE
Helper macro for implementing Describable::describe() for BaseClass objects.
RCP< SmootherPrototype > sTpetra_
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Custom SetFactory.
RCP< SmootherPrototype > sEpetra_
Smoother.
RCP< SmootherPrototype > s_
Print class parameters (more parameters, more verbose)
Exception throws to report errors in the internal logical of the program.
virtual std::string description() const
Return a simple one-line description of this object.
int GetProcRankVerbose() const
Get proc rank used for printing. Do not use this information for any other purpose.