MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_Amesos2Smoother_def.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef MUELU_AMESOS2SMOOTHER_DEF_HPP
11#define MUELU_AMESOS2SMOOTHER_DEF_HPP
12
13#include <algorithm>
14
15#include "KokkosLapack_potrf.hpp"
16#include "KokkosLapack_trtri.hpp"
17#include "Kokkos_Core_fwd.hpp"
18#include "MueLu_ConfigDefs.hpp"
19#include <Xpetra_Matrix.hpp>
20#include <Xpetra_IO.hpp>
21
22#include <Amesos2_config.h>
23#include <Amesos2.hpp>
24
26#include "MueLu_Level.hpp"
27#include "MueLu_Utilities.hpp"
28#include "MueLu_Monitor.hpp"
29#include "Tpetra_Access.hpp"
30
31namespace MueLu {
32
33template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
35 Projection(RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& Nullspace) {
36 localMap_ = Xpetra::MapFactory<LocalOrdinal, GlobalOrdinal, Node>::Build(Nullspace->getMap()->lib(),
37 Nullspace->getNumVectors(),
38 Nullspace->getMap()->getIndexBase(),
39 Nullspace->getMap()->getComm(),
40 Xpetra::LocallyReplicated);
41
42 Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > tempMV = Xpetra::MultiVectorFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Build(localMap_, Nullspace->getNumVectors(), false);
43 const Scalar ONE = Teuchos::ScalarTraits<Scalar>::one();
44 const Scalar ZERO = Teuchos::ScalarTraits<Scalar>::zero();
45 tempMV->multiply(Teuchos::CONJ_TRANS, Teuchos::NO_TRANS, ONE, *Nullspace, *Nullspace, ZERO);
46
47 Kokkos::View<typename Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::impl_scalar_type**, Kokkos::LayoutLeft, Kokkos::HostSpace> Q("Q", Nullspace->getNumVectors(), Nullspace->getNumVectors());
48 {
49 auto dots = tempMV->getLocalViewHost(Tpetra::Access::ReadOnly);
50 Kokkos::deep_copy(Q, dots);
51 }
52
53 KokkosLapack::potrf("L", Q);
54 int ret = KokkosLapack::trtri("L", "N", Q);
55 TEUCHOS_ASSERT(ret == 0);
56
57 Nullspace_ = Xpetra::MultiVectorFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Build(Nullspace->getMap(), Nullspace->getNumVectors());
58
59 for (size_t i = 0; i < Nullspace->getNumVectors(); i++) {
60 for (size_t j = 0; j <= i; j++) {
61 Nullspace_->getVectorNonConst(i)->update(Q(i, j), *Nullspace->getVector(j), ONE);
62 }
63 }
64}
65
66template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
68 projectOut(Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& X) {
69 const Scalar ONE = Teuchos::ScalarTraits<Scalar>::one();
70 const Scalar ZERO = Teuchos::ScalarTraits<Scalar>::zero();
71
72 // Project X onto orthonormal nullspace
73 // Nullspace_ ^T * X
74 if (tempMV_.is_null() || tempMV_->getNumVectors() != X.getNumVectors())
75 tempMV_ = Xpetra::MultiVectorFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Build(localMap_, X.getNumVectors());
76 Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& tempMV = tempMV_;
77 tempMV->multiply(Teuchos::CONJ_TRANS, Teuchos::NO_TRANS, ONE, *Nullspace_, X, ZERO);
78 auto dots = tempMV->getLocalViewHost(Tpetra::Access::ReadOnly);
79 bool doProject = true;
80 for (size_t i = 0; i < X.getNumVectors(); i++) {
81 for (size_t j = 0; j < Nullspace_->getNumVectors(); j++) {
82 doProject = doProject || (Teuchos::ScalarTraits<Scalar>::magnitude(dots(j, i)) > 100 * Teuchos::ScalarTraits<Scalar>::eps());
83 }
84 }
85 if (doProject) {
86 for (size_t i = 0; i < X.getNumVectors(); i++) {
87 for (size_t j = 0; j < Nullspace_->getNumVectors(); j++) {
88 X.getVectorNonConst(i)->update(-dots(j, i), *Nullspace_->getVector(j), ONE);
89 }
90 }
91 }
92}
93
94template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
95Amesos2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Amesos2Smoother(const std::string& type, const Teuchos::ParameterList& paramList)
96 : type_(type)
97 , useTransformation_(false) {
98 this->SetParameterList(paramList);
99
100 if (!type_.empty()) {
101 // Transform string to "Abcde" notation
102 std::transform(type_.begin(), type_.end(), type_.begin(), ::tolower);
103 std::transform(type_.begin(), ++type_.begin(), type_.begin(), ::toupper);
104 }
105 if (type_ == "Superlu_dist")
106 type_ = "Superludist";
107
108 // Try to come up with something availble
109 // Order corresponds to our preference
110 // TODO: It would be great is Amesos2 provides directly this kind of logic for us
111 if (type_ == "" || Amesos2::query(type_) == false) {
112 std::string oldtype = type_;
113#if defined(HAVE_AMESOS2_KLU2)
114 type_ = "Klu";
115#elif defined(HAVE_AMESOS2_SUPERLU)
116 type_ = "Superlu";
117#elif defined(HAVE_AMESOS2_SUPERLUDIST)
118 type_ = "Superludist";
119#elif defined(HAVE_AMESOS2_BASKER)
120 type_ = "Basker";
121#else
122 this->declareConstructionOutcome(true, std::string("Amesos2 has been compiled without SuperLU_DIST, SuperLU, Klu, or Basker. By default, MueLu tries") +
123 "to use one of these libraries. Amesos2 must be compiled with one of these solvers, " +
124 "or a valid Amesos2 solver has to be specified explicitly.");
125 return;
126#endif
127 if (oldtype != "")
128 this->GetOStream(Warnings0) << "MueLu::Amesos2Smoother: \"" << oldtype << "\" is not available. Using \"" << type_ << "\" instead" << std::endl;
129 else
130 this->GetOStream(Runtime1) << "MueLu::Amesos2Smoother: using \"" << type_ << "\"" << std::endl;
131 }
132
133 // Check the validity of the solver type parameter
134 this->declareConstructionOutcome(Amesos2::query(type_) == false, "The Amesos2 library reported that the solver '" + type_ + "' is not available. " +
135 "Amesos2 has been compiled without the support of this solver, or the solver name is misspelled.");
136}
137
138template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
140
141template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
143 RCP<ParameterList> validParamList = rcp(new ParameterList());
144 validParamList->set<RCP<const FactoryBase> >("A", null, "Factory of the coarse matrix");
145 validParamList->set<RCP<const FactoryBase> >("Nullspace", null, "Factory of the nullspace");
146 validParamList->set<bool>("fix nullspace", false, "Remove zero eigenvalue by adding rank one correction.");
147 ParameterList norecurse;
148 norecurse.disableRecursiveValidation();
149 validParamList->set<ParameterList>("Amesos2", norecurse, "Parameters that are passed to Amesos2");
150 return validParamList;
151}
152
153template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
155 ParameterList pL = this->GetParameterList();
156
157 this->Input(currentLevel, "A");
158 if (pL.get<bool>("fix nullspace"))
159 this->Input(currentLevel, "Nullspace");
160}
161
162template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
164 FactoryMonitor m(*this, "Setup Smoother", currentLevel);
165
166 if (SmootherPrototype::IsSetup() == true)
167 this->GetOStream(Warnings0) << "MueLu::Amesos2Smoother::Setup(): Setup() has already been called" << std::endl;
168
169 RCP<Matrix> A = Factory::Get<RCP<Matrix> >(currentLevel, "A");
170 auto A_block = rcp_dynamic_cast<BlockedCrsMatrix>(A);
171 if (A_block) {
172 A = A_block->Merge();
173 }
174
175 // Do a quick check if we need to modify the matrix
176 RCP<const Map> rowMap = A->getRowMap();
177 RCP<Matrix> factorA;
178 Teuchos::ParameterList pL = this->GetParameterList();
179
180 if (pL.get<bool>("fix nullspace")) {
181 this->GetOStream(Runtime1) << "MueLu::Amesos2Smoother::Setup(): fixing nullspace" << std::endl;
182
183 rowMap = A->getRowMap();
184 auto tpRowMap = Xpetra::toTpetra(rowMap);
185 if (!tpRowMap->haveGlobalConstants()) {
186 Teuchos::rcp_const_cast<Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >(tpRowMap)->computeGlobalConstants();
187 }
188 size_t gblNumCols = rowMap->getGlobalNumElements();
189
190 RCP<MultiVector> NullspaceOrig = Factory::Get<RCP<MultiVector> >(currentLevel, "Nullspace");
191
193 RCP<MultiVector> Nullspace = projection_->Nullspace_;
194
195 RCP<MultiVector> ghostedNullspace;
196 RCP<const Map> colMap;
197 RCP<const Import> importer;
198 if (rowMap->getComm()->getSize() > 1) {
199 this->GetOStream(Warnings0) << "MueLu::Amesos2Smoother::Setup(): Applying nullspace fix on distributed matrix. Try rebalancing to single rank!" << std::endl;
200 ArrayRCP<GO> elements_RCP;
201 elements_RCP.resize(gblNumCols);
202 ArrayView<GO> elements = elements_RCP();
203 for (size_t k = 0; k < gblNumCols; k++)
204 elements[k] = Teuchos::as<GO>(k);
205 colMap = MapFactory::Build(rowMap->lib(), gblNumCols * rowMap->getComm()->getSize(), elements, Teuchos::ScalarTraits<GO>::zero(), rowMap->getComm());
206 importer = ImportFactory::Build(rowMap, colMap);
207 ghostedNullspace = MultiVectorFactory::Build(colMap, Nullspace->getNumVectors(), false);
208 ghostedNullspace->doImport(*Nullspace, *importer, Xpetra::INSERT);
209 } else {
210 ghostedNullspace = Nullspace;
211 colMap = rowMap;
212 }
213
214 using ATS = KokkosKernels::ArithTraits<SC>;
215 using impl_Scalar = typename ATS::val_type;
216 using impl_ATS = KokkosKernels::ArithTraits<impl_Scalar>;
217 using range_type = Kokkos::RangePolicy<LO, typename NO::execution_space>;
218
219 typedef typename Matrix::local_matrix_device_type KCRS;
220 typedef typename KCRS::StaticCrsGraphType graph_t;
221 typedef typename graph_t::row_map_type::non_const_type lno_view_t;
222 typedef typename graph_t::entries_type::non_const_type lno_nnz_view_t;
223 typedef typename KCRS::values_type::non_const_type scalar_view_t;
224
225 const impl_Scalar impl_SC_ZERO = impl_ATS::zero();
226
227 size_t lclNumRows = rowMap->getLocalNumElements();
228 LocalOrdinal lclNumCols = Teuchos::as<LocalOrdinal>(gblNumCols);
229 lno_view_t newRowPointers("newRowPointers", lclNumRows + 1);
230 lno_nnz_view_t newColIndices("newColIndices", lclNumRows * gblNumCols);
231 scalar_view_t newValues("newValues", lclNumRows * gblNumCols);
232
233 impl_Scalar shift;
234 {
235 RCP<Vector> diag = VectorFactory::Build(A->getRowMap());
236 A->getLocalDiagCopy(*diag);
237 shift = diag->normInf();
238 }
239
240 // form normalization * nullspace * nullspace^T
241 {
242 auto lclNullspace = Nullspace->getLocalViewDevice(Tpetra::Access::ReadOnly);
243 auto lclGhostedNullspace = ghostedNullspace->getLocalViewDevice(Tpetra::Access::ReadOnly);
244 Kokkos::parallel_for(
245 "MueLu:Amesos2Smoother::fixNullspace_1", range_type(0, lclNumRows + 1),
246 KOKKOS_LAMBDA(const size_t i) {
247 if (i < lclNumRows) {
248 newRowPointers(i) = i * gblNumCols;
249 for (LocalOrdinal j = 0; j < lclNumCols; j++) {
250 newColIndices(i * gblNumCols + j) = j;
251 newValues(i * gblNumCols + j) = impl_SC_ZERO;
252 for (size_t I = 0; I < lclNullspace.extent(1); I++)
253 for (size_t J = 0; J < lclGhostedNullspace.extent(1); J++)
254 newValues(i * gblNumCols + j) += shift * lclNullspace(i, I) * impl_ATS::conjugate(lclGhostedNullspace(j, J));
255 }
256 } else
257 newRowPointers(lclNumRows) = lclNumRows * gblNumCols;
258 });
259 }
260
261 // add A
262 if (colMap->lib() == Xpetra::UseTpetra) {
263 auto lclA = A->getLocalMatrixDevice();
264 auto lclColMapA = A->getColMap()->getLocalMap();
265 auto lclColMapANew = colMap->getLocalMap();
266 Kokkos::parallel_for(
267 "MueLu:Amesos2Smoother::fixNullspace_2", range_type(0, lclNumRows),
268 KOKKOS_LAMBDA(const size_t i) {
269 for (size_t jj = lclA.graph.row_map(i); jj < lclA.graph.row_map(i + 1); jj++) {
270 LO j = lclColMapANew.getLocalElement(lclColMapA.getGlobalElement(lclA.graph.entries(jj)));
271 impl_Scalar v = lclA.values(jj);
272 newValues(i * gblNumCols + j) += v;
273 }
274 });
275 } else {
276 auto lclA = A->getLocalMatrixHost();
277 for (size_t i = 0; i < lclNumRows; i++) {
278 for (size_t jj = lclA.graph.row_map(i); jj < lclA.graph.row_map(i + 1); jj++) {
279 LO j = colMap->getLocalElement(A->getColMap()->getGlobalElement(lclA.graph.entries(jj)));
280 SC v = lclA.values(jj);
281 newValues(i * gblNumCols + j) += v;
282 }
283 }
284 }
285
286 RCP<Matrix> newA = rcp(new CrsMatrixWrap(rowMap, colMap, 0));
287 RCP<CrsMatrix> newAcrs = toCrsMatrix(newA);
288 newAcrs->setAllValues(newRowPointers, newColIndices, newValues);
289 newAcrs->expertStaticFillComplete(A->getDomainMap(), A->getRangeMap(),
290 importer, A->getCrsGraph()->getExporter());
291
292 factorA = newA;
293 rowMap = factorA->getRowMap();
294 } else {
295 factorA = A;
296 }
297
298 RCP<Tpetra_CrsMatrix> tA = toTpetra(factorA);
299 if (!tA->haveGlobalConstants())
300 Teuchos::rcp_const_cast<typename Tpetra_CrsMatrix::crs_graph_type>(tA->getCrsGraph())->computeGlobalConstants();
301
302 prec_ = Amesos2::create<Tpetra_CrsMatrix, Tpetra_MultiVector>(type_, tA);
303 TEUCHOS_TEST_FOR_EXCEPTION(prec_ == Teuchos::null, Exceptions::RuntimeError, "Amesos2::create returns Teuchos::null");
304 RCP<Teuchos::ParameterList> amesos2_params = Teuchos::rcpFromRef(pL.sublist("Amesos2"));
305 amesos2_params->setName("Amesos2");
306 if ((rowMap->getGlobalNumElements() != as<size_t>((rowMap->getMaxAllGlobalIndex() - rowMap->getMinAllGlobalIndex()) + 1)) ||
307 (!rowMap->isContiguous() && (rowMap->getComm()->getSize() == 1))) {
308 if (((type_ != "Cusolver") && (type_ != "Tacho")) && !(amesos2_params->sublist(prec_->name()).template isType<bool>("IsContiguous")))
309 amesos2_params->sublist(prec_->name()).set("IsContiguous", false, "Are GIDs Contiguous");
310 }
311 prec_->setParameters(amesos2_params);
312
313 prec_->numericFactorization();
314
316}
317
318template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
319void Amesos2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Apply(MultiVector& X, const MultiVector& B, bool /* InitialGuessIsZero */) const {
320 TEUCHOS_TEST_FOR_EXCEPTION(SmootherPrototype::IsSetup() == false, Exceptions::RuntimeError, "MueLu::Amesos2Smoother::Apply(): Setup() has not been called");
321
322 RCP<BlockedMultiVector> blockedX = rcp_dynamic_cast<BlockedMultiVector>(rcpFromRef(X));
323 bool blocked = blockedX != Teuchos::null;
324 if (blocked) {
325 this->ApplyBlocked(X, B);
326 return;
327 }
328
329 RCP<Tpetra_MultiVector> tX, tB;
330 if (!useTransformation_) {
331 tX = toTpetra(Teuchos::rcpFromRef(X));
332 tB = toTpetra(Teuchos::rcpFromRef(const_cast<MultiVector&>(B)));
333 } else {
334 // Copy data of the original vectors into the transformed ones
335 size_t numVectors = X.getNumVectors();
336 size_t length = X.getLocalLength();
337
338 TEUCHOS_TEST_FOR_EXCEPTION(numVectors > 1, Exceptions::RuntimeError,
339 "MueLu::Amesos2Smoother::Apply: Fixing coarse matrix for Amesos2 for multivectors has not been implemented yet.");
340 ArrayRCP<const SC> Xdata = X.getData(0), Bdata = B.getData(0);
341 ArrayRCP<SC> X_data = X_->getDataNonConst(0), B_data = B_->getDataNonConst(0);
342
343 for (size_t i = 0; i < length; i++) {
344 X_data[i] = Xdata[i];
345 B_data[i] = Bdata[i];
346 }
347
348 tX = toTpetra(X_);
349 tB = toTpetra(B_);
350 }
351
352 prec_->setX(tX);
353 prec_->setB(tB);
354
355 prec_->solve();
356
357 prec_->setX(Teuchos::null);
358 prec_->setB(Teuchos::null);
359
360 if (useTransformation_) {
361 // Copy data from the transformed vectors into the original ones
362 size_t length = X.getLocalLength();
363
364 ArrayRCP<SC> Xdata = X.getDataNonConst(0);
365 ArrayRCP<const SC> X_data = X_->getData(0);
366
367 for (size_t i = 0; i < length; i++)
368 Xdata[i] = X_data[i];
369 }
370
371 {
372 Teuchos::ParameterList pL = this->GetParameterList();
373 if (pL.get<bool>("fix nullspace")) {
374 projection_->projectOut(X);
375 }
376 }
377}
378
379template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
380void Amesos2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::ApplyBlocked(MultiVector& X, const MultiVector& B) const {
381 TEUCHOS_TEST_FOR_EXCEPTION(useTransformation_, Exceptions::RuntimeError,
382 "MueLu::Amesos2Smoother::ApplyBlocked: useTransformation_ == true is not supported");
383
384 Teuchos::ParameterList pL = this->GetParameterList();
385 const auto fixNullspace = pL.get<bool>("fix nullspace");
386 TEUCHOS_TEST_FOR_EXCEPTION(fixNullspace, Exceptions::RuntimeError,
387 "MueLu::Amesos2Smoother::ApplyBlocked: \"fix nullspace\" == true is not supported");
388
389 RCP<BlockedMultiVector> blockedX = rcp_dynamic_cast<BlockedMultiVector>(rcpFromRef(X));
390 RCP<const BlockedMultiVector> blockedB = rcp_dynamic_cast<const BlockedMultiVector>(rcpFromRef(B));
391 TEUCHOS_TEST_FOR_EXCEPTION(blockedX == Teuchos::null || blockedB == Teuchos::null, Exceptions::RuntimeError,
392 "MueLu::Amesos2Smoother::ApplyBlocked: Input and/or output vector are not BlockedMultiVector!");
393
394 RCP<MultiVector> mergedX = blockedX->Merge();
395 RCP<MultiVector> mergedB = blockedB->Merge();
396
397 RCP<Tpetra_MultiVector> tX, tB;
398 tX = toTpetra(mergedX);
399 tB = toTpetra(mergedB);
400
401 prec_->setX(tX);
402 prec_->setB(tB);
403
404 prec_->solve();
405
406 prec_->setX(Teuchos::null);
407 prec_->setB(Teuchos::null);
408
409 RCP<MultiVector> xx = Teuchos::rcp(new BlockedMultiVector(blockedX->getBlockedMap(), mergedX));
410 SC zero = Teuchos::ScalarTraits<SC>::zero(), one = Teuchos::ScalarTraits<SC>::one();
411 X.update(one, *xx, zero);
412}
413
414template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
415RCP<MueLu::SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
420
421template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
423 std::ostringstream out;
424
425 if (SmootherPrototype::IsSetup() == true) {
426 out << prec_->description();
427
428 } else {
430 out << "{type = " << type_ << "}";
431 }
432 return out.str();
433}
434
435template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
436void Amesos2Smoother<Scalar, LocalOrdinal, GlobalOrdinal, Node>::print(Teuchos::FancyOStream& out, const VerbLevel verbLevel) const {
438
439 if (verbLevel & Parameters0)
440 out0 << "Prec. type: " << type_ << std::endl;
441
442 if (verbLevel & Parameters1) {
443 out0 << "Parameter list: " << std::endl;
444 Teuchos::OSTab tab2(out);
445 out << this->GetParameterList();
446 }
447
448 if ((verbLevel & External) && prec_ != Teuchos::null) {
449 Teuchos::OSTab tab2(out);
450 out << *prec_ << std::endl;
451 }
452
453 if (verbLevel & Debug)
454 out0 << "IsSetup: " << Teuchos::toString(SmootherPrototype::IsSetup()) << std::endl
455 << "-" << std::endl
456 << "RCP<prec_>: " << prec_ << std::endl;
457}
458
459template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
461 if (!prec_.is_null())
462 return prec_->getStatus().getNnzLU();
463 else
464 return 0.0;
465}
466} // namespace MueLu
467
468#endif // MUELU_AMESOS2SMOOTHER_DEF_HPP
#define MUELU_DESCRIBE
Helper macro for implementing Describable::describe() for BaseClass objects.
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
void DeclareInput(Level &currentLevel) const
Input.
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
std::string type_
amesos2-specific key phrase that denote smoother type
void ApplyBlocked(MultiVector &X, const MultiVector &B) const
RCP< SmootherPrototype > Copy() const
std::string description() const
Return a simple one-line description of this object.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
RCP< Projection< Scalar, LocalOrdinal, GlobalOrdinal, Node > > projection_
RCP< Amesos2::Solver< Tpetra_CrsMatrix, Tpetra_MultiVector > > prec_
pointer to Amesos2 solver object
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void Setup(Level &currentLevel)
Set up the direct solver. This creates the underlying Amesos2 solver object according to the paramete...
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply the direct solver. Solves the linear system AX=B using the constructed solver.
Amesos2Smoother(const std::string &type="", const Teuchos::ParameterList &paramList=Teuchos::ParameterList())
Constructor Creates a MueLu interface to the direct solvers in the Amesos2 package....
virtual std::string description() const
Return a simple one-line description of this object.
Exception throws to report errors in the internal logical of the program.
void Input(Level &level, const std::string &varName) const
T Get(Level &level, const std::string &varName) const
Timer to be used in factories. Similar to Monitor but with additional timers.
Class that holds all level-specific information.
virtual void SetParameterList(const Teuchos::ParameterList &paramList)
Set parameters from a parameter list and return with default values.
virtual const Teuchos::ParameterList & GetParameterList() const
Projection(RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &Nullspace)
void projectOut(Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X)
Teuchos::RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > localMap_
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > tempMV_
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Nullspace_
void declareConstructionOutcome(bool fail, std::string msg)
bool IsSetup() const
Get the state of a smoother prototype.
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
Namespace for MueLu classes and methods.
@ Warnings0
Important warning messages (one line).
@ Debug
Print additional debugging information.
@ External
Print external lib objects.
@ Runtime1
Description of what is happening (more verbose).
@ Parameters0
Print class parameters.
@ Parameters1
Print class parameters (more parameters, more verbose).