43 #ifndef IFPACK2_BLOCKRELAXATION_DEF_HPP 44 #define IFPACK2_BLOCKRELAXATION_DEF_HPP 47 #include "Ifpack2_LinearPartitioner.hpp" 48 #include "Ifpack2_LinePartitioner.hpp" 50 #include "Ifpack2_Details_UserPartitioner_def.hpp" 51 #include <Ifpack2_Parameters.hpp> 55 template<
class MatrixType,
class ContainerType>
60 IsInitialized_ =
false;
62 Partitioner_ = Teuchos::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();
71 if (! Container_.is_null ()) {
72 Container_->clearBlocks();
81 template<
class MatrixType,
class ContainerType>
88 PartitionerType_ (
"linear"),
91 containerType_ (
"Dense"),
93 ZeroStartingSolution_ (true),
94 hasBlockCrsMatrix_ (false),
95 DoBackwardGS_ (false),
97 DampingFactor_ (
STS::one ()),
98 IsInitialized_ (false),
103 InitializeTime_ (0.0),
107 NumGlobalNonzeros_ (0),
114 template<
class MatrixType,
class ContainerType>
119 template<
class MatrixType,
class ContainerType>
136 containerType_ = List.
get<std::string> (
"relaxation: container");
140 const std::string relaxType = List.
get<std::string> (
"relaxation: type");
142 if (relaxType ==
"Jacobi") {
143 PrecType_ = Ifpack2::Details::JACOBI;
145 else if (relaxType ==
"Gauss-Seidel") {
146 PrecType_ = Ifpack2::Details::GS;
148 else if (relaxType ==
"Symmetric Gauss-Seidel") {
149 PrecType_ = Ifpack2::Details::SGS;
153 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 154 "setParameters: Invalid parameter value \"" << relaxType
155 <<
"\" for parameter \"relaxation: type\".");
160 NumSweeps_ = List.
get<
int> (
"relaxation: sweeps");
166 if (List.
isParameter (
"relaxation: damping factor")) {
167 if (List.
isType<
double> (
"relaxation: damping factor")) {
168 const double dampingFactor =
169 List.
get<
double> (
"relaxation: damping factor");
170 DampingFactor_ =
static_cast<scalar_type> (dampingFactor);
173 DampingFactor_ = List.
get<
scalar_type> (
"relaxation: damping factor");
178 DampingFactor_ =
static_cast<scalar_type> (dampingFactor);
182 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 183 "setParameters: Parameter \"relaxation: damping factor\" " 184 "has the wrong type.");
188 if (List.
isParameter (
"relaxation: zero starting solution")) {
189 ZeroStartingSolution_ = List.
get<
bool> (
"relaxation: zero starting solution");
192 if (List.
isParameter (
"relaxation: backward mode")) {
193 DoBackwardGS_ = List.
get<
bool> (
"relaxation: backward mode");
197 PartitionerType_ = List.
get<std::string> (
"partitioner: type");
202 if (List.
isParameter (
"partitioner: local parts")) {
206 else if (! std::is_same<int, local_ordinal_type>::value &&
207 List.
isType<
int> (
"partitioner: local parts")) {
208 NumLocalBlocks_ = List.
get<
int> (
"partitioner: local parts");
212 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 213 "setParameters: Parameter \"partitioner: local parts\" " 214 "has the wrong type.");
218 if (List.
isParameter (
"partitioner: overlap level")) {
219 if (List.
isType<
int> (
"partitioner: overlap level")) {
220 OverlapLevel_ = List.
get<
int> (
"partitioner: overlap level");
222 else if (! std::is_same<int, local_ordinal_type>::value &&
228 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 229 "setParameters: Parameter \"partitioner: overlap level\" " 230 "has the wrong type.");
234 std::string defaultContainer =
"Dense";
241 if (PrecType_ != Ifpack2::Details::JACOBI) {
244 if (NumLocalBlocks_ < static_cast<local_ordinal_type> (0)) {
245 NumLocalBlocks_ = A_->getNodeNumRows() / (-NumLocalBlocks_);
251 DoBackwardGS_, std::runtime_error,
252 "Ifpack2::BlockRelaxation:setParameters: Setting the \"relaxation: " 253 "backward mode\" parameter to true is not yet supported.");
260 template<
class MatrixType,
class ContainerType>
265 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::getComm: " 266 "The matrix is null. You must call setMatrix() with a nonnull matrix " 267 "before you may call this method.");
268 return A_->getComm ();
271 template<
class MatrixType,
class ContainerType>
272 Teuchos::RCP<
const Tpetra::RowMatrix<
typename MatrixType::scalar_type,
273 typename MatrixType::local_ordinal_type,
274 typename MatrixType::global_ordinal_type,
275 typename MatrixType::node_type> >
280 template<
class MatrixType,
class ContainerType>
281 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
282 typename MatrixType::global_ordinal_type,
283 typename MatrixType::node_type> >
288 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::" 289 "getDomainMap: The matrix is null. You must call setMatrix() with a " 290 "nonnull matrix before you may call this method.");
291 return A_->getDomainMap ();
294 template<
class MatrixType,
class ContainerType>
295 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
296 typename MatrixType::global_ordinal_type,
297 typename MatrixType::node_type> >
302 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::" 303 "getRangeMap: The matrix is null. You must call setMatrix() with a " 304 "nonnull matrix before you may call this method.");
305 return A_->getRangeMap ();
308 template<
class MatrixType,
class ContainerType>
315 template<
class MatrixType,
class ContainerType>
319 return NumInitialize_;
322 template<
class MatrixType,
class ContainerType>
330 template<
class MatrixType,
class ContainerType>
338 template<
class MatrixType,
class ContainerType>
343 return InitializeTime_;
346 template<
class MatrixType,
class ContainerType>
354 template<
class MatrixType,
class ContainerType>
362 template<
class MatrixType,
class ContainerType>
365 apply (
const Tpetra::MultiVector<
typename MatrixType::scalar_type,
366 typename MatrixType::local_ordinal_type,
367 typename MatrixType::global_ordinal_type,
368 typename MatrixType::node_type>& X,
369 Tpetra::MultiVector<
typename MatrixType::scalar_type,
370 typename MatrixType::local_ordinal_type,
371 typename MatrixType::global_ordinal_type,
372 typename MatrixType::node_type>& Y,
378 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::apply: " 379 "The matrix is null. You must call setMatrix() with a nonnull matrix, " 380 "then call initialize() and compute() (in that order), before you may " 381 "call this method.");
383 ! isComputed (), std::runtime_error,
"Ifpack2::BlockRelaxation::apply: " 384 "isComputed() must be true prior to calling apply.");
386 X.getNumVectors () != Y.getNumVectors (), std::invalid_argument,
387 "Ifpack2::BlockRelaxation::apply: X.getNumVectors() = " 388 << X.getNumVectors () <<
" != Y.getNumVectors() = " 389 << Y.getNumVectors () <<
".");
391 mode != Teuchos::NO_TRANS, std::logic_error,
"Ifpack2::BlockRelaxation::" 392 "apply: This method currently only implements the case mode == Teuchos::" 393 "NO_TRANS. Transposed modes are not currently supported.");
396 "Ifpack2::BlockRelaxation::apply: This method currently only implements " 397 "the case alpha == 1. You specified alpha = " << alpha <<
".");
400 "Ifpack2::BlockRelaxation::apply: This method currently only implements " 401 "the case beta == 0. You specified beta = " << beta <<
".");
409 auto X_lcl_host = X.template getLocalView<Kokkos::HostSpace> ();
410 auto Y_lcl_host = Y.template getLocalView<Kokkos::HostSpace> ();
411 if (X_lcl_host.ptr_on_device () == Y_lcl_host.ptr_on_device ()) {
412 X_copy =
rcp (
new MV (X, Teuchos::Copy));
414 X_copy = rcpFromRef (X);
418 if (ZeroStartingSolution_) {
419 Y.putScalar (STS::zero ());
424 case Ifpack2::Details::JACOBI:
425 ApplyInverseJacobi(*X_copy,Y);
427 case Ifpack2::Details::GS:
428 ApplyInverseGS(*X_copy,Y);
430 case Ifpack2::Details::SGS:
431 ApplyInverseSGS(*X_copy,Y);
435 (
true, std::logic_error,
"Ifpack2::BlockRelaxation::apply: Invalid " 436 "PrecType_ enum value " << PrecType_ <<
". Valid values are Ifpack2::" 437 "Details::JACOBI = " << Ifpack2::Details::JACOBI <<
", Ifpack2::Details" 438 "::GS = " << Ifpack2::Details::GS <<
", and Ifpack2::Details::SGS = " 439 << Ifpack2::Details::SGS <<
". Please report this bug to the Ifpack2 " 445 ApplyTime_ += Time_->totalElapsedTime();
448 template<
class MatrixType,
class ContainerType>
451 applyMat (
const Tpetra::MultiVector<
typename MatrixType::scalar_type,
452 typename MatrixType::local_ordinal_type,
453 typename MatrixType::global_ordinal_type,
454 typename MatrixType::node_type>& X,
455 Tpetra::MultiVector<
typename MatrixType::scalar_type,
456 typename MatrixType::local_ordinal_type,
457 typename MatrixType::global_ordinal_type,
458 typename MatrixType::node_type>& Y,
461 A_->apply (X, Y, mode);
464 template<
class MatrixType,
class ContainerType>
470 typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type>
474 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::initialize: " 475 "The matrix is null. You must call setMatrix() with a nonnull matrix " 476 "before you may call this method.");
480 Teuchos::rcp_dynamic_cast<
const block_crs_matrix_type> (A_);
481 hasBlockCrsMatrix_ = !A_bcrs.
is_null();
482 if (A_bcrs.is_null ()) {
483 hasBlockCrsMatrix_ =
false;
486 hasBlockCrsMatrix_ =
true;
489 IsInitialized_ =
false;
492 NumLocalRows_ = A_->getNodeNumRows ();
493 NumGlobalRows_ = A_->getGlobalNumRows ();
494 NumGlobalNonzeros_ = A_->getGlobalNumEntries ();
499 Partitioner_ = Teuchos::null;
501 if (PartitionerType_ ==
"linear") {
504 }
else if (PartitionerType_ ==
"line") {
507 }
else if (PartitionerType_ ==
"user") {
514 (
true, std::logic_error,
"Ifpack2::BlockRelaxation::initialize: Unknown " 515 "partitioner type " << PartitionerType_ <<
". Valid values are " 516 "\"linear\", \"line\", and \"user\".");
520 Partitioner_->setParameters (List_);
521 Partitioner_->compute ();
524 NumLocalBlocks_ = Partitioner_->numLocalParts ();
529 if (A_->getComm()->getSize() != 1) {
537 InitializeTime_ += Time_->totalElapsedTime ();
538 IsInitialized_ =
true;
542 template<
class MatrixType,
class ContainerType>
561 ExtractSubmatrices ();
566 (PrecType_ == Ifpack2::Details::JACOBI && OverlapLevel_ > 0, std::runtime_error,
567 "Ifpack2::BlockRelaxation::computeBlockCrs: " 568 "We do not support overlapped Jacobi yet for Tpetra::BlockCrsMatrix. Sorry!");
572 ComputeTime_ += Time_->totalElapsedTime();
577 template<
class MatrixType,
class ContainerType>
589 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::compute: " 590 "The matrix is null. You must call setMatrix() with a nonnull matrix, " 591 "then call initialize(), before you may call this method.");
596 (NumSweeps_ < 0, std::logic_error,
"Ifpack2::BlockRelaxation::compute: " 597 "NumSweeps_ = " << NumSweeps_ <<
" < 0.");
599 if (! isInitialized ()) {
603 if (hasBlockCrsMatrix_) {
614 ExtractSubmatrices ();
618 if (PrecType_ == Ifpack2::Details::JACOBI && OverlapLevel_ > 0) {
620 W_ =
rcp (
new vector_type (A_->getRowMap ()));
621 W_->putScalar (STS::zero ());
625 for (
size_t j = 0 ; j < Partitioner_->numRowsInPart(i) ; ++j) {
628 int LID = (*Partitioner_)(i,j);
629 w_ptr[LID]+= STS::one();
632 W_->reciprocal (*W_);
636 ComputeTime_ += Time_->totalElapsedTime();
640 template<
class MatrixType,
class ContainerType>
646 (Partitioner_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::" 647 "ExtractSubmatrices: Partitioner object is null.");
649 NumLocalBlocks_ = Partitioner_->numLocalParts ();
650 std::string containerType = ContainerType::getName ();
651 if (containerType ==
"Generic") {
655 containerType = containerType_;
659 for (local_ordinal_type i = 0; i < NumLocalBlocks_; ++i) {
660 const size_t numRows = Partitioner_->numRowsInPart (i);
662 localRows[i].resize(numRows);
664 for (
size_t j = 0; j < numRows; ++j) {
665 localRows[i][j] = (*Partitioner_) (i,j);
668 Container_ = Teuchos::rcp_static_cast<Container<MatrixType>>
669 (Details::createContainer<row_matrix_type> (containerType, A_, localRows, Importer_,
670 OverlapLevel_, DampingFactor_));
671 Container_->setParameters(List_);
672 Container_->initialize();
673 Container_->compute();
676 template<
class MatrixType,
class ContainerType>
678 BlockRelaxation<MatrixType,ContainerType>::
679 ApplyInverseJacobi (
const MV& X, MV& Y)
const 681 const size_t NumVectors = X.getNumVectors ();
682 typename ContainerType::HostView XView = X.template getLocalView<Kokkos::HostSpace>();
683 typename ContainerType::HostView YView = Y.template getLocalView<Kokkos::HostSpace>();
684 MV AY (Y.getMap (), NumVectors);
686 typename ContainerType::HostView AYView = AY.template getLocalView<Kokkos::HostSpace>();
688 int starting_iteration = 0;
689 if (OverlapLevel_ > 0)
692 typename ContainerType::HostView WView = W_->template getLocalView<Kokkos::HostSpace>();
693 if(ZeroStartingSolution_) {
694 Container_->DoOverlappingJacobi(XView, YView, WView, X.getStride());
695 starting_iteration = 1;
697 const scalar_type ONE = STS::one();
698 for(
int j = starting_iteration; j < NumSweeps_; j++)
701 AY.update (ONE, X, -ONE);
702 Container_->DoOverlappingJacobi (AYView, YView, WView, X.getStride());
708 if(ZeroStartingSolution_)
710 Container_->DoJacobi (XView, YView, X.getStride());
711 starting_iteration = 1;
713 const scalar_type ONE = STS::one();
714 for(
int j = starting_iteration; j < NumSweeps_; j++)
717 AY.update (ONE, X, -ONE);
718 Container_->DoJacobi (AYView, YView, X.getStride());
723 template<
class MatrixType,
class ContainerType>
725 BlockRelaxation<MatrixType,ContainerType>::
726 ApplyInverseGS (
const MV& X, MV& Y)
const 730 size_t numVecs = X.getNumVectors();
732 typename ContainerType::HostView XView = X.template getLocalView<Kokkos::HostSpace>();
733 typename ContainerType::HostView YView = Y.template getLocalView<Kokkos::HostSpace>();
736 bool deleteY2 =
false;
739 Y2 = ptr(
new MV(Importer_->getTargetMap(), numVecs));
746 for(
int j = 0; j < NumSweeps_; ++j)
749 Y2->doImport(Y, *Importer_, Tpetra::INSERT);
750 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
751 Container_->DoGaussSeidel(XView, YView, Y2View, X.getStride());
756 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
757 for(
int j = 0; j < NumSweeps_; ++j)
759 Container_->DoGaussSeidel(XView, YView, Y2View, X.getStride());
766 template<
class MatrixType,
class ContainerType>
768 BlockRelaxation<MatrixType,ContainerType>::
769 ApplyInverseSGS (
const MV& X, MV& Y)
const 774 typename ContainerType::HostView XView = X.template getLocalView<Kokkos::HostSpace>();
775 typename ContainerType::HostView YView = Y.template getLocalView<Kokkos::HostSpace>();
778 bool deleteY2 =
false;
781 Y2 = ptr(
new MV(Importer_->getTargetMap(), X.getNumVectors()));
788 for(
int j = 0; j < NumSweeps_; ++j)
791 Y2->doImport(Y, *Importer_, Tpetra::INSERT);
792 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
793 Container_->DoSGS(XView, YView, Y2View, X.getStride());
798 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
799 for(
int j = 0; j < NumSweeps_; ++j)
801 Container_->DoSGS(XView, YView, Y2View, X.getStride());
808 template<
class MatrixType,
class ContainerType>
809 void BlockRelaxation<MatrixType,ContainerType>::computeImporter ()
const 817 using Teuchos::rcp_dynamic_cast;
820 if(hasBlockCrsMatrix_)
822 const RCP<const block_crs_matrix_type> bcrs =
823 rcp_dynamic_cast<
const block_crs_matrix_type>(A_);
824 int bs_ = bcrs->getBlockSize();
825 RCP<const map_type> oldDomainMap = A_->getDomainMap();
826 RCP<const map_type> oldColMap = A_->getColMap();
829 global_size_t numGlobalElements = oldColMap->getGlobalNumElements() * bs_;
830 global_ordinal_type indexBase = oldColMap->getIndexBase();
831 RCP<const Comm<int>> comm = oldColMap->getComm();
832 ArrayView<const global_ordinal_type> oldColElements = oldColMap->getNodeElementList();
833 Array<global_ordinal_type> newColElements(bs_ * oldColElements.size());
834 for(
int i = 0; i < oldColElements.size(); i++)
836 for(
int j = 0; j < bs_; j++)
837 newColElements[i * bs_ + j] = oldColElements[i] * bs_ + j;
839 RCP<map_type> colMap(
new map_type(numGlobalElements, newColElements, indexBase, comm));
841 Importer_ =
rcp(
new import_type(oldDomainMap, colMap));
843 else if(!A_.is_null())
845 Importer_ = A_->getGraph()->getImporter();
846 if(Importer_.is_null())
847 Importer_ =
rcp(
new import_type(A_->getDomainMap(), A_->getColMap()));
853 template<
class MatrixType,
class ContainerType>
858 std::ostringstream out;
863 out <<
"\"Ifpack2::BlockRelaxation\": {";
864 if (this->getObjectLabel () !=
"") {
865 out <<
"Label: \"" << this->getObjectLabel () <<
"\", ";
867 out <<
"Initialized: " << (isInitialized () ?
"true" :
"false") <<
", ";
868 out <<
"Computed: " << (isComputed () ?
"true" :
"false") <<
", ";
870 out <<
"Matrix: null, ";
873 out <<
"Matrix: not null" 874 <<
", Global matrix dimensions: [" 875 << A_->getGlobalNumRows () <<
", " << A_->getGlobalNumCols () <<
"], ";
880 out <<
"\"relaxation: type\": ";
881 if (PrecType_ == Ifpack2::Details::JACOBI) {
882 out <<
"Block Jacobi";
883 }
else if (PrecType_ == Ifpack2::Details::GS) {
884 out <<
"Block Gauss-Seidel";
885 }
else if (PrecType_ == Ifpack2::Details::SGS) {
886 out <<
"Block Symmetric Gauss-Seidel";
891 out <<
", " <<
"sweeps: " << NumSweeps_ <<
", " 892 <<
"damping factor: " << DampingFactor_ <<
", ";
898 template<
class MatrixType,
class ContainerType>
916 const int myImageID = A_->getComm()->getRank();
927 out <<
"Ifpack2::BlockRelaxation<" 928 << TypeNameTraits<MatrixType>::name () <<
", " 929 << TypeNameTraits<ContainerType>::name () <<
" >:";
932 if (this->getObjectLabel () !=
"") {
933 out <<
"label: \"" << this->getObjectLabel () <<
"\"" << endl;
935 out <<
"initialized: " << (isInitialized () ?
"true" :
"false") << endl
936 <<
"computed: " << (isComputed () ?
"true" :
"false") << endl;
938 std::string precType;
939 if (PrecType_ == Ifpack2::Details::JACOBI) {
940 precType =
"Block Jacobi";
941 }
else if (PrecType_ == Ifpack2::Details::GS) {
942 precType =
"Block Gauss-Seidel";
943 }
else if (PrecType_ == Ifpack2::Details::SGS) {
944 precType =
"Block Symmetric Gauss-Seidel";
946 out <<
"type: " << precType << endl
947 <<
"global number of rows: " << A_->getGlobalNumRows () << endl
948 <<
"global number of columns: " << A_->getGlobalNumCols () << endl
949 <<
"number of sweeps: " << NumSweeps_ << endl
950 <<
"damping factor: " << DampingFactor_ << endl
951 <<
"backwards mode: " 952 << ((PrecType_ == Ifpack2::Details::GS && DoBackwardGS_) ?
"true" :
"false")
954 <<
"zero starting solution: " 955 << (ZeroStartingSolution_ ?
"true" :
"false") << endl;
973 #ifdef HAVE_IFPACK2_EXPLICIT_INSTANTIATION 975 #define IFPACK2_BLOCKRELAXATION_INSTANT(S,LO,GO,N) \ 977 class Ifpack2::BlockRelaxation< \ 978 Tpetra::RowMatrix<S, LO, GO, N>, \ 979 Ifpack2::Container<Tpetra::RowMatrix<S, LO, GO, N> > >; 981 #endif // HAVE_IFPACK2_EXPLICIT_INSTANTIATION 983 #endif // IFPACK2_BLOCKRELAXATION_DEF_HPP Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the input matrix is distributed.
Definition: Ifpack2_BlockRelaxation_def.hpp:262
Ifpack2::BlockRelaxation class declaration.
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:357
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:104
double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:349
int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:318
T & get(const std::string &name, T def_value)
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:901
double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:341
Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix of this preconditioner's constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:276
Teuchos::RCP< const map_type > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:285
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void getParameter(const Teuchos::ParameterList ¶ms, 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
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:365
std::string description() const
A one-line description of this object.
Definition: Ifpack2_BlockRelaxation_def.hpp:856
Teuchos::RCP< const map_type > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:299
void setParameters(const Teuchos::ParameterList ¶ms)
Sets all the parameters for the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:122
void compute()
compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation ...
Definition: Ifpack2_BlockRelaxation_def.hpp:580
Block relaxation preconditioners (or smoothers) for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse ma...
Definition: Ifpack2_BlockRelaxation_decl.hpp:83
Ifpack2 implementation details.
Declaration of a user-defined partitioner in which the user can define a partition of the graph...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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:451
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:116
bool isType(const std::string &name) const
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 initialize()
Initialize.
Definition: Ifpack2_BlockRelaxation_def.hpp:467
MatrixType::node_type node_type
Node type of the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:106
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_BlockRelaxation_decl.hpp:101
int getNumCompute() const
Returns the number of calls to compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:325
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:333
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 local linear problem.
Definition: Ifpack2_Container.hpp:114
bool isParameter(const std::string &name) const
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
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
BlockRelaxation(const Teuchos::RCP< const row_matrix_type > &Matrix)
Constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:83