8 #ifndef PACKAGES_MUELU_ADAPTERS_XPETRA_MUELU_CREATEXPETRAPRECONDITIONER_HPP_ 9 #define PACKAGES_MUELU_ADAPTERS_XPETRA_MUELU_CREATEXPETRAPRECONDITIONER_HPP_ 21 #include <MueLu_Hierarchy.hpp> 23 #include <MueLu_MLParameterListInterpreter.hpp> 24 #include <MueLu_ParameterListInterpreter.hpp> 25 #include <MueLu_Utilities.hpp> 26 #include <MueLu_HierarchyUtils.hpp> 41 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
53 std::string timerName =
"MueLu setup time";
57 bool hasParamList = inParamList.
numParams();
65 std::string syntaxStr =
"parameterlist: syntax";
66 if (hasParamList && paramList.
isParameter(syntaxStr) && paramList.
get<std::string>(syntaxStr) ==
"ml") {
67 paramList.
remove(syntaxStr);
75 if (hasParamList && paramList.
isParameter(
"hierarchy label")) {
76 label = paramList.
get<std::string>(
"hierarchy label");
77 paramList.
remove(
"hierarchy label");
79 label = op->getObjectLabel();
81 H->
setlib(op->getDomainMap()->lib());
90 if (coords != Teuchos::null)
91 H->
GetLevel(0)->Set(
"Coordinates", coords);
94 if (nullspace != Teuchos::null)
95 H->
GetLevel(0)->Set(
"Nullspace", nullspace);
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);
117 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
128 std::string timerName =
"MueLu setup time";
132 bool hasParamList = inParamList.
numParams();
140 std::string syntaxStr =
"parameterlist: syntax";
141 if (hasParamList && paramList.
isParameter(syntaxStr) && paramList.
get<std::string>(syntaxStr) ==
"ml") {
142 paramList.
remove(syntaxStr);
150 H->
setlib(op->getDomainMap()->lib());
164 const bool alwaysWriteLocal =
true;
165 const bool writeGlobalStats =
true;
166 const bool writeZeroTimers =
false;
167 const bool ignoreZeroTimers =
true;
168 const std::string filter = timerName;
170 writeZeroTimers, Teuchos::Union, filter, ignoreZeroTimers);
185 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
188 std::string timerName =
"MueLu setup time";
193 typedef LocalOrdinal
LO;
194 typedef GlobalOrdinal
GO;
201 "MueLu::ReuseXpetraPreconditioner: Hierarchy has no levels in it");
203 "MueLu::ReuseXpetraPreconditioner: Hierarchy has no fine level operator");
207 RCP<Matrix> A0 = Teuchos::rcp_dynamic_cast<Matrix>(O0);
213 A->SetFixedBlockSize(A0->GetFixedBlockSize());
223 const bool alwaysWriteLocal =
true;
224 const bool writeGlobalStats =
true;
225 const bool writeZeroTimers =
false;
226 const bool ignoreZeroTimers =
true;
227 const std::string filter = timerName;
229 writeZeroTimers, Teuchos::Union, filter, ignoreZeroTimers);
237 #define XPETRA_CREATEXPETRAPRECONDITIONER_SHORT
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.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
VerbLevel GetVerbLevel() const
Get the verbosity level.
static void AddNonSerializableDataToHierarchy(HierarchyManager &HM, Hierarchy &H, const ParameterList &nonSerialList)
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > > CreateXpetraPreconditioner(Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > op, const Teuchos::ParameterList &inParamList, Teuchos::RCP< Xpetra::MultiVector< double, LocalOrdinal, GlobalOrdinal, Node > > coords=Teuchos::null, Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > nullspace=Teuchos::null)
Helper function to create a MueLu preconditioner that can be used by Xpetra.Given an Xpetra::Matrix...
Ordinal numParams() const
Namespace for MueLu classes and methods.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
static RCP< Time > getNewTimer(const std::string &name)
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)
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)
Class that accepts ML-style parameters and builds a MueLu preconditioner. This interpreter uses the s...
virtual RCP< Hierarchy > CreateHierarchy() const
Create an empty Hierarchy object.
bool isParameter(const std::string &name) const
Exception throws to report errors in the internal logical of the program.
void setlib(Xpetra::UnderlyingLib inlib)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
long ExtractNonSerializableData(const Teuchos::ParameterList &inList, Teuchos::ParameterList &serialList, Teuchos::ParameterList &nonSerialList)