Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_BlockRelaxation_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_BLOCKRELAXATION_DEF_HPP
44 #define IFPACK2_BLOCKRELAXATION_DEF_HPP
45 
47 #include "Ifpack2_LinearPartitioner.hpp"
48 #include "Ifpack2_LinePartitioner.hpp"
50 #include "Ifpack2_Details_UserPartitioner_def.hpp"
51 #include <Ifpack2_Parameters.hpp>
52 
53 namespace Ifpack2 {
54 
55 template<class MatrixType,class ContainerType>
58 {
59  if (A.getRawPtr () != A_.getRawPtr ()) { // it's a different matrix
60  IsInitialized_ = false;
61  IsComputed_ = false;
62  Partitioner_ = Teuchos::null;
63  W_ = Teuchos::null;
64 
65  if (! A.is_null ()) {
66  IsParallel_ = (A->getRowMap ()->getComm ()->getSize () != 1);
68  Teuchos::rcp_dynamic_cast<const block_crs_matrix_type> (A);
69  hasBlockCrsMatrix_ = !A_bcrs.is_null();
70  }
71  if (! Container_.is_null ()) {
72  //This just frees up the container's memory.
73  //The container will be fully re-constructed during initialize().
74  Container_->clearBlocks();
75  }
76  NumLocalBlocks_ = 0;
77 
78  A_ = A;
79  computeImporter();
80  }
81 }
82 
83 template<class MatrixType,class ContainerType>
86 :
87  Time_ (Teuchos::rcp (new Teuchos::Time ("Ifpack2::BlockRelaxation"))),
88  Container_ (Teuchos::null),
89  Partitioner_ (Teuchos::null),
90  PartitionerType_ ("linear"),
91  NumSweeps_ (1),
92  NumLocalBlocks_(0),
93  containerType_ ("TriDi"),
94  PrecType_ (Ifpack2::Details::JACOBI),
95  ZeroStartingSolution_ (true),
96  hasBlockCrsMatrix_ (false),
97  DoBackwardGS_ (false),
98  OverlapLevel_ (0),
99  DampingFactor_ (STS::one ()),
100  IsInitialized_ (false),
101  IsComputed_ (false),
102  NumInitialize_ (0),
103  NumCompute_ (0),
104  NumApply_ (0),
105  InitializeTime_ (0.0),
106  ComputeTime_ (0.0),
107  NumLocalRows_ (0),
108  NumGlobalRows_ (0),
109  NumGlobalNonzeros_ (0),
110  W_ (Teuchos::null),
111  Importer_ (Teuchos::null)
112 {
113  setMatrix(A);
114 }
115 
116 template<class MatrixType,class ContainerType>
119 {}
120 
121 template<class MatrixType,class ContainerType>
125 {
126  Teuchos::RCP<Teuchos::ParameterList> validParams = Teuchos::parameterList ("Ifpack2::BlockRelaxation");
127 
128  validParams->set("relaxation: container", "TriDi");
129  validParams->set("relaxation: backward mode",false);
130  validParams->set("relaxation: type", "Jacobi");
131  validParams->set("relaxation: sweeps", 1);
132  validParams->set("relaxation: damping factor", STS::one());
133  validParams->set("relaxation: zero starting solution", true);
134  validParams->set("block relaxation: decouple dofs", false);
135  validParams->set("schwarz: compute condest", false); // mfh 24 Mar 2015: for backwards compatibility ONLY
136  validParams->set("schwarz: combine mode", "ZERO"); // use string mode for this
137  validParams->set("schwarz: use reordering", true);
138  validParams->set("schwarz: filter singletons", false);
139  validParams->set("schwarz: overlap level", 0);
140  validParams->set("partitioner: type", "greedy");
141  validParams->set("partitioner: local parts", 1);
142  validParams->set("partitioner: overlap", 0);
144  validParams->set("partitioner: parts", tmp0);
145  validParams->set("partitioner: maintain sparsity", false);
146  validParams->set("fact: ilut level-of-fill", 1.0);
147  validParams->set("fact: absolute threshold", 0.0);
148  validParams->set("fact: relative threshold", 1.0);
149  validParams->set("fact: relax value", 0.0);
150 
151  Teuchos::ParameterList dummyList;
152  validParams->set("Amesos2",dummyList);
153  validParams->sublist("Amesos2").disableRecursiveValidation();
154  validParams->set("Amesos2 solver name", "KLU2");
155 
157  validParams->set("partitioner: map", tmp);
158 
159  validParams->set("partitioner: line detection threshold", 0.0);
160  validParams->set("partitioner: PDE equations", 1);
161  Teuchos::RCP<Tpetra::MultiVector<double,
162  typename MatrixType::local_ordinal_type,
163  typename MatrixType::global_ordinal_type,
164  typename MatrixType::node_type> > dummy;
165  validParams->set("partitioner: coordinates",dummy);
166 
167  return validParams;
168 }
169 
170 template<class MatrixType,class ContainerType>
171 void
174 {
175  // Note that the validation process does not change List.
177  validparams = this->getValidParameters();
178  List.validateParameters (*validparams);
179 
180  if (List.isParameter ("relaxation: container")) {
181  // If the container type isn't a string, this will throw, but it
182  // rightfully should.
183 
184  // If its value does not match the currently registered Container types,
185  // the ContainerFactory will throw with an informative message.
186  containerType_ = List.get<std::string> ("relaxation: container");
187  // Intercept more human-readable aliases for the *TriDi containers
188  if(containerType_ == "Tridiagonal") {
189  containerType_ = "TriDi";
190  }
191  if(containerType_ == "Block Tridiagonal") {
192  containerType_ = "BlockTriDi";
193  }
194  }
195 
196  if (List.isParameter ("relaxation: type")) {
197  const std::string relaxType = List.get<std::string> ("relaxation: type");
198 
199  if (relaxType == "Jacobi") {
200  PrecType_ = Ifpack2::Details::JACOBI;
201  }
202  else if (relaxType == "MT Split Jacobi") {
203  PrecType_ = Ifpack2::Details::MTSPLITJACOBI;
204  }
205  else if (relaxType == "Gauss-Seidel") {
206  PrecType_ = Ifpack2::Details::GS;
207  }
208  else if (relaxType == "Symmetric Gauss-Seidel") {
209  PrecType_ = Ifpack2::Details::SGS;
210  }
211  else {
213  (true, std::invalid_argument, "Ifpack2::BlockRelaxation::"
214  "setParameters: Invalid parameter value \"" << relaxType
215  << "\" for parameter \"relaxation: type\".");
216  }
217  }
218 
219  if (List.isParameter ("relaxation: sweeps")) {
220  NumSweeps_ = List.get<int> ("relaxation: sweeps");
221  }
222 
223  // Users may specify this as a floating-point literal. In that
224  // case, it may have type double, even if scalar_type is something
225  // else. We take care to try the various types that make sense.
226  if (List.isParameter ("relaxation: damping factor")) {
227  if (List.isType<double> ("relaxation: damping factor")) {
228  const double dampingFactor =
229  List.get<double> ("relaxation: damping factor");
230  DampingFactor_ = static_cast<scalar_type> (dampingFactor);
231  }
232  else if (List.isType<scalar_type> ("relaxation: damping factor")) {
233  DampingFactor_ = List.get<scalar_type> ("relaxation: damping factor");
234  }
235  else if (List.isType<magnitude_type> ("relaxation: damping factor")) {
236  const magnitude_type dampingFactor =
237  List.get<magnitude_type> ("relaxation: damping factor");
238  DampingFactor_ = static_cast<scalar_type> (dampingFactor);
239  }
240  else {
242  (true, std::invalid_argument, "Ifpack2::BlockRelaxation::"
243  "setParameters: Parameter \"relaxation: damping factor\" "
244  "has the wrong type.");
245  }
246  }
247 
248  if (List.isParameter ("relaxation: zero starting solution")) {
249  ZeroStartingSolution_ = List.get<bool> ("relaxation: zero starting solution");
250  }
251 
252  if (List.isParameter ("relaxation: backward mode")) {
253  DoBackwardGS_ = List.get<bool> ("relaxation: backward mode");
254  }
255 
256  if (List.isParameter ("partitioner: type")) {
257  PartitionerType_ = List.get<std::string> ("partitioner: type");
258  }
259 
260  // Users may specify this as an int literal, so we need to allow
261  // both int and local_ordinal_type (not necessarily same as int).
262  if (List.isParameter ("partitioner: local parts")) {
263  if (List.isType<local_ordinal_type> ("partitioner: local parts")) {
264  NumLocalBlocks_ = List.get<local_ordinal_type> ("partitioner: local parts");
265  }
266  else if (! std::is_same<int, local_ordinal_type>::value &&
267  List.isType<int> ("partitioner: local parts")) {
268  NumLocalBlocks_ = List.get<int> ("partitioner: local parts");
269  }
270  else {
272  (true, std::invalid_argument, "Ifpack2::BlockRelaxation::"
273  "setParameters: Parameter \"partitioner: local parts\" "
274  "has the wrong type.");
275  }
276  }
277 
278  if (List.isParameter ("partitioner: overlap level")) {
279  if (List.isType<int> ("partitioner: overlap level")) {
280  OverlapLevel_ = List.get<int> ("partitioner: overlap level");
281  }
282  else if (! std::is_same<int, local_ordinal_type>::value &&
283  List.isType<local_ordinal_type> ("partitioner: overlap level")) {
284  OverlapLevel_ = List.get<local_ordinal_type> ("partitioner: overlap level");
285  }
286  else {
288  (true, std::invalid_argument, "Ifpack2::BlockRelaxation::"
289  "setParameters: Parameter \"partitioner: overlap level\" "
290  "has the wrong type.");
291  }
292  }
293 
294  std::string defaultContainer = "TriDi";
295  if(std::is_same<ContainerType, Container<MatrixType> >::value)
296  {
297  //Generic container template parameter, container type specified in List
298  Ifpack2::getParameter(List, "relaxation: container", defaultContainer);
299  }
300  // check parameters
301  if (PrecType_ != Ifpack2::Details::JACOBI) {
302  OverlapLevel_ = 0;
303  }
304  if (NumLocalBlocks_ < static_cast<local_ordinal_type> (0)) {
305  NumLocalBlocks_ = A_->getNodeNumRows() / (-NumLocalBlocks_);
306  }
307 
308  decouple_ = false;
309  if(List.isParameter("block relaxation: decouple dofs"))
310  decouple_ = List.get<bool>("block relaxation: decouple dofs");
311 
312  // other checks are performed in Partitioner_
313 
314  // NTS: Sanity check to be removed at a later date when Backward mode is enabled
316  DoBackwardGS_, std::runtime_error,
317  "Ifpack2::BlockRelaxation:setParameters: Setting the \"relaxation: "
318  "backward mode\" parameter to true is not yet supported.");
319 
320  // copy the list as each subblock's constructor will
321  // require it later
322  List_ = List;
323 }
324 
325 template<class MatrixType,class ContainerType>
328 {
330  (A_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::getComm: "
331  "The matrix is null. You must call setMatrix() with a nonnull matrix "
332  "before you may call this method.");
333  return A_->getComm ();
334 }
335 
336 template<class MatrixType,class ContainerType>
337 Teuchos::RCP<const Tpetra::RowMatrix<typename MatrixType::scalar_type,
338  typename MatrixType::local_ordinal_type,
339  typename MatrixType::global_ordinal_type,
340  typename MatrixType::node_type> >
342  return A_;
343 }
344 
345 template<class MatrixType,class ContainerType>
346 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
347  typename MatrixType::global_ordinal_type,
348  typename MatrixType::node_type> >
350 getDomainMap () const
351 {
353  (A_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::"
354  "getDomainMap: The matrix is null. You must call setMatrix() with a "
355  "nonnull matrix before you may call this method.");
356  return A_->getDomainMap ();
357 }
358 
359 template<class MatrixType,class ContainerType>
360 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
361  typename MatrixType::global_ordinal_type,
362  typename MatrixType::node_type> >
364 getRangeMap () const
365 {
367  (A_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::"
368  "getRangeMap: The matrix is null. You must call setMatrix() with a "
369  "nonnull matrix before you may call this method.");
370  return A_->getRangeMap ();
371 }
372 
373 template<class MatrixType,class ContainerType>
374 bool
376 hasTransposeApply () const {
377  return true;
378 }
379 
380 template<class MatrixType,class ContainerType>
381 int
384  return NumInitialize_;
385 }
386 
387 template<class MatrixType,class ContainerType>
388 int
391 {
392  return NumCompute_;
393 }
394 
395 template<class MatrixType,class ContainerType>
396 int
398 getNumApply () const
399 {
400  return NumApply_;
401 }
402 
403 template<class MatrixType,class ContainerType>
404 double
407 {
408  return InitializeTime_;
409 }
410 
411 template<class MatrixType,class ContainerType>
412 double
415 {
416  return ComputeTime_;
417 }
418 
419 template<class MatrixType,class ContainerType>
420 double
422 getApplyTime () const
423 {
424  return ApplyTime_;
425 }
426 
427 
428 template<class MatrixType,class ContainerType>
431  A_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::getNodeSmootherComplexity: "
432  "The input matrix A is null. Please call setMatrix() with a nonnull "
433  "input matrix, then call compute(), before calling this method.");
434  // Relaxation methods cost roughly one apply + one block-diagonal inverse per iteration
435  // NOTE: This approximates all blocks as dense, which may overstate the cost if you have a sparse (or banded) container.
436  size_t block_nnz = 0;
437  for (local_ordinal_type i = 0; i < NumLocalBlocks_; ++i)
438  block_nnz += Partitioner_->numRowsInPart(i) *Partitioner_->numRowsInPart(i);
439 
440  return block_nnz + A_->getNodeNumEntries();
441 }
442 
443 template<class MatrixType,class ContainerType>
444 void
446 apply (const Tpetra::MultiVector<typename MatrixType::scalar_type,
447  typename MatrixType::local_ordinal_type,
448  typename MatrixType::global_ordinal_type,
449  typename MatrixType::node_type>& X,
450  Tpetra::MultiVector<typename MatrixType::scalar_type,
451  typename MatrixType::local_ordinal_type,
452  typename MatrixType::global_ordinal_type,
453  typename MatrixType::node_type>& Y,
454  Teuchos::ETransp mode,
455  scalar_type alpha,
456  scalar_type beta) const
457 {
459  (A_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::apply: "
460  "The matrix is null. You must call setMatrix() with a nonnull matrix, "
461  "then call initialize() and compute() (in that order), before you may "
462  "call this method.");
464  ! isComputed (), std::runtime_error, "Ifpack2::BlockRelaxation::apply: "
465  "isComputed() must be true prior to calling apply.");
466  TEUCHOS_TEST_FOR_EXCEPTION(
467  X.getNumVectors () != Y.getNumVectors (), std::invalid_argument,
468  "Ifpack2::BlockRelaxation::apply: X.getNumVectors() = "
469  << X.getNumVectors () << " != Y.getNumVectors() = "
470  << Y.getNumVectors () << ".");
471  TEUCHOS_TEST_FOR_EXCEPTION(
472  mode != Teuchos::NO_TRANS, std::logic_error, "Ifpack2::BlockRelaxation::"
473  "apply: This method currently only implements the case mode == Teuchos::"
474  "NO_TRANS. Transposed modes are not currently supported.");
475  TEUCHOS_TEST_FOR_EXCEPTION(
476  alpha != Teuchos::ScalarTraits<scalar_type>::one (), std::logic_error,
477  "Ifpack2::BlockRelaxation::apply: This method currently only implements "
478  "the case alpha == 1. You specified alpha = " << alpha << ".");
479  TEUCHOS_TEST_FOR_EXCEPTION(
480  beta != Teuchos::ScalarTraits<scalar_type>::zero (), std::logic_error,
481  "Ifpack2::BlockRelaxation::apply: This method currently only implements "
482  "the case beta == 0. You specified beta = " << beta << ".");
483 
484  Time_->start(true);
485 
486  // If X and Y are pointing to the same memory location,
487  // we need to create an auxiliary vector, Xcopy
488  Teuchos::RCP<const MV> X_copy;
489  {
490  auto X_lcl_host = X.getLocalViewHost ();
491  auto Y_lcl_host = Y.getLocalViewHost ();
492 
493  if (X_lcl_host.data () == Y_lcl_host.data ()) {
494  X_copy = rcp (new MV (X, Teuchos::Copy));
495  } else {
496  X_copy = rcpFromRef (X);
497  }
498  }
499 
500  if (ZeroStartingSolution_) {
501  Y.putScalar (STS::zero ());
502  }
503 
504  // Flops are updated in each of the following.
505  switch (PrecType_) {
506  case Ifpack2::Details::JACOBI:
507  ApplyInverseJacobi(*X_copy,Y);
508  break;
509  case Ifpack2::Details::GS:
510  ApplyInverseGS(*X_copy,Y);
511  break;
512  case Ifpack2::Details::SGS:
513  ApplyInverseSGS(*X_copy,Y);
514  break;
515  case Ifpack2::Details::MTSPLITJACOBI:
516  //note: for this method, the container is always BlockTriDi
517  Container_->applyInverseJacobi(*X_copy, Y, DampingFactor_, ZeroStartingSolution_, NumSweeps_);
518  break;
519  default:
520  TEUCHOS_TEST_FOR_EXCEPTION
521  (true, std::logic_error, "Ifpack2::BlockRelaxation::apply: Invalid "
522  "PrecType_ enum value " << PrecType_ << ". Valid values are Ifpack2::"
523  "Details::JACOBI = " << Ifpack2::Details::JACOBI << ", Ifpack2::Details"
524  "::GS = " << Ifpack2::Details::GS << ", and Ifpack2::Details::SGS = "
525  << Ifpack2::Details::SGS << ". Please report this bug to the Ifpack2 "
526  "developers.");
527  }
528 
529  ++NumApply_;
530  Time_->stop();
531  ApplyTime_ += Time_->totalElapsedTime();
532 }
533 
534 template<class MatrixType,class ContainerType>
535 void
537 applyMat (const Tpetra::MultiVector<typename MatrixType::scalar_type,
538  typename MatrixType::local_ordinal_type,
539  typename MatrixType::global_ordinal_type,
540  typename MatrixType::node_type>& X,
541  Tpetra::MultiVector<typename MatrixType::scalar_type,
542  typename MatrixType::local_ordinal_type,
543  typename MatrixType::global_ordinal_type,
544  typename MatrixType::node_type>& Y,
545  Teuchos::ETransp mode) const
546 {
547  A_->apply (X, Y, mode);
548 }
549 
550 template<class MatrixType,class ContainerType>
551 void
554 {
555  using Teuchos::rcp;
556  typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type>
557  row_graph_type;
558 
560  (A_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::initialize: "
561  "The matrix is null. You must call setMatrix() with a nonnull matrix "
562  "before you may call this method.");
563 
564  // Check whether we have a BlockCrsMatrix
566  Teuchos::rcp_dynamic_cast<const block_crs_matrix_type> (A_);
567  hasBlockCrsMatrix_ = !A_bcrs.is_null();
568  if (A_bcrs.is_null ()) {
569  hasBlockCrsMatrix_ = false;
570  }
571  else {
572  hasBlockCrsMatrix_ = true;
573  }
574 
575  IsInitialized_ = false;
576  Time_->start (true);
577 
578  NumLocalRows_ = A_->getNodeNumRows ();
579  NumGlobalRows_ = A_->getGlobalNumRows ();
580  NumGlobalNonzeros_ = A_->getGlobalNumEntries ();
581 
582  // NTS: Will need to add support for Zoltan2 partitions later Also,
583  // will need a better way of handling the Graph typing issue.
584  // Especially with ordinal types w.r.t the container.
585  Partitioner_ = Teuchos::null;
586 
587  if (PartitionerType_ == "linear") {
588  Partitioner_ =
589  rcp (new Ifpack2::LinearPartitioner<row_graph_type> (A_->getGraph ()));
590  } else if (PartitionerType_ == "line") {
591  Partitioner_ =
593  } else if (PartitionerType_ == "user") {
594  Partitioner_ =
595  rcp (new Ifpack2::Details::UserPartitioner<row_graph_type> (A_->getGraph () ) );
596  } else {
597  // We should have checked for this in setParameters(), so it's a
598  // logic_error, not an invalid_argument or runtime_error.
600  (true, std::logic_error, "Ifpack2::BlockRelaxation::initialize: Unknown "
601  "partitioner type " << PartitionerType_ << ". Valid values are "
602  "\"linear\", \"line\", and \"user\".");
603  }
604 
605  // need to partition the graph of A
606  Partitioner_->setParameters (List_);
607  Partitioner_->compute ();
608 
609  // get actual number of partitions
610  NumLocalBlocks_ = Partitioner_->numLocalParts ();
611 
612  // Note: Unlike Ifpack, we'll punt on computing W_ until compute(), which is where
613  // we assume that the type of relaxation has been chosen.
614 
615  if (A_->getComm()->getSize() != 1) {
616  IsParallel_ = true;
617  } else {
618  IsParallel_ = false;
619  }
620 
621  // We should have checked for this in setParameters(), so it's a
622  // logic_error, not an invalid_argument or runtime_error.
624  (NumSweeps_ < 0, std::logic_error, "Ifpack2::BlockRelaxation::initialize: "
625  "NumSweeps_ = " << NumSweeps_ << " < 0.");
626 
627  // Extract the submatrices
628  ExtractSubmatricesStructure ();
629 
630  // Compute the weight vector if we're doing overlapped Jacobi (and
631  // only if we're doing overlapped Jacobi).
632  if (PrecType_ == Ifpack2::Details::JACOBI && OverlapLevel_ > 0) {
634  (hasBlockCrsMatrix_, std::runtime_error,
635  "Ifpack2::BlockRelaxation::initialize: "
636  "We do not support overlapped Jacobi yet for Tpetra::BlockCrsMatrix. Sorry!");
637 
638  // weight of each vertex
639  W_ = rcp (new vector_type (A_->getRowMap ()));
640  W_->putScalar (STS::zero ());
641  Teuchos::ArrayRCP<scalar_type > w_ptr = W_->getDataNonConst(0);
642 
643  for (local_ordinal_type i = 0 ; i < NumLocalBlocks_ ; ++i) {
644  for (size_t j = 0 ; j < Partitioner_->numRowsInPart(i) ; ++j) {
645  local_ordinal_type LID = (*Partitioner_)(i,j);
646  w_ptr[LID] += STS::one();
647  }
648  }
649  W_->reciprocal (*W_);
650  }
651 
652  ++NumInitialize_;
653  Time_->stop ();
654  InitializeTime_ += Time_->totalElapsedTime ();
655  IsInitialized_ = true;
656 }
657 
658 
659 template<class MatrixType,class ContainerType>
660 void
663 {
664  using Teuchos::rcp;
665 
667  (A_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::compute: "
668  "The matrix is null. You must call setMatrix() with a nonnull matrix, "
669  "then call initialize(), before you may call this method.");
670 
671  if (! isInitialized ()) {
672  initialize ();
673  }
674 
675  Time_->start (true);
676 
677  // reset values
678  IsComputed_ = false;
679 
680  Container_->compute(); // compute each block matrix
681 
682  ++NumCompute_;
683  Time_->stop ();
684  ComputeTime_ += Time_->totalElapsedTime();
685  IsComputed_ = true;
686 }
687 
688 template<class MatrixType, class ContainerType>
689 void
692 {
694  (Partitioner_.is_null (), std::runtime_error, "Ifpack2::BlockRelaxation::"
695  "ExtractSubmatricesStructure: Partitioner object is null.");
696 
697  std::string containerType = ContainerType::getName ();
698  if (containerType == "Generic") {
699  // ContainerType is Container<row_matrix_type>. Thus, we need to
700  // get the container name from the parameter list. We use "TriDi"
701  // as the default container type.
702  containerType = containerType_;
703  }
704  //Whether the Container will define blocks (partitions)
705  //in terms of individual DOFs, and not by nodes (blocks).
706  bool pointIndexed = decouple_ && hasBlockCrsMatrix_;
708  if(decouple_)
709  {
710  //dofs [per node] is how many blocks each partition will be split into
711  auto A_bcrs = Teuchos::rcp_dynamic_cast<const block_crs_matrix_type>(A_);
712  local_ordinal_type dofs = hasBlockCrsMatrix_ ?
713  A_bcrs->getBlockSize() : List_.get<int>("partitioner: PDE equations");
714  blockRows.resize(NumLocalBlocks_ * dofs);
715  if(hasBlockCrsMatrix_)
716  {
717  for(local_ordinal_type i = 0; i < NumLocalBlocks_; i++)
718  {
719  size_t blockSize = Partitioner_->numRowsInPart(i);
720  //block i will be split into j different blocks,
721  //each corresponding to a different dof
722  for(local_ordinal_type j = 0; j < dofs; j++)
723  {
724  local_ordinal_type blockIndex = i * dofs + j;
725  blockRows[blockIndex].resize(blockSize);
726  for(size_t k = 0; k < blockSize; k++)
727  {
728  //here, the row and dof are combined to get the point index
729  //(what the row would be if A were a CrsMatrix)
730  blockRows[blockIndex][k] = (*Partitioner_)(i, k) * dofs + j;
731  }
732  }
733  }
734  }
735  else
736  {
737  //Rows in each partition are distributed round-robin to the blocks -
738  //that's how MueLu stores DOFs in a non-block matrix
739  for(local_ordinal_type i = 0; i < NumLocalBlocks_; i++)
740  {
741  //#ifdef HAVE_IFPACK2_DEBUG
742  TEUCHOS_TEST_FOR_EXCEPTION(Partitioner_->numRowsInPart(i) % dofs != 0, std::logic_error,
743  "Expected size of all blocks (partitions) to be divisible by MueLu dofs/node.");
744  size_t blockSize = Partitioner_->numRowsInPart(i) / dofs;
745  //#endif
746  //block i will be split into j different blocks,
747  //each corresponding to a different dof
748  for(local_ordinal_type j = 0; j < dofs; j++)
749  {
750  local_ordinal_type blockIndex = i * dofs + j;
751  blockRows[blockIndex].resize(blockSize);
752  for(size_t k = 0; k < blockSize; k++)
753  {
754  blockRows[blockIndex][k] = (*Partitioner_)(i, k * dofs + j);
755  }
756  }
757  }
758  }
759  }
760  else
761  {
762  //No decoupling - just get the rows directly from Partitioner
763  blockRows.resize(NumLocalBlocks_);
764  for(local_ordinal_type i = 0; i < NumLocalBlocks_; ++i)
765  {
766  const size_t numRows = Partitioner_->numRowsInPart (i);
767  blockRows[i].resize(numRows);
768  // Extract a list of the indices of each partitioner row.
769  for (size_t j = 0; j < numRows; ++j)
770  {
771  blockRows[i][j] = (*Partitioner_) (i,j);
772  }
773  }
774  }
775  //right before constructing the
776  Container_ = ContainerFactory<MatrixType>::build(containerType, A_, blockRows, Importer_, pointIndexed);
777  Container_->setParameters(List_);
778  Container_->initialize();
779 }
780 
781 template<class MatrixType,class ContainerType>
782 void
783 BlockRelaxation<MatrixType,ContainerType>::
784 ApplyInverseJacobi (const MV& X, MV& Y) const
785 {
786  const size_t NumVectors = X.getNumVectors ();
787  auto XView = X.getLocalViewHost ();
788  auto YView = Y.getLocalViewHost ();
789 
790  MV AY (Y.getMap (), NumVectors);
791 
792  auto AYView = AY.getLocalViewHost ();
793 
794  // Initial matvec not needed
795  int starting_iteration = 0;
796  if (OverlapLevel_ > 0)
797  {
798  //Overlapping jacobi, with view of W_
799  auto WView = W_->getLocalViewHost ();
800  if(ZeroStartingSolution_) {
801  Container_->DoOverlappingJacobi(XView, YView, WView, DampingFactor_);
802  starting_iteration = 1;
803  }
804  const scalar_type ONE = STS::one();
805  for(int j = starting_iteration; j < NumSweeps_; j++)
806  {
807  applyMat (Y, AY);
808  AY.update (ONE, X, -ONE);
809  Container_->DoOverlappingJacobi (AYView, YView, WView, DampingFactor_);
810  }
811  }
812  else
813  {
814  //Non-overlapping
815  if(ZeroStartingSolution_)
816  {
817  Container_->DoJacobi (XView, YView, DampingFactor_);
818  starting_iteration = 1;
819  }
820  const scalar_type ONE = STS::one();
821  for(int j = starting_iteration; j < NumSweeps_; j++)
822  {
823  applyMat (Y, AY);
824  AY.update (ONE, X, -ONE);
825  Container_->DoJacobi (AYView, YView, DampingFactor_);
826  }
827  }
828 }
829 
830 template<class MatrixType,class ContainerType>
831 void
832 BlockRelaxation<MatrixType,ContainerType>::
833 ApplyInverseGS (const MV& X, MV& Y) const
834 {
835  using Teuchos::Ptr;
836  using Teuchos::ptr;
837  size_t numVecs = X.getNumVectors();
838  //Get view of X (is never modified in this function)
839  auto XView = X.getLocalViewHost ();
840  auto YView = Y.getLocalViewHost ();
841  //Pre-import Y, if parallel
842  Ptr<MV> Y2;
843  bool deleteY2 = false;
844  if(IsParallel_)
845  {
846  Y2 = ptr(new MV(Importer_->getTargetMap(), numVecs));
847  deleteY2 = true;
848  }
849  else
850  Y2 = ptr(&Y);
851  if(IsParallel_)
852  {
853  for(int j = 0; j < NumSweeps_; ++j)
854  {
855  //do import once per sweep
856  Y2->doImport(Y, *Importer_, Tpetra::INSERT);
857  auto Y2View = Y2->getLocalViewHost ();
858  Container_->DoGaussSeidel(XView, YView, Y2View, DampingFactor_);
859  }
860  }
861  else
862  {
863  auto Y2View = Y2->getLocalViewHost ();
864  for(int j = 0; j < NumSweeps_; ++j)
865  {
866  Container_->DoGaussSeidel(XView, YView, Y2View, DampingFactor_);
867  }
868  }
869  if(deleteY2)
870  delete Y2.get();
871 }
872 
873 template<class MatrixType,class ContainerType>
874 void
875 BlockRelaxation<MatrixType,ContainerType>::
876 ApplyInverseSGS (const MV& X, MV& Y) const
877 {
878  using Teuchos::Ptr;
879  using Teuchos::ptr;
880  //Get view of X (is never modified in this function)
881  auto XView = X.getLocalViewHost ();
882  auto YView = Y.getLocalViewHost ();
883  //Pre-import Y, if parallel
884  Ptr<MV> Y2;
885  bool deleteY2 = false;
886  if(IsParallel_)
887  {
888  Y2 = ptr(new MV(Importer_->getTargetMap(), X.getNumVectors()));
889  deleteY2 = true;
890  }
891  else
892  Y2 = ptr(&Y);
893  if(IsParallel_)
894  {
895  for(int j = 0; j < NumSweeps_; ++j)
896  {
897  //do import once per sweep
898  Y2->doImport(Y, *Importer_, Tpetra::INSERT);
899  auto Y2View = Y2->getLocalViewHost ();
900  Container_->DoSGS(XView, YView, Y2View, DampingFactor_);
901  }
902  }
903  else
904  {
905  auto Y2View = Y2->getLocalViewHost ();
906  for(int j = 0; j < NumSweeps_; ++j)
907  {
908  Container_->DoSGS(XView, YView, Y2View, DampingFactor_);
909  }
910  }
911  if(deleteY2)
912  delete Y2.get();
913 }
914 
915 template<class MatrixType,class ContainerType>
916 void BlockRelaxation<MatrixType,ContainerType>::computeImporter () const
917 {
918  using Teuchos::RCP;
919  using Teuchos::rcp;
920  using Teuchos::Ptr;
921  using Teuchos::ArrayView;
922  using Teuchos::Array;
923  using Teuchos::Comm;
924  using Teuchos::rcp_dynamic_cast;
925  if(IsParallel_)
926  {
927  if(hasBlockCrsMatrix_)
928  {
929  const RCP<const block_crs_matrix_type> bcrs =
930  rcp_dynamic_cast<const block_crs_matrix_type>(A_);
931  int bs_ = bcrs->getBlockSize();
932  RCP<const map_type> oldDomainMap = A_->getDomainMap();
933  RCP<const map_type> oldColMap = A_->getColMap();
934  // Because A is a block CRS matrix, import will not do what you think it does
935  // We have to construct the correct maps for it
936  global_size_t numGlobalElements = oldColMap->getGlobalNumElements() * bs_;
937  global_ordinal_type indexBase = oldColMap->getIndexBase();
938  RCP<const Comm<int>> comm = oldColMap->getComm();
939  ArrayView<const global_ordinal_type> oldColElements = oldColMap->getNodeElementList();
940  Array<global_ordinal_type> newColElements(bs_ * oldColElements.size());
941  for(int i = 0; i < oldColElements.size(); i++)
942  {
943  for(int j = 0; j < bs_; j++)
944  newColElements[i * bs_ + j] = oldColElements[i] * bs_ + j;
945  }
946  RCP<map_type> colMap(new map_type(numGlobalElements, newColElements, indexBase, comm));
947  // Create the importer
948  Importer_ = rcp(new import_type(oldDomainMap, colMap));
949  }
950  else if(!A_.is_null())
951  {
952  Importer_ = A_->getGraph()->getImporter();
953  if(Importer_.is_null())
954  Importer_ = rcp(new import_type(A_->getDomainMap(), A_->getColMap()));
955  }
956  }
957  //otherwise, Importer_ is not needed and is left NULL
958 }
959 
960 template<class MatrixType, class ContainerType>
961 std::string
963 description () const
964 {
965  std::ostringstream out;
966 
967  // Output is a valid YAML dictionary in flow style. If you don't
968  // like everything on a single line, you should call describe()
969  // instead.
970  out << "\"Ifpack2::BlockRelaxation\": {";
971  if (this->getObjectLabel () != "") {
972  out << "Label: \"" << this->getObjectLabel () << "\", ";
973  }
974  // out << "Initialized: " << (isInitialized () ? "true" : "false") << ", ";
975  // out << "Computed: " << (isComputed () ? "true" : "false") << ", ";
976  if (A_.is_null ()) {
977  out << "Matrix: null, ";
978  }
979  else {
980  // out << "Matrix: not null"
981  // << ", Global matrix dimensions: ["
982  out << "Global matrix dimensions: ["
983  << A_->getGlobalNumRows () << ", " << A_->getGlobalNumCols () << "], ";
984  }
985 
986  // It's useful to print this instance's relaxation method. If you
987  // want more info than that, call describe() instead.
988  out << "\"relaxation: type\": ";
989  if (PrecType_ == Ifpack2::Details::JACOBI) {
990  out << "Block Jacobi";
991  } else if (PrecType_ == Ifpack2::Details::GS) {
992  out << "Block Gauss-Seidel";
993  } else if (PrecType_ == Ifpack2::Details::SGS) {
994  out << "Block Symmetric Gauss-Seidel";
995  } else {
996  out << "INVALID";
997  }
998  // Print the approximate # rows per part
999  int approx_rows_per_part = A_->getNodeNumRows()/Partitioner_->numLocalParts();
1000  out <<", blocksize: "<<approx_rows_per_part;
1001 
1002  out << ", overlap: " << OverlapLevel_;
1003 
1004  out << ", " << "sweeps: " << NumSweeps_ << ", "
1005  << "damping factor: " << DampingFactor_ << ", ";
1006 
1007  std::string containerType = ContainerType::getName();
1008  out << "block container: " << ((containerType == "Generic") ? containerType_ : containerType);
1009  if(List_.isParameter("partitioner: PDE equations"))
1010  out << ", dofs/node: "<<List_.get<int>("partitioner: PDE equations");
1011 
1012 
1013  out << "}";
1014  return out.str();
1015 }
1016 
1017 template<class MatrixType,class ContainerType>
1018 void
1021  const Teuchos::EVerbosityLevel verbLevel) const
1022 {
1023  using std::endl;
1024  using std::setw;
1026  using Teuchos::VERB_DEFAULT;
1027  using Teuchos::VERB_NONE;
1028  using Teuchos::VERB_LOW;
1029  using Teuchos::VERB_MEDIUM;
1030  using Teuchos::VERB_HIGH;
1031  using Teuchos::VERB_EXTREME;
1032 
1033  Teuchos::EVerbosityLevel vl = verbLevel;
1034  if (vl == VERB_DEFAULT) vl = VERB_LOW;
1035  const int myImageID = A_->getComm()->getRank();
1036 
1037  // Convention requires that describe() begin with a tab.
1038  Teuchos::OSTab tab (out);
1039 
1040  // none: print nothing
1041  // low: print O(1) info from node 0
1042  // medium:
1043  // high:
1044  // extreme:
1045  if (vl != VERB_NONE && myImageID == 0) {
1046  out << "Ifpack2::BlockRelaxation<"
1047  << TypeNameTraits<MatrixType>::name () << ", "
1048  << TypeNameTraits<ContainerType>::name () << " >:";
1049  Teuchos::OSTab tab1 (out);
1050 
1051  if (this->getObjectLabel () != "") {
1052  out << "label: \"" << this->getObjectLabel () << "\"" << endl;
1053  }
1054  out << "initialized: " << (isInitialized () ? "true" : "false") << endl
1055  << "computed: " << (isComputed () ? "true" : "false") << endl;
1056 
1057  std::string precType;
1058  if (PrecType_ == Ifpack2::Details::JACOBI) {
1059  precType = "Block Jacobi";
1060  } else if (PrecType_ == Ifpack2::Details::GS) {
1061  precType = "Block Gauss-Seidel";
1062  } else if (PrecType_ == Ifpack2::Details::SGS) {
1063  precType = "Block Symmetric Gauss-Seidel";
1064  }
1065  out << "type: " << precType << endl
1066  << "global number of rows: " << A_->getGlobalNumRows () << endl
1067  << "global number of columns: " << A_->getGlobalNumCols () << endl
1068  << "number of sweeps: " << NumSweeps_ << endl
1069  << "damping factor: " << DampingFactor_ << endl
1070  << "backwards mode: "
1071  << ((PrecType_ == Ifpack2::Details::GS && DoBackwardGS_) ? "true" : "false")
1072  << endl
1073  << "zero starting solution: "
1074  << (ZeroStartingSolution_ ? "true" : "false") << endl;
1075  }
1076 }
1077 
1078 }//namespace Ifpack2
1079 
1080 
1081 // Macro that does explicit template instantiation (ETI) for
1082 // Ifpack2::BlockRelaxation. S, LO, GO, N correspond to the four
1083 // template parameters of Ifpack2::Preconditioner and
1084 // Tpetra::RowMatrix.
1085 //
1086 // We only instantiate for MatrixType = Tpetra::RowMatrix. There's no
1087 // need to instantiate for Tpetra::CrsMatrix too. All Ifpack2
1088 // preconditioners can and should do dynamic casts if they need a type
1089 // more specific than RowMatrix. This keeps build time short and
1090 // library and executable sizes small.
1091 
1092 #ifdef HAVE_IFPACK2_EXPLICIT_INSTANTIATION
1093 
1094 #define IFPACK2_BLOCKRELAXATION_INSTANT(S,LO,GO,N) \
1095  template \
1096  class Ifpack2::BlockRelaxation< \
1097  Tpetra::RowMatrix<S, LO, GO, N>, \
1098  Ifpack2::Container<Tpetra::RowMatrix<S, LO, GO, N> > >;
1099 
1100 #endif // HAVE_IFPACK2_EXPLICIT_INSTANTIATION
1101 
1102 #endif // IFPACK2_BLOCKRELAXATION_DEF_HPP
Ifpack2::BlockRelaxation class declaration.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the input matrix is distributed.
Definition: Ifpack2_BlockRelaxation_def.hpp:327
ParameterList & disableRecursiveValidation()
std::string description() const
A one-line description of this object.
Definition: Ifpack2_BlockRelaxation_def.hpp:963
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:422
T & get(const std::string &name, T def_value)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:398
void getParameter(const Teuchos::ParameterList &params, const std::string &name, T &value)
Set a value from a ParameterList if a parameter with the specified name exists.
Definition: Ifpack2_Parameters.hpp:59
Teuchos::RCP< const map_type > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:364
int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:390
void setParameters(const Teuchos::ParameterList &params)
Sets all the parameters for the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:173
void compute()
compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation ...
Definition: Ifpack2_BlockRelaxation_def.hpp:662
Block relaxation preconditioners (or smoothers) for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse ma...
Definition: Ifpack2_BlockRelaxation_decl.hpp:83
double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:406
Declaration of a user-defined partitioner in which the user can define a partition of the graph...
bool isParameter(const std::string &name) const
T * getRawPtr() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:414
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
Definition: Ifpack2_BlockRelaxation_def.hpp:429
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_BlockRelaxation_decl.hpp:109
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition: Ifpack2_BlockRelaxation_def.hpp:57
virtual ~BlockRelaxation()
Destructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:118
Teuchos::RCP< const map_type > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:350
Partition in which the user can define a nonoverlapping partition of the graph in any way they choose...
Definition: Ifpack2_Details_UserPartitioner_decl.hpp:69
void resize(size_type new_size, const value_type &x=value_type())
int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:383
void initialize()
Initialize.
Definition: Ifpack2_BlockRelaxation_def.hpp:553
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
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_BlockRelaxation_def.hpp:1020
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:101
void applyMat(const MV &X, MV &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS) const
Applies the matrix to a Tpetra::MultiVector.
Definition: Ifpack2_BlockRelaxation_def.hpp:537
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:98
Interface for creating and solving a set of local linear problems.
Definition: Ifpack2_Container_decl.hpp:112
bool isType(const std::string &name) const
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
static Teuchos::RCP< BaseContainer > build(std::string containerType, const Teuchos::RCP< const MatrixType > &A, const Teuchos::Array< Teuchos::Array< local_ordinal_type >> &partitions, const Teuchos::RCP< const import_type > importer, bool pointIndexed)
Build a specialization of Ifpack2::Container given a key that has been registered.
Definition: Ifpack2_ContainerFactory_def.hpp:89
Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix of this preconditioner&#39;s constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:341
void getValidParameters(Teuchos::ParameterList &params)
Fills a list which contains all the parameters possibly used by Ifpack2.
Definition: Ifpack2_Parameters.cpp:51
Ifpack2::LinePartitioner: A class to define partitions into a set of lines.
Definition: Ifpack2_LinePartitioner_decl.hpp:77
A class to define linear partitions.
Definition: Ifpack2_LinearPartitioner_decl.hpp:60
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return a list of all the parameters that this class accepts.
Definition: Ifpack2_BlockRelaxation_def.hpp:124
void apply(const MV &X, MV &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const
Applies the preconditioner to X, returns the result in Y.
Definition: Ifpack2_BlockRelaxation_def.hpp:446
BlockRelaxation(const Teuchos::RCP< const row_matrix_type > &Matrix)
Constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:85
bool is_null() const