10 #ifndef MUELU_SCALEDNULLSPACEFACTORY_DEF_HPP
11 #define MUELU_SCALEDNULLSPACEFACTORY_DEF_HPP
15 #include <Xpetra_MultiVectorFactory.hpp>
16 #include <Xpetra_BlockedMultiVector.hpp>
25 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
28 validParamList->
set<std::string>(
"Fine level nullspace",
"Nullspace",
"Variable name which is used to store null space multi vector on the finest level (default=\"Nullspace\").");
30 validParamList->
set<
RCP<const FactoryBase> >(
"A", Teuchos::null,
"Generating factory of the fine level matrix (only needed if default null space is generated)");
31 validParamList->
set<
RCP<const FactoryBase> >(
"Nullspace", Teuchos::null,
"Generating factory of the fine level null space");
33 return validParamList;
36 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
39 Input(currentLevel,
"A");
40 Input(currentLevel,
"Nullspace");
43 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
58 tentativeNullspace = currentLevel.
Get<
RCP<MultiVector> >(
"Nullspace", GetFactory(
"Nullspace").get());
62 tentativeNullspace = currentLevel.
Get<
RCP<MultiVector> >(
"Nullspace", GetFactory(
"Nullspace").get());
66 RCP<Matrix> A = Get<RCP<Matrix> >(currentLevel,
"A");
70 if (A->IsView(
"stridedMaps") ==
true) {
73 numPDEs = Teuchos::rcp_dynamic_cast<
const StridedMap>(A->getRowMap())->getFixedBlockSize();
74 oldView = A->SwitchToView(oldView);
77 GetOStream(
Runtime1) <<
"ScaledNullspaceFactory: Generating scaled nullspace, blocksize = " << tentativeNullspace->getNumVectors() << std::endl;
78 nullspace = MultiVectorFactory::Build(tentativeNullspace->getMap(), tentativeNullspace->getNumVectors());
79 *nullspace = *tentativeNullspace;
80 RCP<MultiVector> blockDiagonal = MultiVectorFactory::Build(A->getDomainMap(), numPDEs);
86 Set(currentLevel,
"Scaled Nullspace", nullspace);
92 #endif // MUELU_SCALEDNULLSPACEFACTORY_DEF_HPP
Exception indicating invalid cast attempted.
void Build(Level ¤tLevel) const
Build an object with this factory.
MueLu::DefaultLocalOrdinal LocalOrdinal
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level->Get< RCP<Matrix> >("A", factory) if factory == NULL => use default factory.
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)
static const NoFactory * get()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
RCP< const ParameterList > GetValidParameterList() const
Define valid parameters for internal factory parameters.
static void inverseScaleBlockDiagonal(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &blockDiagonal, bool doTranspose, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &toBeScaled)
static void extractBlockDiagonal(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diagonal)
int GetLevelID() const
Return level number.
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
Description of what is happening (more verbose)
bool IsAvailable(const std::string &ename, const FactoryBase *factory=NoFactory::get()) const
Test whether a need's value has been saved.