Ifpack2 Templated Preconditioning Package Version 1.0
Loading...
Searching...
No Matches
Ifpack2_Hiptmair_def.hpp
1// @HEADER
2// *****************************************************************************
3// Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
4//
5// Copyright 2009 NTESS and the Ifpack2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef IFPACK2_HIPTMAIR_DEF_HPP
11#define IFPACK2_HIPTMAIR_DEF_HPP
12
13#include "Ifpack2_Details_OneLevelFactory.hpp"
14#include "Ifpack2_Parameters.hpp"
15#include "Teuchos_TimeMonitor.hpp"
16#include "Tpetra_MultiVector.hpp"
17#include "Tpetra_Details_residual.hpp"
18#include <Tpetra_RowMatrixTransposer.hpp>
19#include <cmath>
20#include <iostream>
21#include <sstream>
22
23namespace Ifpack2 {
24
25template <class MatrixType>
27 Hiptmair(const Teuchos::RCP<const row_matrix_type>& A,
28 const Teuchos::RCP<const row_matrix_type>& PtAP,
29 const Teuchos::RCP<const row_matrix_type>& P,
30 const Teuchos::RCP<const row_matrix_type>& Pt)
31 : A_(A)
32 , PtAP_(PtAP)
33 , P_(P)
34 , Pt_(Pt)
35 ,
36 // Default values
37 precType1_("CHEBYSHEV")
38 , precType2_("CHEBYSHEV")
39 , preOrPost_("both")
40 , ZeroStartingSolution_(true)
41 , ImplicitTranspose_(Pt.is_null())
42 ,
43 // General
44 IsInitialized_(false)
45 , IsComputed_(false)
46 , NumInitialize_(0)
47 , NumCompute_(0)
48 , NumApply_(0)
49 , InitializeTime_(0.0)
50 , ComputeTime_(0.0)
51 , ApplyTime_(0.0) {}
52
53template <class MatrixType>
55 Hiptmair(const Teuchos::RCP<const row_matrix_type>& A)
56 : A_(A)
57 , PtAP_()
58 , P_()
59 , Pt_()
60 ,
61 // Default values
62 precType1_("CHEBYSHEV")
63 , precType2_("CHEBYSHEV")
64 , preOrPost_("both")
65 , ZeroStartingSolution_(true)
66 , ImplicitTranspose_(true)
67 ,
68 // General
69 IsInitialized_(false)
70 , IsComputed_(false)
71 , NumInitialize_(0)
72 , NumCompute_(0)
73 , NumApply_(0)
74 , InitializeTime_(0.0)
75 , ComputeTime_(0.0)
76 , ApplyTime_(0.0) {}
77
78template <class MatrixType>
80
81template <class MatrixType>
82void Hiptmair<MatrixType>::setParameters(const Teuchos::ParameterList& plist) {
83 using Teuchos::as;
84 using Teuchos::ParameterList;
85 using Teuchos::RCP;
86 using Teuchos::Exceptions::InvalidParameterName;
87 using Teuchos::Exceptions::InvalidParameterType;
88
89 ParameterList params = plist;
90
91 // Get the current parameters' values. We don't assign to the
92 // instance data directly until we've gotten all the parameters.
93 // This ensures "transactional" semantics, so that if attempting to
94 // get some parameter throws an exception, the class' state doesn't
95 // change.
96 std::string precType1 = precType1_;
97 std::string precType2 = precType2_;
98 std::string preOrPost = preOrPost_;
99 Teuchos::ParameterList precList1 = precList1_;
100 Teuchos::ParameterList precList2 = precList2_;
101 bool zeroStartingSolution = ZeroStartingSolution_;
102 bool implicitTranspose = ImplicitTranspose_;
103
104 precType1 = params.get("hiptmair: smoother type 1", precType1);
105 precType2 = params.get("hiptmair: smoother type 2", precType2);
106 precList1 = params.get("hiptmair: smoother list 1", precList1);
107 precList2 = params.get("hiptmair: smoother list 2", precList2);
108 preOrPost = params.get("hiptmair: pre or post", preOrPost);
109 zeroStartingSolution = params.get("hiptmair: zero starting solution",
110 zeroStartingSolution);
111 implicitTranspose = params.get("hiptmair: implicit transpose", implicitTranspose);
112
113 // Grab the matrices off of the parameter list if we need them
114 // This will intentionally throw if they're not there and we need them
115 if (PtAP_.is_null())
116 PtAP_ = params.get<RCP<row_matrix_type>>("PtAP");
117 if (P_.is_null())
118 P_ = params.get<RCP<row_matrix_type>>("P");
119 if (params.isType<RCP<row_matrix_type>>("Pt"))
120 Pt_ = params.get<RCP<row_matrix_type>>("Pt");
121
122 // "Commit" the new values to the instance data.
123 precType1_ = precType1;
124 precType2_ = precType2;
125 precList1_ = precList1;
126 precList2_ = precList2;
127 preOrPost_ = preOrPost;
128 ZeroStartingSolution_ = zeroStartingSolution;
129 ImplicitTranspose_ = implicitTranspose;
130}
131
132template <class MatrixType>
133Teuchos::RCP<const Teuchos::Comm<int>>
135 TEUCHOS_TEST_FOR_EXCEPTION(
136 A_.is_null(), std::runtime_error,
137 "Ifpack2::Hiptmair::getComm: "
138 "The input matrix A is null. Please call setMatrix() with a nonnull "
139 "input matrix before calling this method.");
140 return A_->getComm();
141}
142
143template <class MatrixType>
144Teuchos::RCP<const Tpetra::RowMatrix<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>>
146 return A_;
147}
148
149template <class MatrixType>
150Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>>
152 TEUCHOS_TEST_FOR_EXCEPTION(
153 A_.is_null(), std::runtime_error,
154 "Ifpack2::Hiptmair::getDomainMap: "
155 "The input matrix A is null. Please call setMatrix() with a nonnull "
156 "input matrix before calling this method.");
157 return A_->getDomainMap();
158}
159
160template <class MatrixType>
161Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>>
163 TEUCHOS_TEST_FOR_EXCEPTION(
164 A_.is_null(), std::runtime_error,
165 "Ifpack2::Hiptmair::getRangeMap: "
166 "The input matrix A is null. Please call setMatrix() with a nonnull "
167 "input matrix before calling this method.");
168 return A_->getRangeMap();
169}
170
171template <class MatrixType>
173 // FIXME (mfh 17 Jan 2014) apply() does not currently work with mode
174 // != NO_TRANS, so it's correct to return false here.
175 return false;
176}
177
178template <class MatrixType>
180 return NumInitialize_;
181}
182
183template <class MatrixType>
185 return NumCompute_;
186}
187
188template <class MatrixType>
190 return NumApply_;
191}
192
193template <class MatrixType>
195 return InitializeTime_;
196}
197
198template <class MatrixType>
200 return ComputeTime_;
201}
202
203template <class MatrixType>
205 return ApplyTime_;
206}
207
208template <class MatrixType>
209Teuchos::RCP<Ifpack2::Preconditioner<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>> Hiptmair<MatrixType>::getPrec1() {
210 return ifpack2_prec1_;
211}
212
213template <class MatrixType>
214Teuchos::RCP<Ifpack2::Preconditioner<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>> Hiptmair<MatrixType>::getPrec2() {
215 return ifpack2_prec2_;
216}
217
218template <class MatrixType>
220 using Teuchos::ParameterList;
221 using Teuchos::RCP;
222 using Teuchos::rcp;
223
224 const char methodName[] = "Ifpack2::Hiptmair::initialize";
225
226 TEUCHOS_TEST_FOR_EXCEPTION(
227 A_.is_null(), std::runtime_error,
228 "Ifpack2::Hiptmair::initialize: "
229 "The input matrix A is null. Please call setMatrix() with a nonnull "
230 "input matrix before calling this method.");
231
232 // clear any previous allocation
233 IsInitialized_ = false;
234 IsComputed_ = false;
235
236 Teuchos::RCP<Teuchos::Time> timer =
237 Teuchos::TimeMonitor::getNewCounter(methodName);
238
239 double startTime = timer->wallTime();
240
241 { // The body of code to time
242 Teuchos::TimeMonitor timeMon(*timer);
243
245
246 ifpack2_prec1_ = factory.create(precType1_, A_);
247 ifpack2_prec1_->initialize();
248 ifpack2_prec1_->setParameters(precList1_);
249
250 ifpack2_prec2_ = factory.create(precType2_, PtAP_);
251 ifpack2_prec2_->initialize();
252 ifpack2_prec2_->setParameters(precList2_);
253 }
254 IsInitialized_ = true;
255 ++NumInitialize_;
256 InitializeTime_ += (timer->wallTime() - startTime);
257}
258
259template <class MatrixType>
261 const char methodName[] = "Ifpack2::Hiptmair::initialize";
262
263 TEUCHOS_TEST_FOR_EXCEPTION(
264 A_.is_null(), std::runtime_error,
265 "Ifpack2::Hiptmair::compute: "
266 "The input matrix A is null. Please call setMatrix() with a nonnull "
267 "input matrix before calling this method.");
268
269 // Don't time the initialize(); that gets timed separately.
270 if (!isInitialized()) {
271 initialize();
272 }
273
274 Teuchos::RCP<Teuchos::Time> timer =
275 Teuchos::TimeMonitor::getNewCounter(methodName);
276
277 double startTime = timer->wallTime();
278 { // The body of code to time
279 Teuchos::TimeMonitor timeMon(*timer);
280 ifpack2_prec1_->compute();
281 ifpack2_prec2_->compute();
282
283 if (!ImplicitTranspose_ && Pt_.is_null()) {
284 using crs_type = Tpetra::CrsMatrix<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>;
285 Teuchos::RCP<const crs_type> crsP = Teuchos::rcp_dynamic_cast<const crs_type>(P_);
286 if (!crsP.is_null()) {
287 using transposer_type = Tpetra::RowMatrixTransposer<typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type>;
288 Pt_ = transposer_type(crsP).createTranspose();
289 } else {
290 TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error,
291 "Ifpack2::Hiptmair::compute: "
292 "ImplicitTranspose == false, but no Pt was provided and transposing P was not possible.");
293 }
294 }
295 }
296 IsComputed_ = true;
297 ++NumCompute_;
298 ComputeTime_ += (timer->wallTime() - startTime);
299}
300
301template <class MatrixType>
303 apply(const Tpetra::MultiVector<typename MatrixType::scalar_type,
304 typename MatrixType::local_ordinal_type,
305 typename MatrixType::global_ordinal_type,
306 typename MatrixType::node_type>& X,
307 Tpetra::MultiVector<typename MatrixType::scalar_type,
308 typename MatrixType::local_ordinal_type,
309 typename MatrixType::global_ordinal_type,
310 typename MatrixType::node_type>& Y,
311 Teuchos::ETransp mode,
312 typename MatrixType::scalar_type alpha,
313 typename MatrixType::scalar_type beta) const {
314 using Teuchos::RCP;
315 using Teuchos::rcp;
316 using Teuchos::rcpFromRef;
317 typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
319 MV;
320 TEUCHOS_TEST_FOR_EXCEPTION(
321 !isComputed(), std::runtime_error,
322 "Ifpack2::Hiptmair::apply: You must call compute() before you may call apply().");
323 TEUCHOS_TEST_FOR_EXCEPTION(
324 X.getNumVectors() != Y.getNumVectors(), std::invalid_argument,
325 "Ifpack2::Hiptmair::apply: The MultiVector inputs X and Y do not have the "
326 "same number of columns. X.getNumVectors() = "
327 << X.getNumVectors()
328 << " != Y.getNumVectors() = " << Y.getNumVectors() << ".");
329
330 // Catch unimplemented cases: alpha != 1, beta != 0, mode != NO_TRANS.
331 TEUCHOS_TEST_FOR_EXCEPTION(
332 alpha != STS::one(), std::logic_error,
333 "Ifpack2::Hiptmair::apply: alpha != 1 has not been implemented.");
334 TEUCHOS_TEST_FOR_EXCEPTION(
335 beta != STS::zero(), std::logic_error,
336 "Ifpack2::Hiptmair::apply: zero != 0 has not been implemented.");
337 TEUCHOS_TEST_FOR_EXCEPTION(
338 mode != Teuchos::NO_TRANS, std::logic_error,
339 "Ifpack2::Hiptmair::apply: mode != Teuchos::NO_TRANS has not been implemented.");
340
341 const std::string timerName("Ifpack2::Hiptmair::apply");
342 Teuchos::RCP<Teuchos::Time> timer = Teuchos::TimeMonitor::lookupCounter(timerName);
343 if (timer.is_null()) {
344 timer = Teuchos::TimeMonitor::getNewCounter(timerName);
345 }
346 double startTime = timer->wallTime();
347 { // The body of code to time
348 Teuchos::TimeMonitor timeMon(*timer);
349
350 // If X and Y are pointing to the same memory location,
351 // we need to create an auxiliary vector, Xcopy
352 RCP<const MV> Xcopy;
353 {
354 if (X.aliases(Y)) {
355 Xcopy = rcp(new MV(X, Teuchos::Copy));
356 } else {
357 Xcopy = rcpFromRef(X);
358 }
359 }
360
361 RCP<MV> Ycopy = rcpFromRef(Y);
362 if (ZeroStartingSolution_) {
363 Ycopy->putScalar(STS::zero());
364 }
365
366 // apply Hiptmair Smoothing
367 applyHiptmairSmoother(*Xcopy, *Ycopy);
368 }
369 ++NumApply_;
370 ApplyTime_ += (timer->wallTime() - startTime);
371}
372
373template <class MatrixType>
375 updateCachedMultiVectors(const Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>>& map1,
376 const Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>>& map2,
377 size_t numVecs) const {
378 // Allocate a multivector if the cached one isn't perfect. Checking
379 // for map pointer equality is much cheaper than Map::isSameAs.
380 using MV = Tpetra::MultiVector<scalar_type, local_ordinal_type,
382 if (cachedResidual1_.is_null() ||
383 map1.get() != cachedResidual1_->getMap().get() ||
384 cachedResidual1_->getNumVectors() != numVecs) {
385 cachedResidual1_ = Teuchos::rcp(new MV(map1, numVecs, false));
386 cachedSolution1_ = Teuchos::rcp(new MV(map1, numVecs, false));
387 }
388 if (cachedResidual2_.is_null() ||
389 map2.get() != cachedResidual2_->getMap().get() ||
390 cachedResidual2_->getNumVectors() != numVecs) {
391 cachedResidual2_ = Teuchos::rcp(new MV(map2, numVecs, false));
392 cachedSolution2_ = Teuchos::rcp(new MV(map2, numVecs, false));
393 }
394}
395
396template <class MatrixType>
398 applyHiptmairSmoother(const Tpetra::MultiVector<typename MatrixType::scalar_type,
399 typename MatrixType::local_ordinal_type,
400 typename MatrixType::global_ordinal_type,
401 typename MatrixType::node_type>& X,
402 Tpetra::MultiVector<typename MatrixType::scalar_type,
403 typename MatrixType::local_ordinal_type,
404 typename MatrixType::global_ordinal_type,
405 typename MatrixType::node_type>& Y) const {
406 const scalar_type ZERO = STS::zero();
407 const scalar_type ONE = STS::one();
408
409 const std::string timerName1("Ifpack2::Hiptmair::apply 1");
410 const std::string timerName2("Ifpack2::Hiptmair::apply 2");
411
412 Teuchos::RCP<Teuchos::Time> timer1 = Teuchos::TimeMonitor::lookupCounter(timerName1);
413 if (timer1.is_null()) {
414 timer1 = Teuchos::TimeMonitor::getNewCounter(timerName1);
415 }
416 Teuchos::RCP<Teuchos::Time> timer2 = Teuchos::TimeMonitor::lookupCounter(timerName2);
417 if (timer2.is_null()) {
418 timer2 = Teuchos::TimeMonitor::getNewCounter(timerName2);
419 }
420
421 //#define IFPACK2_DEBUG_SMOOTHER
422#ifdef IFPACK2_DEBUG_SMOOTHER
423 int mypid = X.getMap()->getComm()->getRank();
424 Teuchos::Array<double> ttt(1);
425 printf("\n--------------------------------\n");
426 printf("Coming into matrix Hiptmair\n");
427 Y.norm2(ttt());
428 if (!mypid) printf("\t||x|| = %15.10e\n", ttt[0]);
429 X.norm2(ttt());
430 if (!mypid) printf("\t||rhs|| = %15.10e\n", ttt[0]);
431 {
432 double normA = A_->getFrobeniusNorm();
433 if (!mypid) printf("\t||A|| = %15.10e\n", normA);
434 Tpetra::Vector<typename MatrixType::scalar_type,
435 typename MatrixType::local_ordinal_type,
436 typename MatrixType::global_ordinal_type,
437 typename MatrixType::node_type>
438 d(A_->getRowMap());
439 A_->getLocalDiagCopy(d);
440 d.norm2(ttt);
441 if (!mypid) printf("\t||diag(A)|| = %15.10e\n", ttt[0]);
442 }
443 fflush(stdout);
444#endif
445
446 updateCachedMultiVectors(A_->getRowMap(),
447 PtAP_->getRowMap(),
448 X.getNumVectors());
449
450 if (preOrPost_ == "pre" || preOrPost_ == "both") {
451 // apply initial relaxation to primary space
452 Teuchos::TimeMonitor timeMon(*timer1);
453 Tpetra::Details::residual(*A_, Y, X, *cachedResidual1_);
454 cachedSolution1_->putScalar(ZERO);
455 ifpack2_prec1_->apply(*cachedResidual1_, *cachedSolution1_);
456 Y.update(ONE, *cachedSolution1_, ONE);
457 }
458
459 {
460 // project to auxiliary space and smooth
461 Teuchos::TimeMonitor timeMon(*timer2);
462 Tpetra::Details::residual(*A_, Y, X, *cachedResidual1_);
463#ifdef IFPACK2_DEBUG_SMOOTHER
464 if (!mypid) printf(" After smoothing on edges\n");
465 Y.norm2(ttt());
466 if (!mypid) printf("\t||x|| = %15.10e\n", ttt[0]);
467 cachedResidual1_->norm2(ttt());
468 if (!mypid) printf("\t||res|| = %15.10e\n", ttt[0]);
469#endif
470
471 if (!Pt_.is_null())
472 Pt_->apply(*cachedResidual1_, *cachedResidual2_, Teuchos::NO_TRANS);
473 else
474 P_->apply(*cachedResidual1_, *cachedResidual2_, Teuchos::TRANS);
475 cachedSolution2_->putScalar(ZERO);
476
477#ifdef IFPACK2_DEBUG_SMOOTHER
478 if (!mypid) printf(" Before smoothing on nodes\n");
479 cachedSolution2_->norm2(ttt());
480 if (!mypid) printf("\t||x_nodal|| = %15.10e\n", ttt[0]);
481 cachedResidual2_->norm2(ttt());
482 if (!mypid) printf("\t||rhs_nodal|| = %15.10e\n", ttt[0]);
483 {
484 auto An = ifpack2_prec2_->getMatrix();
485 double normA = An->getFrobeniusNorm();
486 if (!mypid) printf("\t||An|| = %15.10e\n", normA);
487 Tpetra::Vector<typename MatrixType::scalar_type,
488 typename MatrixType::local_ordinal_type,
489 typename MatrixType::global_ordinal_type,
490 typename MatrixType::node_type>
491 d(An->getRowMap());
492 An->getLocalDiagCopy(d);
493 d.norm2(ttt);
494 if (!mypid) printf("\t||diag(An)|| = %15.10e\n", ttt[0]);
495 }
496
497#endif
498
499 ifpack2_prec2_->apply(*cachedResidual2_, *cachedSolution2_);
500
501#ifdef IFPACK2_DEBUG_SMOOTHER
502 if (!mypid) printf(" After smoothing on nodes\n");
503 cachedSolution2_->norm2(ttt());
504 if (!mypid) printf("\t||x_nodal|| = %15.10e\n", ttt[0]);
505 cachedResidual2_->norm2(ttt());
506 if (!mypid) printf("\t||rhs_nodal|| = %15.10e\n", ttt[0]);
507#endif
508
509 P_->apply(*cachedSolution2_, Y, Teuchos::NO_TRANS, ONE, ONE);
510 }
511
512 if (preOrPost_ == "post" || preOrPost_ == "both") {
513 // smooth again on primary space
514 Teuchos::TimeMonitor timeMon(*timer1);
515 Tpetra::Details::residual(*A_, Y, X, *cachedResidual1_);
516 cachedSolution1_->putScalar(ZERO);
517 ifpack2_prec1_->apply(*cachedResidual1_, *cachedSolution1_);
518 Y.update(ONE, *cachedSolution1_, ONE);
519 }
520
521#ifdef IFPACK2_DEBUG_SMOOTHER
522 if (!mypid) printf(" After updating edge solution\n");
523 Y.norm2(ttt());
524 if (!mypid) printf("\t||x|| = %15.10e\n", ttt[0]);
525 if (!mypid) printf("--------------------------------\n");
526#endif
527}
528
529template <class MatrixType>
531 std::ostringstream os;
532
533 // Output is a valid YAML dictionary in flow style. If you don't
534 // like everything on a single line, you should call describe()
535 // instead.
536 os << "\"Ifpack2::Hiptmair\": {";
537 if (this->getObjectLabel() != "") {
538 os << "Label: \"" << this->getObjectLabel() << "\", ";
539 }
540 os << "Initialized: " << (isInitialized() ? "true" : "false") << ", "
541 << "Computed: " << (isComputed() ? "true" : "false") << ", ";
542
543 if (A_.is_null()) {
544 os << "Matrix: null, ";
545 } else {
546 os << "Matrix: not null"
547 << ", Global matrix dimensions: ["
548 << A_->getGlobalNumRows() << ", " << A_->getGlobalNumCols() << "], ";
549 }
550
551 os << "Smoother 1: ";
552 os << ifpack2_prec1_->description() << ", ";
553 os << "Smoother 2: ";
554 os << ifpack2_prec2_->description();
555
556 os << "}";
557 return os.str();
558}
559
560template <class MatrixType>
562 describe(Teuchos::FancyOStream& out,
563 const Teuchos::EVerbosityLevel verbLevel) const {
564 using std::endl;
565 using std::setw;
566 using Teuchos::VERB_DEFAULT;
567 using Teuchos::VERB_EXTREME;
568 using Teuchos::VERB_HIGH;
569 using Teuchos::VERB_LOW;
570 using Teuchos::VERB_MEDIUM;
571 using Teuchos::VERB_NONE;
572
573 const Teuchos::EVerbosityLevel vl =
574 (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
575
576 if (vl != VERB_NONE) {
577 // describe() always starts with a tab by convention.
578 Teuchos::OSTab tab0(out);
579 out << "\"Ifpack2::Hiptmair\":";
580
581 Teuchos::OSTab tab1(out);
582 if (this->getObjectLabel() != "") {
583 out << "Label: " << this->getObjectLabel() << endl;
584 }
585 out << "Initialized: " << (isInitialized() ? "true" : "false") << endl
586 << "Computed: " << (isComputed() ? "true" : "false") << endl
587 << "Global number of rows: " << A_->getGlobalNumRows() << endl
588 << "Global number of columns: " << A_->getGlobalNumCols() << endl
589 << "Matrix:";
590 if (A_.is_null()) {
591 out << " null" << endl;
592 } else {
593 A_->describe(out, vl);
594 }
595 out << "Smoother 1: ";
596 ifpack2_prec1_->describe(out, vl);
597 out << "Smoother 2: ";
598 ifpack2_prec2_->describe(out, vl);
599 }
600}
601
602} // namespace Ifpack2
603
604#define IFPACK2_HIPTMAIR_INSTANT(S, LO, GO, N) \
605 template class Ifpack2::Hiptmair<Tpetra::RowMatrix<S, LO, GO, N>>;
606
607#endif /* IFPACK2_HIPTMAIR_DEF_HPP */
Ifpack2's implementation of Trilinos::Details::LinearSolver interface.
Definition Ifpack2_Details_LinearSolver_decl.hpp:75
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > &params)
Set the solver's parameters.
Definition Ifpack2_Details_LinearSolver_def.hpp:135
Wrapper for Hiptmair smoothers.
Definition Ifpack2_Hiptmair_decl.hpp:41
Teuchos::RCP< Ifpack2::Preconditioner< typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > getPrec1()
Returns prec 1.
Definition Ifpack2_Hiptmair_def.hpp:209
void initialize()
Do any initialization that depends on the input matrix's structure.
Definition Ifpack2_Hiptmair_def.hpp:219
void apply(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const
Apply the preconditioner to X, putting the result in Y.
Definition Ifpack2_Hiptmair_def.hpp:303
int getNumCompute() const
Returns the number of calls to Compute().
Definition Ifpack2_Hiptmair_def.hpp:184
void compute()
Do any initialization that depends on the input matrix's values.
Definition Ifpack2_Hiptmair_def.hpp:260
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Definition Ifpack2_Hiptmair_def.hpp:562
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition Ifpack2_Hiptmair_decl.hpp:50
std::string description() const
Return a simple one-line description of this object.
Definition Ifpack2_Hiptmair_def.hpp:530
double getApplyTime() const
Returns the time spent in apply().
Definition Ifpack2_Hiptmair_def.hpp:204
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getRangeMap() const
Tpetra::Map representing the range of this operator.
Definition Ifpack2_Hiptmair_def.hpp:162
void updateCachedMultiVectors(const Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > &map1, const Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > &map2, size_t numVecs) const
A service routine for updating the cached MultiVectors.
Definition Ifpack2_Hiptmair_def.hpp:375
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition Ifpack2_Hiptmair_decl.hpp:47
Hiptmair(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes 1 Tpetra matrix (assumes we'll get the rest off the parameter list)
Definition Ifpack2_Hiptmair_def.hpp:55
int getNumInitialize() const
Returns the number of calls to Initialize().
Definition Ifpack2_Hiptmair_def.hpp:179
int getNumApply() const
Returns the number of calls to apply().
Definition Ifpack2_Hiptmair_def.hpp:189
virtual ~Hiptmair()
Destructor.
Definition Ifpack2_Hiptmair_def.hpp:79
void setParameters(const Teuchos::ParameterList &params)
Set the preconditioner's parameters.
Definition Ifpack2_Hiptmair_def.hpp:82
Teuchos::RCP< Ifpack2::Preconditioner< typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > getPrec2()
Returns prec 2.
Definition Ifpack2_Hiptmair_def.hpp:214
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition Ifpack2_Hiptmair_decl.hpp:56
Teuchos::RCP< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > getMatrix() const
Returns a reference to the matrix to be preconditioned.
Definition Ifpack2_Hiptmair_def.hpp:145
double getInitializeTime() const
Returns the time spent in Initialize().
Definition Ifpack2_Hiptmair_def.hpp:194
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the operator's communicator.
Definition Ifpack2_Hiptmair_def.hpp:134
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition Ifpack2_Hiptmair_decl.hpp:53
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getDomainMap() const
Tpetra::Map representing the domain of this operator.
Definition Ifpack2_Hiptmair_def.hpp:151
double getComputeTime() const
Returns the time spent in Compute().
Definition Ifpack2_Hiptmair_def.hpp:199
bool hasTransposeApply() const
Whether this object's apply() method can apply the transpose (or conjugate transpose,...
Definition Ifpack2_Hiptmair_def.hpp:172
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:40