MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_DirectSolver_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_DIRECTSOLVER_DECL_HPP
11 #define MUELU_DIRECTSOLVER_DECL_HPP
12 
14 
15 #include "MueLu_ConfigDefs.hpp"
17 
18 #include "MueLu_SmootherPrototype.hpp"
19 
26 
27 // Note: DirectSolver is a SmootherPrototype that cannot be turned into a smoother using Setup().
28 // When this prototype is cloned using Copy(), the clone is an Amesos or an Amesos2 smoother.
29 // The clone can be used as a smoother after calling Setup().
30 
31 namespace MueLu {
32 
39 template <class Scalar = SmootherPrototype<>::scalar_type,
40  class LocalOrdinal = typename SmootherPrototype<Scalar>::local_ordinal_type,
41  class GlobalOrdinal = typename SmootherPrototype<Scalar, LocalOrdinal>::global_ordinal_type,
42  class Node = typename SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
43 class DirectSolver : public SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
44 #undef MUELU_DIRECTSOLVER_SHORT
45 #include "MueLu_UseShortNames.hpp"
46 
47  public:
49 
50 
53  DirectSolver(const std::string& type = "", const Teuchos::ParameterList& paramList = Teuchos::ParameterList());
54 
56  virtual ~DirectSolver() {}
57 
59 
61 
62 
63  void DeclareInput(Level& currentLevel) const;
64 
66 
68 
69 
71  void Setup(Level& currentLevel);
72 
74  void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const;
75 
77 
79  void SetFactory(const std::string& varName, const RCP<const FactoryBase>& factory);
80 
83 
85 
86 
88  std::string description() const;
89 
90  void print(Teuchos::FancyOStream& out, const VerbLevel verbLevel = Default) const;
91 
93  size_t getNodeSmootherComplexity() const {
94  if (!s_.is_null())
95  return s_->getNodeSmootherComplexity();
96  else
97  return 0.0;
98  }
99 
101 
102  private:
103  //
104  // Parameters
105  //
106 
108  std::string type_;
109 
110  //
111  // Underlying Smoother
112  //
113 
117 
118  // Records for the case if something goes wrong
121 
122 }; // class DirectSolver
123 
124 } // namespace MueLu
125 
126 #define MUELU_DIRECTSOLVER_SHORT
127 #endif // MUELU_DIRECTSOLVER_DECL_HPP
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
DirectSolver cannot be applied. Apply() always returns a RuntimeError exception.
void Setup(Level &currentLevel)
DirectSolver cannot be turned into a smoother using Setup(). Setup() always returns a RuntimeError ex...
MueLu::DefaultLocalOrdinal LocalOrdinal
void DeclareInput(Level &currentLevel) const
Input.
Base class for smoother prototypes.
std::string type_
amesos1/2-specific key phrase that denote smoother type
DirectSolver(const std::string &type="", const Teuchos::ParameterList &paramList=Teuchos::ParameterList())
Constructor Note: only parameters shared by Amesos and Amesos2 should be used for type and paramList ...
MueLu::DefaultNode Node
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
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.
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:63
RCP< SmootherPrototype > sBelos_
RCP< SmootherPrototype > sTpetra_
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Custom SetFactory.
virtual ~DirectSolver()
Destructor.
RCP< SmootherPrototype > sEpetra_
Smoother.
RCP< SmootherPrototype > sRefMaxwell_
RCP< SmootherPrototype > s_
RCP< SmootherPrototype > sStratimikos_
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.