46 #ifndef MUELU_MATRIXFREETENTATIVEPFACTORY_DEF_HPP
47 #define MUELU_MATRIXFREETENTATIVEPFACTORY_DEF_HPP
49 #include "Kokkos_UnorderedMap.hpp"
53 #include "MueLu_Aggregates.hpp"
54 #include "MueLu_AmalgamationInfo.hpp"
56 #include "MueLu_MatrixFreeTentativeP.hpp"
60 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 validParamList->
set<
RCP<const FactoryBase>>(
"Scaled Nullspace", Teuchos::null,
"Generating factory of the scaled nullspace");
68 validParamList->
set<
RCP<const FactoryBase>>(
"UnAmalgamationInfo", Teuchos::null,
"Generating factory of UnAmalgamationInfo");
74 norecurse.disableRecursiveValidation();
75 validParamList->
set<
ParameterList>(
"matrixmatrix: kernel params", norecurse,
"MatrixMatrix kernel parameters");
77 return validParamList;
80 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
84 std::string nspName =
"Nullspace";
85 if (pL.
isParameter(
"Nullspace name")) nspName = pL.
get<std::string>(
"Nullspace name");
87 Input(fineLevel,
"Aggregates");
88 Input(fineLevel, nspName);
89 Input(fineLevel,
"UnAmalgamationInfo");
90 Input(fineLevel,
"CoarseMap");
93 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
95 return BuildP(fineLevel, coarseLevel);
98 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
103 std::string nspName =
"Nullspace";
104 if (pL.
isParameter(
"Nullspace name")) nspName = pL.
get<std::string>(
"Nullspace name");
106 auto aggregates = Get<RCP<Aggregates>>(fineLevel,
"Aggregates");
107 auto amalgInfo = Get<RCP<AmalgamationInfo>>(fineLevel,
"UnAmalgamationInfo");
108 auto fineNullspace = Get<RCP<MultiVector>>(fineLevel, nspName);
109 auto coarseMap = Get<RCP<const Map>>(fineLevel,
"CoarseMap");
113 if (aggregates->AggregatesCrossProcessors())
116 size_t NSDim = fineNullspace->getNumVectors();
117 RCP<MultiVector> coarseNullspace = MultiVectorFactory::Build(coarseMap, NSDim);
120 P->apply(*fineNullspace, *coarseNullspace,
Teuchos::TRANS, 1.0, 0.0);
122 Set(coarseLevel,
"Nullspace", coarseNullspace);
123 Set(coarseLevel,
"P", P);
128 #define MUELU_MATRIXFREETENTATIVEPFACTORY_SHORT
129 #endif // MUELU_MATRIXFREETENTATIVEPFACTORY_DEF_HPP
T & get(const std::string &name, T def_value)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Matrix-free tentative restrictor operator.
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
void BuildP(Level &fineLevel, Level &coarseLevel) const
Abstract Build method.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
Exception throws to report errors in the internal logical of the program.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.