MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_Amesos2Smoother_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef MUELU_AMESOS2SMOOTHER_DECL_HPP
11 #define MUELU_AMESOS2SMOOTHER_DECL_HPP
12 
13 #include "MueLu_ConfigDefs.hpp"
14 #if defined(HAVE_MUELU_AMESOS2)
15 
18 #include <Teuchos_LAPACK.hpp>
19 
21 
22 #include "MueLu_SmootherPrototype.hpp"
24 #include "MueLu_Utilities_fwd.hpp"
25 
26 namespace Amesos2 {
27 template <class OP, class MV>
28 class Solver;
29 }
30 
31 namespace MueLu {
32 
33 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
34 class Projection {
35  public:
37 
39 
41 
42  private:
44 };
45 
55 template <class Scalar = SmootherPrototype<>::scalar_type,
59 class Amesos2Smoother : public SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
60 #undef MUELU_AMESOS2SMOOTHER_SHORT
61 #include "MueLu_UseShortNames.hpp"
62 
63  public:
65 
66 
71  Amesos2Smoother(const std::string& type = "", const Teuchos::ParameterList& paramList = Teuchos::ParameterList());
72 
74  virtual ~Amesos2Smoother();
75 
77 
79 
81 
82 
83  void DeclareInput(Level& currentLevel) const;
84 
86 
88 
89 
94  void Setup(Level& currentLevel);
95 
102  void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const;
104 
106 
108 
109 
111  std::string description() const;
112 
114  // using MueLu::Describable::describe; // overloading, not hiding
115  void print(Teuchos::FancyOStream& out, const VerbLevel verbLevel = Default) const;
116 
118  size_t getNodeSmootherComplexity() const;
119 
121 
122  private:
125 
127  std::string type_;
128 
131 
134 
136 
137 }; // class Amesos2Smoother
138 
139 #ifdef HAVE_MUELU_EPETRA
140 
141 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
142  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
143 // Stub specialization for missing Epetra template args
144 template <>
145 class Amesos2Smoother<double, int, int, Xpetra::EpetraNode> : public SmootherPrototype<double, int, int, Xpetra::EpetraNode> {
146  typedef double Scalar;
147  typedef int LocalOrdinal;
148  typedef int GlobalOrdinal;
150 #undef MUELU_AMESOS2SMOOTHER_SHORT
151 #include "MueLu_UseShortNames.hpp"
152 
153  public:
154  Amesos2Smoother(const std::string& type = "", const Teuchos::ParameterList& paramList = Teuchos::ParameterList()) {
155  MUELU_TPETRA_ETI_EXCEPTION("Amesos2Smoother<double,int,int,EpetraNode>", "Amesos2Smoother<double,int,int,EpetraNode>", "int");
156  }
157  virtual ~Amesos2Smoother(){};
158  void DeclareInput(Level& currentLevel) const {};
159  void Setup(Level& currentLevel){};
160  void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const {};
161 
162  RCP<SmootherPrototype> Copy() const { return Teuchos::null; };
163 
164  std::string description() const { return std::string(""); };
165  void print(Teuchos::FancyOStream& out, const VerbLevel verbLevel = Default) const {};
166 
168  size_t getNodeSmootherComplexity() const {
169  size_t cplx = 0;
170  return cplx;
171  };
172 };
173 #endif
174 #endif // HAVE_MUELU_EPETRA
175 
176 } // namespace MueLu
177 
178 #define MUELU_AMESOS2SMOOTHER_SHORT
179 #endif // HAVE_MUELU_AMESOS2
180 #endif // MUELU_AMESOS2SMOOTHER_DECL_HPP
RCP< Projection< Scalar, LocalOrdinal, GlobalOrdinal, Node > > projection_
MueLu::DefaultLocalOrdinal LocalOrdinal
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
std::string type_
amesos2-specific key phrase that denote smoother type
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.
Base class for smoother prototypes.
Amesos2Smoother(const std::string &type="", const Teuchos::ParameterList &paramList=Teuchos::ParameterList())
Constructor Creates a MueLu interface to the direct solvers in the Amesos2 package. If you are using type==&quot;&quot;, then either SuperLU or KLU2 are used by default.
std::string description() const
Return a simple one-line description of this object.
MueLu::DefaultNode Node
Amesos2Smoother(const std::string &type="", const Teuchos::ParameterList &paramList=Teuchos::ParameterList())
Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > Tpetra_MultiVector
RCP< SmootherPrototype > Copy() const
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:63
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Nullspace_
Class that encapsulates Amesos2 direct solvers.
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > Tpetra_CrsMatrix
#define MUELU_TPETRA_ETI_EXCEPTION(cl, obj, go)
void DeclareInput(Level &currentLevel) const
Input.
virtual ~Amesos2Smoother()
Destructor.
void Setup(Level &currentLevel)
Set up the direct solver. This creates the underlying Amesos2 solver object according to the paramete...
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > localMap_
RCP< Amesos2::Solver< Tpetra_CrsMatrix, Tpetra_MultiVector > > prec_
pointer to Amesos2 solver object
std::string description() const
Return a simple one-line description of this object.
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply smoother.
Projection(RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &Nullspace)
void projectOut(Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X)