10 #ifndef PACKAGES_MUELU_ADAPTERS_XPETRA_MUELU_CREATEXPETRAPRECONDITIONER_HPP_
11 #define PACKAGES_MUELU_ADAPTERS_XPETRA_MUELU_CREATEXPETRAPRECONDITIONER_HPP_
23 #include <MueLu_Hierarchy.hpp>
25 #include <MueLu_ParameterListInterpreter.hpp>
26 #include <MueLu_Utilities.hpp>
27 #include <MueLu_HierarchyUtils.hpp>
41 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
55 bool hasParamList = inParamList.
numParams();
64 if (hasParamList && paramList.
isParameter(
"hierarchy label")) {
65 label = paramList.
get<std::string>(
"hierarchy label");
66 paramList.
remove(
"hierarchy label");
68 label = op->getObjectLabel();
70 std::string timerName;
72 timerName =
"MueLu setup time (" + label +
")";
74 timerName =
"MueLu setup time";
78 std::string syntaxStr =
"parameterlist: syntax";
79 if (hasParamList && paramList.
isParameter(syntaxStr) && paramList.
get<std::string>(syntaxStr) ==
"ml") {
80 paramList.
remove(syntaxStr);
82 paramList = *Teuchos::getParametersFromXmlString(paramXML);
88 H->
setlib(op->getDomainMap()->lib());
103 const bool alwaysWriteLocal =
true;
104 const bool writeGlobalStats =
true;
105 const bool writeZeroTimers =
false;
106 const bool ignoreZeroTimers =
true;
107 const std::string filter = timerName;
109 writeZeroTimers, Teuchos::Union, filter, ignoreZeroTimers);
125 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
128 const std::string& xmlFileName) {
131 return CreateXpetraPreconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node>(op, paramList);
141 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
145 return CreateXpetraPreconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node>(op, paramList);
155 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
158 std::string label = H->GetLevel(0)->getObjectLabel();
160 std::string timerName;
162 timerName =
"MueLu setup time (" + label +
")";
164 timerName =
"MueLu setup time";
177 "MueLu::ReuseXpetraPreconditioner: Hierarchy has no levels in it");
179 "MueLu::ReuseXpetraPreconditioner: Hierarchy has no fine level operator");
183 RCP<Matrix> A0 = Teuchos::rcp_dynamic_cast<Matrix>(O0);
189 A->SetFixedBlockSize(A0->GetFixedBlockSize());
199 const bool alwaysWriteLocal =
true;
200 const bool writeGlobalStats =
true;
201 const bool writeZeroTimers =
false;
202 const bool ignoreZeroTimers =
true;
203 const std::string filter = timerName;
205 writeZeroTimers, Teuchos::Union, filter, ignoreZeroTimers);
213 #define XPETRA_CREATEXPETRAPRECONDITIONER_SHORT
MueLu::DefaultLocalOrdinal LocalOrdinal
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
static void AddNonSerializableDataToHierarchy(HierarchyManager &HM, Hierarchy &H, const ParameterList &nonSerialList)
Add non-serializable data to Hierarchy.
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void ReuseXpetraPreconditioner(const Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &A, Teuchos::RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &H)
Helper function to reuse an existing MueLu preconditioner.
Ordinal numParams() const
static RCP< Time > getNewTimer(const std::string &name)
virtual RCP< Hierarchy > CreateHierarchy() const
Create an empty Hierarchy object.
Teuchos::RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > CreateXpetraPreconditioner(Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> op, const Teuchos::ParameterList &inParamList)
Helper function to create a MueLu preconditioner that can be used by Xpetra.Given an Xpetra::Matrix...
bool isParameter(const std::string &name) const
Print statistics that do not involve significant additional computation.
bool remove(std::string const &name, bool throwIfNotExists=true)
void start(bool reset=false)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
static void summarize(Ptr< const Comm< int > > comm, std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true, const ECounterSetOp setOp=Intersection, const std::string &filter="", const bool ignoreZeroTimers=false)
VerbLevel GetVerbLevel() const
Get the verbosity level.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
int SetProcRankVerbose(int procRank) const
Set proc rank used for printing.
Exception throws to report errors in the internal logical of the program.
void setlib(Xpetra::UnderlyingLib inlib)
static std::string translate(Teuchos::ParameterList ¶mList, const std::string &defaultVals="")
: Translate ML parameters to MueLu parameter XML string
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
long ExtractNonSerializableData(const Teuchos::ParameterList &inList, Teuchos::ParameterList &serialList, Teuchos::ParameterList &nonSerialList)
Extract non-serializable data from level-specific sublists and move it to a separate parameter list...