46 #ifndef MUELU_NULLSPACEPRESMOOTHFACTORY_DEF_HPP
47 #define MUELU_NULLSPACEPRESMOOTHFACTORY_DEF_HPP
49 #include <Xpetra_Matrix.hpp>
50 #include <Xpetra_MultiVector.hpp>
51 #include <Xpetra_MultiVectorFactory.hpp>
54 #include "MueLu_Utilities.hpp"
60 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 validParamList->
set<
RCP<const FactoryBase> >(
"Nullspace", Teuchos::null,
"Generating factory for the nonsmoothed nullspace");
67 return validParamList;
70 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
72 Input(currentLevel,
"Nullspace");
75 Input(currentLevel,
"A");
78 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 FactoryMonitor m(*
this,
"Nullspace presmooth factory", currentLevel);
84 RCP<Matrix> A = Get< RCP<Matrix> > (currentLevel,
"A");
86 newB = MultiVectorFactory::Build(B->getMap(), B->getNumVectors());
95 size_t numVec = newB->getNumVectors();
96 LO numElements = newB->getLocalLength();
97 for (
size_t j = 0; j < numVec; j++) {
101 for (LO i = 0; i < numElements; i++)
102 newBj[i] = Bj[i] - damping*newBj[i]/D[i];
105 newB = Get< RCP<MultiVector> >(currentLevel,
"Nullspace");
109 Set(currentLevel,
"Nullspace", newB);
115 #endif // MUELU_NULLSPACEPRESMOOTHFACTORY_DEF_HPP
static Teuchos::ArrayRCP< Scalar > GetMatrixDiagonal(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
void Build(Level ¤tLevel) 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.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
int GetLevelID() const
Return level number.
static Scalar PowerMethod(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, bool scaleByDiag=true, LocalOrdinal niters=10, Magnitude tolerance=1e-2, bool verbose=false, unsigned int seed=123)