10#ifndef MUELU_MATRIXTRANSFER_FACTORY_DEF_HPP
11#define MUELU_MATRIXTRANSFER_FACTORY_DEF_HPP
15#include <Xpetra_Matrix.hpp>
23template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
25 RCP<ParameterList> validParamList = rcp(
new ParameterList());
26#define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
35 validParamList->set<std::string>(
"Matrix name",
"A",
"Name of the matrix that will be transferred on the coarse grid (level key)");
36 validParamList->set<std::string>(
"Restrictor name",
"R",
"Name of the operator that will be used to transfer data");
37 validParamList->set<std::string>(
"Prolongator name",
"P",
"Name of the operator that will be used to transfer data");
39 validParamList->set<RCP<const FactoryBase>>(
"A", Teuchos::null,
"Generating factory of the matrix A used during the prolongator smoothing process");
40 validParamList->set<RCP<const FactoryBase>>(
"P", Teuchos::null,
"Prolongator factory");
41 validParamList->set<RCP<const FactoryBase>>(
"R", Teuchos::null,
"Restrictor factory");
43 validParamList->set<
bool>(
"CheckMainDiagonal",
false,
"Check main diagonal for zeros");
44 validParamList->set<
bool>(
"RepairMainDiagonal",
false,
"Repair zeros on main diagonal");
47 ParameterList norecurse;
48 norecurse.disableRecursiveValidation();
49 validParamList->set<ParameterList>(
"matrixmatrix: kernel params", norecurse,
"MatrixMatrix kernel parameters");
51 return validParamList;
54template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
56 const ParameterList &pL = GetParameterList();
57 std::string matrixName = pL.get<std::string>(
"Matrix name");
58 fineLevel.
DeclareInput(matrixName, GetFactory(
"A").get(),
this);
60 std::string prolongatorName = pL.get<std::string>(
"Prolongator name");
61 coarseLevel.
DeclareInput(prolongatorName, GetFactory(
"P").get(),
this);
63 if (!pL.get<
bool>(
"transpose: use implicit")) {
64 std::string restrictorName = pL.get<std::string>(
"Restrictor name");
65 coarseLevel.
DeclareInput(restrictorName, GetFactory(
"R").get(),
this);
69template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 const ParameterList &pL = GetParameterList();
74 const std::string matrixName = pL.get<std::string>(
"Matrix name");
75 const std::string prolongatorName = pL.get<std::string>(
"Prolongator name");
81 A = fineLevel.
Get<RCP<Matrix>>(matrixName, GetFactory(
"A").get());
82 P = coarseLevel.
Get<RCP<Matrix>>(prolongatorName, GetFactory(
"P").get());
83 if (!pL.get<
bool>(
"transpose: use implicit")) {
84 const std::string restrictorName = pL.get<std::string>(
"Restrictor name");
85 R = coarseLevel.
Get<RCP<Matrix>>(restrictorName, GetFactory(
"R").get());
87 Teuchos::RCP<Teuchos::ParameterList> APparams;
88 Teuchos::RCP<Teuchos::ParameterList> RAPparams;
90 Set<RCP<Matrix>>(coarseLevel, matrixName, Ac);
#define SET_VALID_ENTRY(name)
Timer to be used in factories. Similar to Monitor but with additional timers.
Class that holds all level-specific information.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
void DeclareInput(Level &finelevel, Level &coarseLevel) const
Specifies the data that this class needs, and the factories that generate that data.
static void TripleMatrixProduct(const Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &R, const Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &A, const Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &P, Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &Ac, const Teuchos::ParameterList &pL, const MueLu::BaseClass &verbObj, Teuchos::RCP< Teuchos::ParameterList > &APparams, Teuchos::RCP< Teuchos::ParameterList > &RAPparams, Level *coarseLevel=nullptr)
Namespace for MueLu classes and methods.