47 RCP<MultiVector> nullspace, tentativeNullspace;
55 tentativeNullspace = currentLevel.
Get<RCP<MultiVector> >(
"Nullspace",
NoFactory::get());
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) {
71 Xpetra::viewLabel_t oldView = A->SwitchToView(
"stridedMaps");
72 TEUCHOS_TEST_FOR_EXCEPTION(Teuchos::rcp_dynamic_cast<const StridedMap>(A->getRowMap()) == Teuchos::null,
Exceptions::BadCast,
"MueLu::ScaledNullspaceFactory::Build: cast to strided row map failed.");
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);
82 Xpetra::MatrixUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::extractBlockDiagonal(*A, *blockDiagonal);
83 Xpetra::MatrixUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::inverseScaleBlockDiagonal(*blockDiagonal,
true, *nullspace);
86 Set(currentLevel,
"Scaled Nullspace", nullspace);
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....