47 #ifndef PACKAGES_MUELU_ADAPTERS_XPETRA_MUELU_CREATEXPETRAPRECONDITIONER_HPP_
48 #define PACKAGES_MUELU_ADAPTERS_XPETRA_MUELU_CREATEXPETRAPRECONDITIONER_HPP_
60 #include <MueLu_Hierarchy.hpp>
62 #include <MueLu_ParameterListInterpreter.hpp>
63 #include <MueLu_Utilities.hpp>
64 #include <MueLu_HierarchyUtils.hpp>
78 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
92 bool hasParamList = inParamList.
numParams();
101 if (hasParamList && paramList.
isParameter(
"hierarchy label")) {
102 label = paramList.
get<std::string>(
"hierarchy label");
103 paramList.
remove(
"hierarchy label");
105 label = op->getObjectLabel();
107 std::string timerName;
109 timerName =
"MueLu setup time (" + label +
")";
111 timerName =
"MueLu setup time";
115 std::string syntaxStr =
"parameterlist: syntax";
116 if (hasParamList && paramList.
isParameter(syntaxStr) && paramList.
get<std::string>(syntaxStr) ==
"ml") {
117 paramList.
remove(syntaxStr);
119 paramList = *Teuchos::getParametersFromXmlString(paramXML);
125 H->
setlib(op->getDomainMap()->lib());
140 const bool alwaysWriteLocal =
true;
141 const bool writeGlobalStats =
true;
142 const bool writeZeroTimers =
false;
143 const bool ignoreZeroTimers =
true;
144 const std::string filter = timerName;
146 writeZeroTimers, Teuchos::Union, filter, ignoreZeroTimers);
162 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
165 const std::string& xmlFileName) {
168 return CreateXpetraPreconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node>(op, paramList);
178 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
182 return CreateXpetraPreconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node>(op, paramList);
192 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
195 std::string label = H->GetLevel(0)->getObjectLabel();
197 std::string timerName;
199 timerName =
"MueLu setup time (" + label +
")";
201 timerName =
"MueLu setup time";
214 "MueLu::ReuseXpetraPreconditioner: Hierarchy has no levels in it");
216 "MueLu::ReuseXpetraPreconditioner: Hierarchy has no fine level operator");
220 RCP<Matrix> A0 = Teuchos::rcp_dynamic_cast<Matrix>(O0);
226 A->SetFixedBlockSize(A0->GetFixedBlockSize());
236 const bool alwaysWriteLocal =
true;
237 const bool writeGlobalStats =
true;
238 const bool writeZeroTimers =
false;
239 const bool ignoreZeroTimers =
true;
240 const std::string filter = timerName;
242 writeZeroTimers, Teuchos::Union, filter, ignoreZeroTimers);
250 #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)
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.
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)
virtual RCP< Hierarchy > CreateHierarchy() const
Create an empty Hierarchy object.
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...
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.