10 #ifndef MUELU_MATRIXFREETENTATIVEPFACTORY_DEF_HPP
11 #define MUELU_MATRIXFREETENTATIVEPFACTORY_DEF_HPP
13 #include "Kokkos_UnorderedMap.hpp"
17 #include "MueLu_Aggregates.hpp"
18 #include "MueLu_AmalgamationInfo.hpp"
20 #include "MueLu_MatrixFreeTentativeP.hpp"
24 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
31 validParamList->
set<
RCP<const FactoryBase>>(
"Scaled Nullspace", Teuchos::null,
"Generating factory of the scaled nullspace");
32 validParamList->
set<
RCP<const FactoryBase>>(
"UnAmalgamationInfo", Teuchos::null,
"Generating factory of UnAmalgamationInfo");
38 norecurse.disableRecursiveValidation();
39 validParamList->
set<
ParameterList>(
"matrixmatrix: kernel params", norecurse,
"MatrixMatrix kernel parameters");
41 return validParamList;
44 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
48 std::string nspName =
"Nullspace";
49 if (pL.
isParameter(
"Nullspace name")) nspName = pL.
get<std::string>(
"Nullspace name");
51 Input(fineLevel,
"Aggregates");
52 Input(fineLevel, nspName);
53 Input(fineLevel,
"UnAmalgamationInfo");
54 Input(fineLevel,
"CoarseMap");
57 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
59 return BuildP(fineLevel, coarseLevel);
62 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 std::string nspName =
"Nullspace";
68 if (pL.
isParameter(
"Nullspace name")) nspName = pL.
get<std::string>(
"Nullspace name");
70 auto aggregates = Get<RCP<Aggregates>>(fineLevel,
"Aggregates");
71 auto amalgInfo = Get<RCP<AmalgamationInfo>>(fineLevel,
"UnAmalgamationInfo");
72 auto fineNullspace = Get<RCP<MultiVector>>(fineLevel, nspName);
73 auto coarseMap = Get<RCP<const Map>>(fineLevel,
"CoarseMap");
77 if (aggregates->AggregatesCrossProcessors())
80 size_t NSDim = fineNullspace->getNumVectors();
81 RCP<MultiVector> coarseNullspace = MultiVectorFactory::Build(coarseMap, NSDim);
84 P->apply(*fineNullspace, *coarseNullspace,
Teuchos::TRANS, 1.0, 0.0);
86 Set(coarseLevel,
"Nullspace", coarseNullspace);
87 Set(coarseLevel,
"P", P);
92 #define MUELU_MATRIXFREETENTATIVEPFACTORY_SHORT
93 #endif // MUELU_MATRIXFREETENTATIVEPFACTORY_DEF_HPP
T & get(const std::string &name, T def_value)
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)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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.