127 "MueLu::BlockedDirectSolver::Apply(): Setup() has not been called");
129 RCP<MultiVector> rcpX = Teuchos::rcpFromRef(X);
130 RCP<const MultiVector> rcpB = Teuchos::rcpFromRef(B);
131 RCP<BlockedMultiVector> bX = Teuchos::rcp_dynamic_cast<BlockedMultiVector>(rcpX);
132 RCP<const BlockedMultiVector> bB = Teuchos::rcp_dynamic_cast<const BlockedMultiVector>(rcpB);
134#ifdef HAVE_MUELU_DEBUG
135 RCP<BlockedCrsMatrix> bA = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(A_);
136 if(bB.is_null() ==
false) {
139 TEUCHOS_TEST_FOR_EXCEPTION(bA->getFullRangeMap()->isSameAs(*(B.getMap())) ==
false,
Exceptions::RuntimeError,
"MueLu::BlockedDirectSolver::Apply(): The map of RHS vector B is not the same as range map of the blocked operator A. Please check the map of B and A.");
141 if(bX.is_null() ==
false) {
144 TEUCHOS_TEST_FOR_EXCEPTION(bA->getFullDomainMap()->isSameAs(*(X.getMap())) ==
false,
Exceptions::RuntimeError,
"MueLu::BlockedDirectSolver::Apply(): The map of the solution vector X is not the same as domain map of the blocked operator A. Please check the map of X and A.");
148 if (bB.is_null() ==
true && bX.is_null() ==
true) {
150 s_->Apply(X, B, InitialGuessIsZero);
151 }
else if(bB.is_null() ==
false && bX.is_null() ==
false) {
153 RCP<MultiVector> mergedX = bX->Merge();
154 RCP<const MultiVector> mergedB = bB->Merge();
155 s_->Apply(*mergedX, *mergedB, InitialGuessIsZero);
156 RCP<MultiVector> xx = Teuchos::rcp(
new BlockedMultiVector(bX->getBlockedMap(),mergedX));
157 SC zero = Teuchos::ScalarTraits<SC>::zero(), one = Teuchos::ScalarTraits<SC>::one();
158 X.update(one,*xx,zero);
159 }
else if (bB.is_null() ==
true && bX.is_null() ==
false) {
161 RCP<MultiVector> mergedX = bX->Merge();
162 s_->Apply(*mergedX, B, InitialGuessIsZero);
163 RCP<MultiVector> xx = Teuchos::rcp(
new BlockedMultiVector(bX->getBlockedMap(),mergedX));
164 SC zero = Teuchos::ScalarTraits<SC>::zero(), one = Teuchos::ScalarTraits<SC>::one();
165 X.update(one,*xx,zero);
166 }
else if (bB.is_null() ==
false && bX.is_null() ==
true) {
168 RCP<const MultiVector> mergedB = bB->Merge();
169 s_->Apply(X, *mergedB, InitialGuessIsZero);
174 RCP<MueLu::SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()