10 #ifndef MUELU_USERPFACTORY_DEF_HPP
11 #define MUELU_USERPFACTORY_DEF_HPP
13 #include <Xpetra_MultiVectorFactory.hpp>
18 #include "MueLu_PerfUtils.hpp"
23 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
29 validParamList->
set<std::string>(
"matrixFileName",
"",
"File with matrix data");
30 validParamList->
set<std::string>(
"mapFileName",
"",
"File with coarse map data");
32 return validParamList;
35 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
37 Input(fineLevel,
"A");
38 Input(fineLevel,
"Nullspace");
41 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
43 return BuildP(fineLevel, coarseLevel);
46 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
51 RCP<MultiVector> fineNullspace = Get<RCP<MultiVector> >(fineLevel,
"Nullspace");
57 std::string mapFile = pL.get<std::string>(
"mapFileName");
60 Set(coarseLevel,
"CoarseMap", coarseMap);
62 std::string matrixFile = pL.get<std::string>(
"matrixFileName");
65 Set(coarseLevel,
"P", P);
70 Set(coarseLevel,
"P", P);
73 RCP<MultiVector> coarseNullspace = MultiVectorFactory::Build(coarseMap, fineNullspace->getNumVectors());
75 Set(coarseLevel,
"Nullspace", coarseNullspace);
78 size_t n = Teuchos::as<size_t>(sqrt(coarseMap->getGlobalNumElements()));
82 ArrayRCP<Scalar> x = coarseCoords->getDataNonConst(0), y = coarseCoords->getDataNonConst(1);
83 for (
size_t LID = 0; LID < coarseMap->getLocalNumElements(); ++LID) {
84 GlobalOrdinal GID = coarseMap->getGlobalElement(LID) - coarseMap->getIndexBase();
89 Set(coarseLevel,
"Coordinates", coarseCoords);
93 params->
set(
"printLoadBalancingInfo",
true);
100 #define MUELU_USERPFACTORY_SHORT
101 #endif // MUELU_USERPFACTORY_DEF_HPP
void Build(Level &fineLevel, Level &coarseLevel) const
Build an object with this factory.
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.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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.