61 RCP<ParameterList> validParamList = rcp(
new ParameterList());
63 validParamList->set< RCP<const FactoryBase> >(
"A", Teuchos::null,
"Generating factory of the fine level matrix (only needed if default null space is generated)");
64 validParamList->set< RCP<const FactoryBase> >(
"Nullspace", Teuchos::null,
"Generating factory of the fine level null space");
67 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\"). For block matrices also \"Nullspace1\" to \"Nullspace9\" are accepted to describe the null space vectors for the (i,i) block (i=1..9).");
70 validParamList->set< RCP<const FactoryBase> >(
"Nullspace1", Teuchos::null,
"Generating factory of the fine level null space associated with the (1,1) block in your n x n block matrix.");
71 validParamList->set< RCP<const FactoryBase> >(
"Nullspace2", Teuchos::null,
"Generating factory of the fine level null space associated with the (2,2) block in your n x n block matrix.");
72 validParamList->set< RCP<const FactoryBase> >(
"Nullspace3", Teuchos::null,
"Generating factory of the fine level null space associated with the (3,3) block in your n x n block matrix.");
73 validParamList->set< RCP<const FactoryBase> >(
"Nullspace4", Teuchos::null,
"Generating factory of the fine level null space associated with the (4,4) block in your n x n block matrix.");
74 validParamList->set< RCP<const FactoryBase> >(
"Nullspace5", Teuchos::null,
"Generating factory of the fine level null space associated with the (5,5) block in your n x n block matrix.");
75 validParamList->set< RCP<const FactoryBase> >(
"Nullspace6", Teuchos::null,
"Generating factory of the fine level null space associated with the (6,6) block in your n x n block matrix.");
76 validParamList->set< RCP<const FactoryBase> >(
"Nullspace7", Teuchos::null,
"Generating factory of the fine level null space associated with the (7,7) block in your n x n block matrix.");
77 validParamList->set< RCP<const FactoryBase> >(
"Nullspace8", Teuchos::null,
"Generating factory of the fine level null space associated with the (8,8) block in your n x n block matrix.");
78 validParamList->set< RCP<const FactoryBase> >(
"Nullspace9", Teuchos::null,
"Generating factory of the fine level null space associated with the (9,9) block in your n x n block matrix.");
80 return validParamList;
132 RCP<MultiVector> nullspace;
135 const ParameterList& pL = GetParameterList();
136 std::string nspName = pL.get<std::string>(
"Fine level nullspace");
143 GetOStream(
Runtime1) <<
"Use user-given nullspace " << nspName <<
":"
144 <<
" nullspace dimension=" << nullspace->getNumVectors()
145 <<
" nullspace length=" << nullspace->getGlobalLength() << std::endl;
149 auto A = Get< RCP<Matrix> >(currentLevel,
"A");
153 if (A->IsView(
"stridedMaps") ==
true) {
154 Xpetra::viewLabel_t oldView = A->SwitchToView(
"stridedMaps");
155 TEUCHOS_TEST_FOR_EXCEPTION(rcp_dynamic_cast<const StridedMap>(A->getRowMap()).is_null(),
Exceptions::BadCast,
156 "MueLu::CoalesceFactory::Build: cast to strided row map failed.");
157 numPDEs = rcp_dynamic_cast<const StridedMap>(A->getRowMap())->getFixedBlockSize();
158 oldView = A->SwitchToView(oldView);
161 GetOStream(
Runtime1) <<
"Generating canonical nullspace: dimension = " << numPDEs << std::endl;
163 nullspace = MultiVectorFactory::Build(A->getDomainMap(), numPDEs);
164 auto nullspaceView = nullspace->getDeviceLocalView(Xpetra::Access::OverwriteAll);
166 int numBlocks = nullspace->getLocalLength() / numPDEs;
168 NullspaceFunctor<
decltype(nullspaceView), LO> nullspaceFunctor(nullspaceView, numPDEs);
169 Kokkos::parallel_for(
"MueLu:NullspaceF:Build:for",
range_type(0,numBlocks), nullspaceFunctor);
176 nullspace = currentLevel.
Get< RCP<MultiVector> >(
"Nullspace", GetFactory(nspName).get());
180 Set(currentLevel,
"Nullspace", nullspace);
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....