MueLu Version of the Day
Loading...
Searching...
No Matches
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
13#include <Teuchos_ParameterList.hpp>
14
15#include "MueLu_ConfigDefs.hpp"
17
18#include "MueLu_SmootherPrototype.hpp"
19
25
26// Note: DirectSolver is a SmootherPrototype that cannot be turned into a smoother using Setup().
27// When this prototype is cloned using Copy(), the clone is an Amesos or an Amesos2 smoother.
28// The clone can be used as a smoother after calling Setup().
29
30namespace MueLu {
31
38template <class Scalar = SmootherPrototype<>::scalar_type,
42class DirectSolver : public SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
43#undef MUELU_DIRECTSOLVER_SHORT
45
46 public:
48
49
52 DirectSolver(const std::string& type = "", const Teuchos::ParameterList& paramList = Teuchos::ParameterList());
53
55 virtual ~DirectSolver() {}
56
58
60
61
62 void DeclareInput(Level& currentLevel) const;
63
65
67
68
70 void Setup(Level& currentLevel);
71
73 void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const;
74
76
78 void SetFactory(const std::string& varName, const RCP<const FactoryBase>& factory);
79
81 RCP<SmootherPrototype> Copy() const;
82
84
85
87 std::string description() const;
88
89 void print(Teuchos::FancyOStream& out, const VerbLevel verbLevel = Default) const;
90
93 if (!s_.is_null())
94 return s_->getNodeSmootherComplexity();
95 else
96 return 0.0;
97 }
98
100
101 private:
102 //
103 // Parameters
104 //
105
107 std::string type_;
108
109 //
110 // Underlying Smoother
111 //
112
114 RCP<SmootherPrototype> sTpetra_, sBelos_, sStratimikos_, sRefMaxwell_;
115 mutable RCP<SmootherPrototype> s_;
116
117 // Records for the case if something goes wrong
120
121}; // class DirectSolver
122
123} // namespace MueLu
124
125#define MUELU_DIRECTSOLVER_SHORT
126#endif // MUELU_DIRECTSOLVER_DECL_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
DirectSolver cannot be applied. Apply() always returns a RuntimeError exception.
virtual ~DirectSolver()
Destructor.
std::string description() const
Return a simple one-line description of this object.
void Setup(Level &currentLevel)
DirectSolver cannot be turned into a smoother using Setup(). Setup() always returns a RuntimeError ex...
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Custom SetFactory.
RCP< SmootherPrototype > sBelos_
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
RCP< SmootherPrototype > sStratimikos_
RCP< SmootherPrototype > s_
RCP< SmootherPrototype > sRefMaxwell_
void DeclareInput(Level &currentLevel) const
Input.
RCP< SmootherPrototype > Copy() const
When this prototype is cloned using Copy(), the clone is an Amesos or an Amesos2 smoother.
std::string type_
amesos1/2-specific key phrase that denote smoother type
RCP< SmootherPrototype > sTpetra_
Smoother.
Class that holds all level-specific information.
Base class for smoother prototypes.
Namespace for MueLu classes and methods.