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"
24template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
26 RCP<ParameterList> validParamList = rcp(
new ParameterList());
28 validParamList->set<RCP<const FactoryBase>>(
"A", Teuchos::null,
"Generating factory of the matrix A");
29 validParamList->set<RCP<const FactoryBase>>(
"Aggregates", Teuchos::null,
"Generating factory of the aggregates");
30 validParamList->set<RCP<const FactoryBase>>(
"Nullspace", Teuchos::null,
"Generating factory of the nullspace");
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");
33 validParamList->set<RCP<const FactoryBase>>(
"CoarseMap", Teuchos::null,
"Generating factory of the coarse map");
34 validParamList->set<RCP<const FactoryBase>>(
"Coordinates", Teuchos::null,
"Generating factory of the coordinates");
37 ParameterList norecurse;
38 norecurse.disableRecursiveValidation();
39 validParamList->set<ParameterList>(
"matrixmatrix: kernel params", norecurse,
"MatrixMatrix kernel parameters");
41 return validParamList;
44template <
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");
57template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
59 return BuildP(fineLevel, coarseLevel);
62template <
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");
74 Teuchos::RCP<const Map> fineMap = fineNullspace->getMap();
77 if (aggregates->AggregatesCrossProcessors())
78 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MatrixFreeTentativePFactory does not support aggregates that cross processors!");
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
Exception throws to report errors in the internal logical of the program.
Timer to be used in factories. Similar to Monitor but with additional timers.
void Input(Level &level, const std::string &varName) const
T Get(Level &level, const std::string &varName) const
void Set(Level &level, const std::string &varName, const T &data) const
Class that holds all level-specific information.
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
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.
Matrix-free tentative restrictor operator.
virtual const Teuchos::ParameterList & GetParameterList() const
Namespace for MueLu classes and methods.