46 #ifndef MUELU_USERPFACTORY_DEF_HPP
47 #define MUELU_USERPFACTORY_DEF_HPP
49 #include <Xpetra_MultiVectorFactory.hpp>
54 #include "MueLu_PerfUtils.hpp"
59 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 validParamList->
set<std::string>(
"matrixFileName",
"",
"File with matrix data");
66 validParamList->
set<std::string>(
"mapFileName",
"",
"File with coarse map data");
68 return validParamList;
71 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 Input(fineLevel,
"A");
74 Input(fineLevel,
"Nullspace");
77 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
79 return BuildP(fineLevel, coarseLevel);
82 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
87 RCP<MultiVector> fineNullspace = Get<RCP<MultiVector> >(fineLevel,
"Nullspace");
93 std::string mapFile = pL.get<std::string>(
"mapFileName");
96 Set(coarseLevel,
"CoarseMap", coarseMap);
98 std::string matrixFile = pL.get<std::string>(
"matrixFileName");
101 Set(coarseLevel,
"P", P);
106 Set(coarseLevel,
"P", P);
109 RCP<MultiVector> coarseNullspace = MultiVectorFactory::Build(coarseMap, fineNullspace->getNumVectors());
111 Set(coarseLevel,
"Nullspace", coarseNullspace);
114 size_t n = Teuchos::as<size_t>(sqrt(coarseMap->getGlobalNumElements()));
118 ArrayRCP<Scalar> x = coarseCoords->getDataNonConst(0), y = coarseCoords->getDataNonConst(1);
119 for (
size_t LID = 0; LID < coarseMap->getLocalNumElements(); ++LID) {
120 GlobalOrdinal GID = coarseMap->getGlobalElement(LID) - coarseMap->getIndexBase();
125 Set(coarseLevel,
"Coordinates", coarseCoords);
129 params->
set(
"printLoadBalancingInfo",
true);
136 #define MUELU_USERPFACTORY_SHORT
137 #endif // MUELU_USERPFACTORY_DEF_HPP
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void BuildP(Level &fineLevel, Level &coarseLevel) const
Abstract Build method.
void DeclareInput(Level &fineLevel, Level &coarseLevel) const
Input.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
static RCP< const Map > ReadMap(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm)
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
static std::string PrintMatrixInfo(const Matrix &A, const std::string &msgTag, RCP< const Teuchos::ParameterList > params=Teuchos::null)
static void Multiply(const Matrix &A, bool transposeA, const Matrix &B, bool transposeB, Matrix &C, bool call_FillComplete_on_result=true, bool doOptimizeStorage=true, const std::string &label=std::string(), const RCP< ParameterList > ¶ms=null)
static Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Read(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm, bool binary=false)
Exception throws to report errors in the internal logical of the program.