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