Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_Hiptmair_def.hpp
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 #ifndef IFPACK2_HIPTMAIR_DEF_HPP
44 #define IFPACK2_HIPTMAIR_DEF_HPP
45 
46 #include "Ifpack2_Details_OneLevelFactory.hpp"
47 #include "Ifpack2_Parameters.hpp"
48 #include "Teuchos_TimeMonitor.hpp"
49 #include "Tpetra_MultiVector.hpp"
50 #include "Tpetra_Details_residual.hpp"
51 #include <Tpetra_RowMatrixTransposer.hpp>
52 #include <cmath>
53 #include <iostream>
54 #include <sstream>
55 
56 namespace Ifpack2 {
57 
58 template <class MatrixType>
64  A_ (A),
65  PtAP_ (PtAP),
66  P_ (P),
67  Pt_ (Pt),
68  // Default values
69  precType1_ ("CHEBYSHEV"),
70  precType2_ ("CHEBYSHEV"),
71  preOrPost_ ("both"),
72  ZeroStartingSolution_ (true),
73  ImplicitTranspose_ (Pt.is_null()),
74  // General
75  IsInitialized_ (false),
76  IsComputed_ (false),
77  NumInitialize_ (0),
78  NumCompute_ (0),
79  NumApply_ (0),
80  InitializeTime_ (0.0),
81  ComputeTime_ (0.0),
82  ApplyTime_ (0.0)
83 {}
84 
85 
86 
87 
88 template <class MatrixType>
91  A_ (A),
92  PtAP_ (),
93  P_ (),
94  Pt_ (),
95  // Default values
96  precType1_ ("CHEBYSHEV"),
97  precType2_ ("CHEBYSHEV"),
98  preOrPost_ ("both"),
99  ZeroStartingSolution_ (true),
100  ImplicitTranspose_ (true),
101  // General
102  IsInitialized_ (false),
103  IsComputed_ (false),
104  NumInitialize_ (0),
105  NumCompute_ (0),
106  NumApply_ (0),
107  InitializeTime_ (0.0),
108  ComputeTime_ (0.0),
109  ApplyTime_ (0.0)
110 {}
111 
112 
113 template <class MatrixType>
115 
116 template <class MatrixType>
118 {
119  using Teuchos::as;
120  using Teuchos::RCP;
124 
125  ParameterList params = plist;
126 
127  // Get the current parameters' values. We don't assign to the
128  // instance data directly until we've gotten all the parameters.
129  // This ensures "transactional" semantics, so that if attempting to
130  // get some parameter throws an exception, the class' state doesn't
131  // change.
132  std::string precType1 = precType1_;
133  std::string precType2 = precType2_;
134  std::string preOrPost = preOrPost_;
135  Teuchos::ParameterList precList1 = precList1_;
136  Teuchos::ParameterList precList2 = precList2_;
137  bool zeroStartingSolution = ZeroStartingSolution_;
138  bool implicitTranspose = ImplicitTranspose_;
139 
140  precType1 = params.get("hiptmair: smoother type 1", precType1);
141  precType2 = params.get("hiptmair: smoother type 2", precType2);
142  precList1 = params.get("hiptmair: smoother list 1", precList1);
143  precList2 = params.get("hiptmair: smoother list 2", precList2);
144  preOrPost = params.get("hiptmair: pre or post", preOrPost);
145  zeroStartingSolution = params.get("hiptmair: zero starting solution",
146  zeroStartingSolution);
147  implicitTranspose = params.get("hiptmair: implicit transpose", implicitTranspose);
148 
149  // Grab the matrices off of the parameter list if we need them
150  // This will intentionally throw if they're not there and we need them
151  if(PtAP_.is_null())
152  PtAP_ = params.get<RCP<row_matrix_type> >("PtAP");
153  if(P_.is_null())
154  P_ = params.get<RCP<row_matrix_type> >("P");
155  if (params.isType<RCP<row_matrix_type> >("Pt"))
156  Pt_ = params.get<RCP<row_matrix_type> >("Pt");
157 
158 
159  // "Commit" the new values to the instance data.
160  precType1_ = precType1;
161  precType2_ = precType2;
162  precList1_ = precList1;
163  precList2_ = precList2;
164  preOrPost_ = preOrPost;
165  ZeroStartingSolution_ = zeroStartingSolution;
166  ImplicitTranspose_ = implicitTranspose;
167 }
168 
169 
170 template <class MatrixType>
174  A_.is_null (), std::runtime_error, "Ifpack2::Hiptmair::getComm: "
175  "The input matrix A is null. Please call setMatrix() with a nonnull "
176  "input matrix before calling this method.");
177  return A_->getComm ();
178 }
179 
180 
181 template <class MatrixType>
184  return A_;
185 }
186 
187 
188 template <class MatrixType>
191 {
193  A_.is_null (), std::runtime_error, "Ifpack2::Hiptmair::getDomainMap: "
194  "The input matrix A is null. Please call setMatrix() with a nonnull "
195  "input matrix before calling this method.");
196  return A_->getDomainMap ();
197 }
198 
199 
200 template <class MatrixType>
203 {
205  A_.is_null (), std::runtime_error, "Ifpack2::Hiptmair::getRangeMap: "
206  "The input matrix A is null. Please call setMatrix() with a nonnull "
207  "input matrix before calling this method.");
208  return A_->getRangeMap ();
209 }
210 
211 
212 template <class MatrixType>
214  // FIXME (mfh 17 Jan 2014) apply() does not currently work with mode
215  // != NO_TRANS, so it's correct to return false here.
216  return false;
217 }
218 
219 
220 template <class MatrixType>
222  return NumInitialize_;
223 }
224 
225 
226 template <class MatrixType>
228  return NumCompute_;
229 }
230 
231 
232 template <class MatrixType>
234  return NumApply_;
235 }
236 
237 
238 template <class MatrixType>
240  return InitializeTime_;
241 }
242 
243 
244 template <class MatrixType>
246  return ComputeTime_;
247 }
248 
249 
250 template <class MatrixType>
252  return ApplyTime_;
253 }
254 
255 
256 template <class MatrixType>
258  return ifpack2_prec1_;
259 }
260 
261 
262 template <class MatrixType>
264  return ifpack2_prec2_;
265 }
266 
267 
268 template <class MatrixType>
270 {
272  using Teuchos::RCP;
273  using Teuchos::rcp;
274 
275  const char methodName[] = "Ifpack2::Hiptmair::initialize";
276 
278  A_.is_null (), std::runtime_error, "Ifpack2::Hiptmair::initialize: "
279  "The input matrix A is null. Please call setMatrix() with a nonnull "
280  "input matrix before calling this method.");
281 
282  // clear any previous allocation
283  IsInitialized_ = false;
284  IsComputed_ = false;
285 
288 
289  double startTime = timer->wallTime();
290 
291  { // The body of code to time
292  Teuchos::TimeMonitor timeMon (*timer);
293 
295 
296  ifpack2_prec1_=factory.create(precType1_,A_);
297  ifpack2_prec1_->initialize();
298  ifpack2_prec1_->setParameters(precList1_);
299 
300  ifpack2_prec2_=factory.create(precType2_,PtAP_);
301  ifpack2_prec2_->initialize();
302  ifpack2_prec2_->setParameters(precList2_);
303 
304  }
305  IsInitialized_ = true;
306  ++NumInitialize_;
307  InitializeTime_ += (timer->wallTime() - startTime);
308 }
309 
310 
311 template <class MatrixType>
313 {
314  const char methodName[] = "Ifpack2::Hiptmair::initialize";
315 
317  A_.is_null (), std::runtime_error, "Ifpack2::Hiptmair::compute: "
318  "The input matrix A is null. Please call setMatrix() with a nonnull "
319  "input matrix before calling this method.");
320 
321  // Don't time the initialize(); that gets timed separately.
322  if (! isInitialized ()) {
323  initialize ();
324  }
325 
328 
329  double startTime = timer->wallTime();
330  { // The body of code to time
331  Teuchos::TimeMonitor timeMon (*timer);
332  ifpack2_prec1_->compute();
333  ifpack2_prec2_->compute();
334 
335  if (!ImplicitTranspose_ && Pt_.is_null()) {
336  using crs_type = Tpetra::CrsMatrix<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type>;
337  Teuchos::RCP<const crs_type> crsP = Teuchos::rcp_dynamic_cast<const crs_type>(P_);
338  if (!crsP.is_null()) {
339  using transposer_type = Tpetra::RowMatrixTransposer<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type>;
340  Pt_ = transposer_type(crsP).createTranspose();
341  } else {
342  TEUCHOS_TEST_FOR_EXCEPTION(true, std::runtime_error, "Ifpack2::Hiptmair::compute: "
343  "ImplicitTranspose == false, but no Pt was provided and transposing P was not possible.");
344  }
345  }
346  }
347  IsComputed_ = true;
348  ++NumCompute_;
349  ComputeTime_ += (timer->wallTime() - startTime);
350 }
351 
352 
353 template <class MatrixType>
355 apply (const Tpetra::MultiVector<typename MatrixType::scalar_type,
356  typename MatrixType::local_ordinal_type,
357  typename MatrixType::global_ordinal_type,
358  typename MatrixType::node_type>& X,
359  Tpetra::MultiVector<typename MatrixType::scalar_type,
360  typename MatrixType::local_ordinal_type,
361  typename MatrixType::global_ordinal_type,
362  typename MatrixType::node_type>& Y,
363  Teuchos::ETransp mode,
364  typename MatrixType::scalar_type alpha,
365  typename MatrixType::scalar_type beta) const
366 {
367  using Teuchos::RCP;
368  using Teuchos::rcp;
369  using Teuchos::rcpFromRef;
370  typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
373  ! isComputed (), std::runtime_error,
374  "Ifpack2::Hiptmair::apply: You must call compute() before you may call apply().");
376  X.getNumVectors () != Y.getNumVectors (), std::invalid_argument,
377  "Ifpack2::Hiptmair::apply: The MultiVector inputs X and Y do not have the "
378  "same number of columns. X.getNumVectors() = " << X.getNumVectors ()
379  << " != Y.getNumVectors() = " << Y.getNumVectors () << ".");
380 
381  // Catch unimplemented cases: alpha != 1, beta != 0, mode != NO_TRANS.
383  alpha != STS::one (), std::logic_error,
384  "Ifpack2::Hiptmair::apply: alpha != 1 has not been implemented.");
385  TEUCHOS_TEST_FOR_EXCEPTION(
386  beta != STS::zero (), std::logic_error,
387  "Ifpack2::Hiptmair::apply: zero != 0 has not been implemented.");
388  TEUCHOS_TEST_FOR_EXCEPTION(
389  mode != Teuchos::NO_TRANS, std::logic_error,
390  "Ifpack2::Hiptmair::apply: mode != Teuchos::NO_TRANS has not been implemented.");
391 
392  const std::string timerName ("Ifpack2::Hiptmair::apply");
394  if (timer.is_null ()) {
395  timer = Teuchos::TimeMonitor::getNewCounter (timerName);
396  }
397  double startTime = timer->wallTime();
398  { // The body of code to time
399  Teuchos::TimeMonitor timeMon (*timer);
400 
401  // If X and Y are pointing to the same memory location,
402  // we need to create an auxiliary vector, Xcopy
403  RCP<const MV> Xcopy;
404  {
405  if (X.aliases(Y)) {
406  Xcopy = rcp (new MV (X, Teuchos::Copy));
407  } else {
408  Xcopy = rcpFromRef (X);
409  }
410  }
411 
412  RCP<MV> Ycopy = rcpFromRef (Y);
413  if (ZeroStartingSolution_) {
414  Ycopy->putScalar (STS::zero ());
415  }
416 
417  // apply Hiptmair Smoothing
418  applyHiptmairSmoother (*Xcopy, *Ycopy);
419 
420  }
421  ++NumApply_;
422  ApplyTime_ += (timer->wallTime() - startTime);
423 }
424 
425 
426 template<class MatrixType>
427 void
429 updateCachedMultiVectors (const Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>>& map1,
430  const Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>>& map2,
431  size_t numVecs) const
432 {
433  // Allocate a multivector if the cached one isn't perfect. Checking
434  // for map pointer equality is much cheaper than Map::isSameAs.
435  using MV = Tpetra::MultiVector<scalar_type, local_ordinal_type,
437  if (cachedResidual1_.is_null () ||
438  map1.get () != cachedResidual1_->getMap ().get () ||
439  cachedResidual1_->getNumVectors () != numVecs) {
440 
441  cachedResidual1_ = Teuchos::rcp (new MV (map1, numVecs, false));
442  cachedSolution1_ = Teuchos::rcp (new MV (map1, numVecs, false));
443  }
444  if (cachedResidual2_.is_null () ||
445  map2.get () != cachedResidual2_->getMap ().get () ||
446  cachedResidual2_->getNumVectors () != numVecs) {
447 
448  cachedResidual2_ = Teuchos::rcp (new MV (map2, numVecs, false));
449  cachedSolution2_ = Teuchos::rcp (new MV (map2, numVecs, false));
450  }
451 }
452 
453 
454 template <class MatrixType>
456 applyHiptmairSmoother(const Tpetra::MultiVector<typename MatrixType::scalar_type,
457  typename MatrixType::local_ordinal_type,
458  typename MatrixType::global_ordinal_type,
459  typename MatrixType::node_type>& X,
460  Tpetra::MultiVector<typename MatrixType::scalar_type,
461  typename MatrixType::local_ordinal_type,
462  typename MatrixType::global_ordinal_type,
463  typename MatrixType::node_type>& Y) const
464 {
465  const scalar_type ZERO = STS::zero ();
466  const scalar_type ONE = STS::one ();
467 
468  const std::string timerName1 ("Ifpack2::Hiptmair::apply 1");
469  const std::string timerName2 ("Ifpack2::Hiptmair::apply 2");
470 
472  if (timer1.is_null ()) {
473  timer1 = Teuchos::TimeMonitor::getNewCounter (timerName1);
474  }
476  if (timer2.is_null ()) {
477  timer2 = Teuchos::TimeMonitor::getNewCounter (timerName2);
478  }
479 
480  //#define IFPACK2_DEBUG_SMOOTHER
481 #ifdef IFPACK2_DEBUG_SMOOTHER
482  int mypid = X.getMap()->getComm()->getRank();
483  Teuchos::Array<double> ttt(1);
484  printf("\n--------------------------------\n");
485  printf("Coming into matrix Hiptmair\n");
486  Y.norm2(ttt());
487  if (!mypid) printf("\t||x|| = %15.10e\n", ttt[0]);
488  X.norm2(ttt());
489  if (!mypid) printf("\t||rhs|| = %15.10e\n", ttt[0]);
490  {
491  double normA = A_->getFrobeniusNorm();
492  if (!mypid) printf("\t||A|| = %15.10e\n", normA);
493  Tpetra::Vector<typename MatrixType::scalar_type,
494  typename MatrixType::local_ordinal_type,
495  typename MatrixType::global_ordinal_type,
496  typename MatrixType::node_type> d(A_->getRowMap());
497  A_->getLocalDiagCopy(d);
498  d.norm2(ttt);
499  if (!mypid) printf("\t||diag(A)|| = %15.10e\n", ttt[0]);
500  }
501  fflush(stdout);
502 #endif
503 
504 
505  updateCachedMultiVectors (A_->getRowMap (),
506  PtAP_->getRowMap (),
507  X.getNumVectors ());
508 
509  if (preOrPost_ == "pre" || preOrPost_ == "both") {
510  // apply initial relaxation to primary space
511  Teuchos::TimeMonitor timeMon (*timer1);
512  Tpetra::Details::residual(*A_,Y,X,*cachedResidual1_);
513  cachedSolution1_->putScalar (ZERO);
514  ifpack2_prec1_->apply (*cachedResidual1_, *cachedSolution1_);
515  Y.update (ONE, *cachedSolution1_, ONE);
516  }
517 
518 
519 
520  {
521  // project to auxiliary space and smooth
522  Teuchos::TimeMonitor timeMon (*timer2);
523  Tpetra::Details::residual(*A_,Y,X,*cachedResidual1_);
524 #ifdef IFPACK2_DEBUG_SMOOTHER
525  if (!mypid) printf(" After smoothing on edges\n");
526  Y.norm2(ttt());
527  if (!mypid) printf("\t||x|| = %15.10e\n", ttt[0]);
528  cachedResidual1_->norm2(ttt());
529  if (!mypid) printf("\t||res|| = %15.10e\n", ttt[0]);
530 #endif
531 
532 
533 
534  if (!Pt_.is_null())
535  Pt_->apply (*cachedResidual1_, *cachedResidual2_, Teuchos::NO_TRANS);
536  else
537  P_->apply (*cachedResidual1_, *cachedResidual2_, Teuchos::TRANS);
538  cachedSolution2_->putScalar (ZERO);
539 
540 #ifdef IFPACK2_DEBUG_SMOOTHER
541  if (!mypid)printf(" Before smoothing on nodes\n");
542  cachedSolution2_->norm2(ttt());
543  if (!mypid)printf("\t||x_nodal|| = %15.10e\n",ttt[0]);
544  cachedResidual2_->norm2(ttt());
545  if (!mypid)printf("\t||rhs_nodal|| = %15.10e\n", ttt[0]);
546  {
547  auto An = ifpack2_prec2_->getMatrix();
548  double normA = An->getFrobeniusNorm();
549  if (!mypid) printf("\t||An|| = %15.10e\n", normA);
550  Tpetra::Vector<typename MatrixType::scalar_type,
551  typename MatrixType::local_ordinal_type,
552  typename MatrixType::global_ordinal_type,
553  typename MatrixType::node_type> d(An->getRowMap());
554  An->getLocalDiagCopy(d);
555  d.norm2(ttt);
556  if (!mypid) printf("\t||diag(An)|| = %15.10e\n", ttt[0]);
557  }
558 
559 #endif
560 
561  ifpack2_prec2_->apply (*cachedResidual2_, *cachedSolution2_);
562 
563 #ifdef IFPACK2_DEBUG_SMOOTHER
564  if (!mypid)printf(" After smoothing on nodes\n");
565  cachedSolution2_->norm2(ttt());
566  if (!mypid)printf("\t||x_nodal|| = %15.10e\n",ttt[0]);
567  cachedResidual2_->norm2(ttt());
568  if (!mypid)printf("\t||rhs_nodal|| = %15.10e\n", ttt[0]);
569 #endif
570 
571 
572  P_->apply (*cachedSolution2_, Y, Teuchos::NO_TRANS, ONE, ONE);
573  }
574 
575  if (preOrPost_ == "post" || preOrPost_ == "both") {
576  // smooth again on primary space
577  Teuchos::TimeMonitor timeMon (*timer1);
578  Tpetra::Details::residual(*A_,Y,X,*cachedResidual1_);
579  cachedSolution1_->putScalar (ZERO);
580  ifpack2_prec1_->apply (*cachedResidual1_, *cachedSolution1_);
581  Y.update (ONE, *cachedSolution1_, ONE);
582  }
583 
584 #ifdef IFPACK2_DEBUG_SMOOTHER
585  if (!mypid)printf(" After updating edge solution\n");
586  Y.norm2(ttt());
587  if (!mypid)printf("\t||x|| = %15.10e\n",ttt[0]);
588  if (!mypid)printf("--------------------------------\n");
589 #endif
590 
591 
592 }
593 
594 template <class MatrixType>
596 {
597  std::ostringstream os;
598 
599  // Output is a valid YAML dictionary in flow style. If you don't
600  // like everything on a single line, you should call describe()
601  // instead.
602  os << "\"Ifpack2::Hiptmair\": {";
603  if (this->getObjectLabel () != "") {
604  os << "Label: \"" << this->getObjectLabel () << "\", ";
605  }
606  os << "Initialized: " << (isInitialized () ? "true" : "false") << ", "
607  << "Computed: " << (isComputed () ? "true" : "false") << ", ";
608 
609  if (A_.is_null ()) {
610  os << "Matrix: null, ";
611  }
612  else {
613  os << "Matrix: not null"
614  << ", Global matrix dimensions: ["
615  << A_->getGlobalNumRows () << ", " << A_->getGlobalNumCols () << "], ";
616  }
617 
618  os << "Smoother 1: ";
619  os << ifpack2_prec1_->description() << ", ";
620  os << "Smoother 2: ";
621  os << ifpack2_prec2_->description();
622 
623  os << "}";
624  return os.str ();
625 }
626 
627 
628 template <class MatrixType>
631  const Teuchos::EVerbosityLevel verbLevel) const
632 {
633  using std::endl;
634  using std::setw;
635  using Teuchos::VERB_DEFAULT;
636  using Teuchos::VERB_NONE;
637  using Teuchos::VERB_LOW;
638  using Teuchos::VERB_MEDIUM;
639  using Teuchos::VERB_HIGH;
640  using Teuchos::VERB_EXTREME;
641 
642  const Teuchos::EVerbosityLevel vl =
643  (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
644 
645  if (vl != VERB_NONE) {
646  // describe() always starts with a tab by convention.
647  Teuchos::OSTab tab0 (out);
648  out << "\"Ifpack2::Hiptmair\":";
649 
650  Teuchos::OSTab tab1 (out);
651  if (this->getObjectLabel () != "") {
652  out << "Label: " << this->getObjectLabel () << endl;
653  }
654  out << "Initialized: " << (isInitialized () ? "true" : "false") << endl
655  << "Computed: " << (isComputed () ? "true" : "false") << endl
656  << "Global number of rows: " << A_->getGlobalNumRows () << endl
657  << "Global number of columns: " << A_->getGlobalNumCols () << endl
658  << "Matrix:";
659  if (A_.is_null ()) {
660  out << " null" << endl;
661  } else {
662  A_->describe (out, vl);
663  }
664  out << "Smoother 1: ";
665  ifpack2_prec1_->describe(out, vl);
666  out << "Smoother 2: ";
667  ifpack2_prec2_->describe(out, vl);
668  }
669 }
670 
671 } // namespace Ifpack2
672 
673 #define IFPACK2_HIPTMAIR_INSTANT(S,LO,GO,N) \
674  template class Ifpack2::Hiptmair< Tpetra::RowMatrix<S, LO, GO, N> >;
675 
676 #endif /* IFPACK2_HIPTMAIR_DEF_HPP */
void initialize()
Do any initialization that depends on the input matrix&#39;s structure.
Definition: Ifpack2_Hiptmair_def.hpp:269
bool is_null(const boost::shared_ptr< T > &p)
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:86
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:429
T & get(const std::string &name, T def_value)
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_Hiptmair_decl.hpp:85
static RCP< Time > getNewCounter(const std::string &name)
static RCP< Time > lookupCounter(const std::string &name)
Hiptmair(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes 1 Tpetra matrix (assumes we&#39;ll get the rest off the parameter list) ...
Definition: Ifpack2_Hiptmair_def.hpp:90
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_Hiptmair_decl.hpp:82
double getComputeTime() const
Returns the time spent in Compute().
Definition: Ifpack2_Hiptmair_def.hpp:245
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the operator&#39;s communicator.
Definition: Ifpack2_Hiptmair_def.hpp:172
bool hasTransposeApply() const
Whether this object&#39;s apply() method can apply the transpose (or conjugate transpose, if applicable).
Definition: Ifpack2_Hiptmair_def.hpp:213
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:630
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_Hiptmair_def.hpp:251
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:257
void setParameters(const Teuchos::ParameterList &params)
Set the preconditioner&#39;s parameters.
Definition: Ifpack2_Hiptmair_def.hpp:117
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:183
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:202
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_Hiptmair_decl.hpp:88
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_Hiptmair_def.hpp:233
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper for Hiptmair smoothers.
Definition: Ifpack2_Hiptmair_decl.hpp:71
int getNumCompute() const
Returns the number of calls to Compute().
Definition: Ifpack2_Hiptmair_def.hpp:227
int getNumInitialize() const
Returns the number of calls to Initialize().
Definition: Ifpack2_Hiptmair_def.hpp:221
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_Hiptmair_decl.hpp:91
void compute()
Do any initialization that depends on the input matrix&#39;s values.
Definition: Ifpack2_Hiptmair_def.hpp:312
virtual ~Hiptmair()
Destructor.
Definition: Ifpack2_Hiptmair_def.hpp:114
std::string description() const
Return a simple one-line description of this object.
Definition: Ifpack2_Hiptmair_def.hpp:595
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:190
TypeTo as(const TypeFrom &t)
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:263
double getInitializeTime() const
Returns the time spent in Initialize().
Definition: Ifpack2_Hiptmair_def.hpp:239
&quot;Factory&quot; for creating single-level preconditioners.
Definition: Ifpack2_Details_OneLevelFactory_decl.hpp:125
static double wallTime()
bool is_null() const
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:355