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_ (
"TriDi"),
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>
126 validParams->
set(
"relaxation: container",
"TriDi");
127 validParams->
set(
"relaxation: backward mode",
false);
128 validParams->
set(
"relaxation: type",
"Jacobi");
129 validParams->
set(
"relaxation: sweeps", (
int)1);
130 validParams->
set(
"relaxation: damping factor", STS::one());
131 validParams->
set(
"relaxation: zero starting solution",
true);
132 validParams->
set(
"schwarz: compute condest",
false);
133 validParams->
set(
"schwarz: combine mode",
"ZERO");
134 validParams->
set(
"schwarz: use reordering",
true);
135 validParams->
set(
"schwarz: filter singletons",
false);
136 validParams->
set(
"schwarz: overlap level", (
int)0);
137 validParams->
set(
"partitioner: type",
"greedy");
138 validParams->
set(
"partitioner: local parts", (
int)1);
139 validParams->
set(
"partitioner: overlap", (
int)0);
141 validParams->
set(
"partitioner: parts", tmp0);
142 validParams->
set(
"partitioner: maintain sparsity",
false);
145 validParams->
set(
"Amesos2",dummyList);
147 validParams->
set(
"Amesos2 solver name",
"KLU2");
150 validParams->
set(
"partitioner: map", tmp);
152 validParams->
set(
"partitioner: line detection threshold",(
double)0.0);
153 validParams->
set(
"partitioner: PDE equations",(
int)1);
155 typename MatrixType::local_ordinal_type,
156 typename MatrixType::global_ordinal_type,
157 typename MatrixType::node_type> > dummy;
158 validParams->
set(
"partitioner: coordinates",dummy);
163 template<
class MatrixType,
class ContainerType>
179 containerType_ = List.
get<std::string> (
"relaxation: container");
181 if(containerType_ ==
"Tridiagonal") {
182 containerType_ =
"TriDi";
184 if(containerType_ ==
"Block Tridiagonal") {
185 containerType_ =
"BlockTriDi";
190 const std::string relaxType = List.
get<std::string> (
"relaxation: type");
192 if (relaxType ==
"Jacobi") {
193 PrecType_ = Ifpack2::Details::JACOBI;
195 else if (relaxType ==
"MT Split Jacobi") {
196 PrecType_ = Ifpack2::Details::MTSPLITJACOBI;
198 else if (relaxType ==
"Gauss-Seidel") {
199 PrecType_ = Ifpack2::Details::GS;
201 else if (relaxType ==
"Symmetric Gauss-Seidel") {
202 PrecType_ = Ifpack2::Details::SGS;
206 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 207 "setParameters: Invalid parameter value \"" << relaxType
208 <<
"\" for parameter \"relaxation: type\".");
213 NumSweeps_ = List.
get<
int> (
"relaxation: sweeps");
219 if (List.
isParameter (
"relaxation: damping factor")) {
220 if (List.
isType<
double> (
"relaxation: damping factor")) {
221 const double dampingFactor =
222 List.
get<
double> (
"relaxation: damping factor");
223 DampingFactor_ =
static_cast<scalar_type> (dampingFactor);
226 DampingFactor_ = List.
get<
scalar_type> (
"relaxation: damping factor");
231 DampingFactor_ =
static_cast<scalar_type> (dampingFactor);
235 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 236 "setParameters: Parameter \"relaxation: damping factor\" " 237 "has the wrong type.");
241 if (List.
isParameter (
"relaxation: zero starting solution")) {
242 ZeroStartingSolution_ = List.
get<
bool> (
"relaxation: zero starting solution");
245 if (List.
isParameter (
"relaxation: backward mode")) {
246 DoBackwardGS_ = List.
get<
bool> (
"relaxation: backward mode");
250 PartitionerType_ = List.
get<std::string> (
"partitioner: type");
255 if (List.
isParameter (
"partitioner: local parts")) {
259 else if (! std::is_same<int, local_ordinal_type>::value &&
260 List.
isType<
int> (
"partitioner: local parts")) {
261 NumLocalBlocks_ = List.
get<
int> (
"partitioner: local parts");
265 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 266 "setParameters: Parameter \"partitioner: local parts\" " 267 "has the wrong type.");
271 if (List.
isParameter (
"partitioner: overlap level")) {
272 if (List.
isType<
int> (
"partitioner: overlap level")) {
273 OverlapLevel_ = List.
get<
int> (
"partitioner: overlap level");
275 else if (! std::is_same<int, local_ordinal_type>::value &&
281 (
true, std::invalid_argument,
"Ifpack2::BlockRelaxation::" 282 "setParameters: Parameter \"partitioner: overlap level\" " 283 "has the wrong type.");
287 std::string defaultContainer =
"TriDi";
294 if (PrecType_ != Ifpack2::Details::JACOBI) {
297 if (NumLocalBlocks_ < static_cast<local_ordinal_type> (0)) {
298 NumLocalBlocks_ = A_->getNodeNumRows() / (-NumLocalBlocks_);
304 DoBackwardGS_, std::runtime_error,
305 "Ifpack2::BlockRelaxation:setParameters: Setting the \"relaxation: " 306 "backward mode\" parameter to true is not yet supported.");
313 template<
class MatrixType,
class ContainerType>
318 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::getComm: " 319 "The matrix is null. You must call setMatrix() with a nonnull matrix " 320 "before you may call this method.");
321 return A_->getComm ();
324 template<
class MatrixType,
class ContainerType>
325 Teuchos::RCP<
const Tpetra::RowMatrix<
typename MatrixType::scalar_type,
326 typename MatrixType::local_ordinal_type,
327 typename MatrixType::global_ordinal_type,
328 typename MatrixType::node_type> >
333 template<
class MatrixType,
class ContainerType>
334 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
335 typename MatrixType::global_ordinal_type,
336 typename MatrixType::node_type> >
341 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::" 342 "getDomainMap: The matrix is null. You must call setMatrix() with a " 343 "nonnull matrix before you may call this method.");
344 return A_->getDomainMap ();
347 template<
class MatrixType,
class ContainerType>
348 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
349 typename MatrixType::global_ordinal_type,
350 typename MatrixType::node_type> >
355 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::" 356 "getRangeMap: The matrix is null. You must call setMatrix() with a " 357 "nonnull matrix before you may call this method.");
358 return A_->getRangeMap ();
361 template<
class MatrixType,
class ContainerType>
368 template<
class MatrixType,
class ContainerType>
372 return NumInitialize_;
375 template<
class MatrixType,
class ContainerType>
383 template<
class MatrixType,
class ContainerType>
391 template<
class MatrixType,
class ContainerType>
396 return InitializeTime_;
399 template<
class MatrixType,
class ContainerType>
407 template<
class MatrixType,
class ContainerType>
416 template<
class MatrixType,
class ContainerType>
419 A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::getNodeSmootherComplexity: " 420 "The input matrix A is null. Please call setMatrix() with a nonnull " 421 "input matrix, then call compute(), before calling this method.");
424 size_t block_nnz = 0;
426 block_nnz += Partitioner_->numRowsInPart(i) *Partitioner_->numRowsInPart(i);
428 return block_nnz + A_->getNodeNumEntries();
431 template<
class MatrixType,
class ContainerType>
434 apply (
const Tpetra::MultiVector<
typename MatrixType::scalar_type,
435 typename MatrixType::local_ordinal_type,
436 typename MatrixType::global_ordinal_type,
437 typename MatrixType::node_type>& X,
438 Tpetra::MultiVector<
typename MatrixType::scalar_type,
439 typename MatrixType::local_ordinal_type,
440 typename MatrixType::global_ordinal_type,
441 typename MatrixType::node_type>& Y,
447 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::apply: " 448 "The matrix is null. You must call setMatrix() with a nonnull matrix, " 449 "then call initialize() and compute() (in that order), before you may " 450 "call this method.");
452 ! isComputed (), std::runtime_error,
"Ifpack2::BlockRelaxation::apply: " 453 "isComputed() must be true prior to calling apply.");
455 X.getNumVectors () != Y.getNumVectors (), std::invalid_argument,
456 "Ifpack2::BlockRelaxation::apply: X.getNumVectors() = " 457 << X.getNumVectors () <<
" != Y.getNumVectors() = " 458 << Y.getNumVectors () <<
".");
460 mode != Teuchos::NO_TRANS, std::logic_error,
"Ifpack2::BlockRelaxation::" 461 "apply: This method currently only implements the case mode == Teuchos::" 462 "NO_TRANS. Transposed modes are not currently supported.");
465 "Ifpack2::BlockRelaxation::apply: This method currently only implements " 466 "the case alpha == 1. You specified alpha = " << alpha <<
".");
469 "Ifpack2::BlockRelaxation::apply: This method currently only implements " 470 "the case beta == 0. You specified beta = " << beta <<
".");
478 auto X_lcl_host = X.template getLocalView<Kokkos::HostSpace> ();
479 auto Y_lcl_host = Y.template getLocalView<Kokkos::HostSpace> ();
480 if (X_lcl_host.data () == Y_lcl_host.data ()) {
481 X_copy =
rcp (
new MV (X, Teuchos::Copy));
483 X_copy = rcpFromRef (X);
487 if (ZeroStartingSolution_) {
488 Y.putScalar (STS::zero ());
493 case Ifpack2::Details::JACOBI:
494 ApplyInverseJacobi(*X_copy,Y);
496 case Ifpack2::Details::GS:
497 ApplyInverseGS(*X_copy,Y);
499 case Ifpack2::Details::SGS:
500 ApplyInverseSGS(*X_copy,Y);
502 case Ifpack2::Details::MTSPLITJACOBI:
503 Container_->applyInverseJacobi(*X_copy, Y, ZeroStartingSolution_, NumSweeps_);
507 (
true, std::logic_error,
"Ifpack2::BlockRelaxation::apply: Invalid " 508 "PrecType_ enum value " << PrecType_ <<
". Valid values are Ifpack2::" 509 "Details::JACOBI = " << Ifpack2::Details::JACOBI <<
", Ifpack2::Details" 510 "::GS = " << Ifpack2::Details::GS <<
", and Ifpack2::Details::SGS = " 511 << Ifpack2::Details::SGS <<
". Please report this bug to the Ifpack2 " 517 ApplyTime_ += Time_->totalElapsedTime();
520 template<
class MatrixType,
class ContainerType>
523 applyMat (
const Tpetra::MultiVector<
typename MatrixType::scalar_type,
524 typename MatrixType::local_ordinal_type,
525 typename MatrixType::global_ordinal_type,
526 typename MatrixType::node_type>& X,
527 Tpetra::MultiVector<
typename MatrixType::scalar_type,
528 typename MatrixType::local_ordinal_type,
529 typename MatrixType::global_ordinal_type,
530 typename MatrixType::node_type>& Y,
533 A_->apply (X, Y, mode);
536 template<
class MatrixType,
class ContainerType>
542 typedef Tpetra::RowGraph<local_ordinal_type, global_ordinal_type, node_type>
546 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::initialize: " 547 "The matrix is null. You must call setMatrix() with a nonnull matrix " 548 "before you may call this method.");
552 Teuchos::rcp_dynamic_cast<
const block_crs_matrix_type> (A_);
553 hasBlockCrsMatrix_ = !A_bcrs.
is_null();
554 if (A_bcrs.is_null ()) {
555 hasBlockCrsMatrix_ =
false;
558 hasBlockCrsMatrix_ =
true;
561 IsInitialized_ =
false;
564 NumLocalRows_ = A_->getNodeNumRows ();
565 NumGlobalRows_ = A_->getGlobalNumRows ();
566 NumGlobalNonzeros_ = A_->getGlobalNumEntries ();
571 Partitioner_ = Teuchos::null;
573 if (PartitionerType_ ==
"linear") {
576 }
else if (PartitionerType_ ==
"line") {
579 }
else if (PartitionerType_ ==
"user") {
586 (
true, std::logic_error,
"Ifpack2::BlockRelaxation::initialize: Unknown " 587 "partitioner type " << PartitionerType_ <<
". Valid values are " 588 "\"linear\", \"line\", and \"user\".");
592 Partitioner_->setParameters (List_);
593 Partitioner_->compute ();
596 NumLocalBlocks_ = Partitioner_->numLocalParts ();
601 if (A_->getComm()->getSize() != 1) {
610 (NumSweeps_ < 0, std::logic_error,
"Ifpack2::BlockRelaxation::initialize: " 611 "NumSweeps_ = " << NumSweeps_ <<
" < 0.");
614 ExtractSubmatricesStructure ();
618 if (PrecType_ == Ifpack2::Details::JACOBI && OverlapLevel_ > 0) {
620 (hasBlockCrsMatrix_, std::runtime_error,
621 "Ifpack2::BlockRelaxation::initialize: " 622 "We do not support overlapped Jacobi yet for Tpetra::BlockCrsMatrix. Sorry!");
625 W_ =
rcp (
new vector_type (A_->getRowMap ()));
626 W_->putScalar (STS::zero ());
630 for (
size_t j = 0 ; j < Partitioner_->numRowsInPart(i) ; ++j) {
633 int LID = (*Partitioner_)(i,j);
634 w_ptr[LID]+= STS::one();
637 W_->reciprocal (*W_);
642 InitializeTime_ += Time_->totalElapsedTime ();
643 IsInitialized_ =
true;
647 template<
class MatrixType,
class ContainerType>
655 (A_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::compute: " 656 "The matrix is null. You must call setMatrix() with a nonnull matrix, " 657 "then call initialize(), before you may call this method.");
659 if (! isInitialized ()) {
668 Container_->compute();
672 ComputeTime_ += Time_->totalElapsedTime();
676 template<
class MatrixType,
class ContainerType>
682 (Partitioner_.is_null (), std::runtime_error,
"Ifpack2::BlockRelaxation::" 683 "ExtractSubmatricesStructure: Partitioner object is null.");
685 NumLocalBlocks_ = Partitioner_->numLocalParts ();
686 std::string containerType = ContainerType::getName ();
687 if (containerType ==
"Generic") {
691 containerType = containerType_;
695 for (local_ordinal_type i = 0; i < NumLocalBlocks_; ++i) {
696 const size_t numRows = Partitioner_->numRowsInPart (i);
698 localRows[i].resize(numRows);
700 for (
size_t j = 0; j < numRows; ++j) {
701 localRows[i][j] = (*Partitioner_) (i,j);
705 Container_->setParameters(List_);
706 Container_->initialize();
709 template<
class MatrixType,
class ContainerType>
711 BlockRelaxation<MatrixType,ContainerType>::
712 ApplyInverseJacobi (
const MV& X, MV& Y)
const 714 const size_t NumVectors = X.getNumVectors ();
715 typename ContainerType::HostView XView = X.template getLocalView<Kokkos::HostSpace>();
716 typename ContainerType::HostView YView = Y.template getLocalView<Kokkos::HostSpace>();
717 MV AY (Y.getMap (), NumVectors);
719 typename ContainerType::HostView AYView = AY.template getLocalView<Kokkos::HostSpace>();
721 int starting_iteration = 0;
722 if (OverlapLevel_ > 0)
725 typename ContainerType::HostView WView = W_->template getLocalView<Kokkos::HostSpace>();
726 if(ZeroStartingSolution_) {
727 Container_->DoOverlappingJacobi(XView, YView, WView, X.getStride());
728 starting_iteration = 1;
730 const scalar_type ONE = STS::one();
731 for(
int j = starting_iteration; j < NumSweeps_; j++)
734 AY.update (ONE, X, -ONE);
735 Container_->DoOverlappingJacobi (AYView, YView, WView, X.getStride());
741 if(ZeroStartingSolution_)
743 Container_->DoJacobi (XView, YView, X.getStride());
744 starting_iteration = 1;
746 const scalar_type ONE = STS::one();
747 for(
int j = starting_iteration; j < NumSweeps_; j++)
750 AY.update (ONE, X, -ONE);
751 Container_->DoJacobi (AYView, YView, X.getStride());
756 template<
class MatrixType,
class ContainerType>
758 BlockRelaxation<MatrixType,ContainerType>::
759 ApplyInverseGS (
const MV& X, MV& Y)
const 763 size_t numVecs = X.getNumVectors();
765 typename ContainerType::HostView XView = X.template getLocalView<Kokkos::HostSpace>();
766 typename ContainerType::HostView YView = Y.template getLocalView<Kokkos::HostSpace>();
769 bool deleteY2 =
false;
772 Y2 = ptr(
new MV(Importer_->getTargetMap(), numVecs));
779 for(
int j = 0; j < NumSweeps_; ++j)
782 Y2->doImport(Y, *Importer_, Tpetra::INSERT);
783 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
784 Container_->DoGaussSeidel(XView, YView, Y2View, X.getStride());
789 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
790 for(
int j = 0; j < NumSweeps_; ++j)
792 Container_->DoGaussSeidel(XView, YView, Y2View, X.getStride());
799 template<
class MatrixType,
class ContainerType>
801 BlockRelaxation<MatrixType,ContainerType>::
802 ApplyInverseSGS (
const MV& X, MV& Y)
const 807 typename ContainerType::HostView XView = X.template getLocalView<Kokkos::HostSpace>();
808 typename ContainerType::HostView YView = Y.template getLocalView<Kokkos::HostSpace>();
811 bool deleteY2 =
false;
814 Y2 = ptr(
new MV(Importer_->getTargetMap(), X.getNumVectors()));
821 for(
int j = 0; j < NumSweeps_; ++j)
824 Y2->doImport(Y, *Importer_, Tpetra::INSERT);
825 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
826 Container_->DoSGS(XView, YView, Y2View, X.getStride());
831 typename ContainerType::HostView Y2View = Y2->template getLocalView<Kokkos::HostSpace>();
832 for(
int j = 0; j < NumSweeps_; ++j)
834 Container_->DoSGS(XView, YView, Y2View, X.getStride());
841 template<
class MatrixType,
class ContainerType>
842 void BlockRelaxation<MatrixType,ContainerType>::computeImporter ()
const 850 using Teuchos::rcp_dynamic_cast;
853 if(hasBlockCrsMatrix_)
855 const RCP<const block_crs_matrix_type> bcrs =
856 rcp_dynamic_cast<
const block_crs_matrix_type>(A_);
857 int bs_ = bcrs->getBlockSize();
858 RCP<const map_type> oldDomainMap = A_->getDomainMap();
859 RCP<const map_type> oldColMap = A_->getColMap();
862 global_size_t numGlobalElements = oldColMap->getGlobalNumElements() * bs_;
863 global_ordinal_type indexBase = oldColMap->getIndexBase();
864 RCP<const Comm<int>> comm = oldColMap->getComm();
865 ArrayView<const global_ordinal_type> oldColElements = oldColMap->getNodeElementList();
866 Array<global_ordinal_type> newColElements(bs_ * oldColElements.size());
867 for(
int i = 0; i < oldColElements.size(); i++)
869 for(
int j = 0; j < bs_; j++)
870 newColElements[i * bs_ + j] = oldColElements[i] * bs_ + j;
872 RCP<map_type> colMap(
new map_type(numGlobalElements, newColElements, indexBase, comm));
874 Importer_ =
rcp(
new import_type(oldDomainMap, colMap));
876 else if(!A_.is_null())
878 Importer_ = A_->getGraph()->getImporter();
879 if(Importer_.is_null())
880 Importer_ =
rcp(
new import_type(A_->getDomainMap(), A_->getColMap()));
886 template<
class MatrixType,
class ContainerType>
891 std::ostringstream out;
896 out <<
"\"Ifpack2::BlockRelaxation\": {";
897 if (this->getObjectLabel () !=
"") {
898 out <<
"Label: \"" << this->getObjectLabel () <<
"\", ";
900 out <<
"Initialized: " << (isInitialized () ?
"true" :
"false") <<
", ";
901 out <<
"Computed: " << (isComputed () ?
"true" :
"false") <<
", ";
903 out <<
"Matrix: null, ";
906 out <<
"Matrix: not null" 907 <<
", Global matrix dimensions: [" 908 << A_->getGlobalNumRows () <<
", " << A_->getGlobalNumCols () <<
"], ";
913 out <<
"\"relaxation: type\": ";
914 if (PrecType_ == Ifpack2::Details::JACOBI) {
915 out <<
"Block Jacobi";
916 }
else if (PrecType_ == Ifpack2::Details::GS) {
917 out <<
"Block Gauss-Seidel";
918 }
else if (PrecType_ == Ifpack2::Details::SGS) {
919 out <<
"Block Symmetric Gauss-Seidel";
924 out <<
", overlap: " << OverlapLevel_;
926 out <<
", " <<
"sweeps: " << NumSweeps_ <<
", " 927 <<
"damping factor: " << DampingFactor_ <<
", ";
929 std::string containerType = ContainerType::getName();
930 out <<
"block container: " << ((containerType ==
"Generic") ? containerType_ : containerType);
936 template<
class MatrixType,
class ContainerType>
954 const int myImageID = A_->getComm()->getRank();
965 out <<
"Ifpack2::BlockRelaxation<" 966 << TypeNameTraits<MatrixType>::name () <<
", " 967 << TypeNameTraits<ContainerType>::name () <<
" >:";
970 if (this->getObjectLabel () !=
"") {
971 out <<
"label: \"" << this->getObjectLabel () <<
"\"" << endl;
973 out <<
"initialized: " << (isInitialized () ?
"true" :
"false") << endl
974 <<
"computed: " << (isComputed () ?
"true" :
"false") << endl;
976 std::string precType;
977 if (PrecType_ == Ifpack2::Details::JACOBI) {
978 precType =
"Block Jacobi";
979 }
else if (PrecType_ == Ifpack2::Details::GS) {
980 precType =
"Block Gauss-Seidel";
981 }
else if (PrecType_ == Ifpack2::Details::SGS) {
982 precType =
"Block Symmetric Gauss-Seidel";
984 out <<
"type: " << precType << endl
985 <<
"global number of rows: " << A_->getGlobalNumRows () << endl
986 <<
"global number of columns: " << A_->getGlobalNumCols () << endl
987 <<
"number of sweeps: " << NumSweeps_ << endl
988 <<
"damping factor: " << DampingFactor_ << endl
989 <<
"backwards mode: " 990 << ((PrecType_ == Ifpack2::Details::GS && DoBackwardGS_) ?
"true" :
"false")
992 <<
"zero starting solution: " 993 << (ZeroStartingSolution_ ?
"true" :
"false") << endl;
1011 #ifdef HAVE_IFPACK2_EXPLICIT_INSTANTIATION 1013 #define IFPACK2_BLOCKRELAXATION_INSTANT(S,LO,GO,N) \ 1015 class Ifpack2::BlockRelaxation< \ 1016 Tpetra::RowMatrix<S, LO, GO, N>, \ 1017 Ifpack2::Container<Tpetra::RowMatrix<S, LO, GO, N> > >; 1019 #endif // HAVE_IFPACK2_EXPLICIT_INSTANTIATION 1021 #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:315
Ifpack2::BlockRelaxation class declaration.
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:410
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
Definition: Ifpack2_BlockRelaxation_def.hpp:417
ParameterList & disableRecursiveValidation()
double getComputeTime() const
Returns the time spent in compute().
Definition: Ifpack2_BlockRelaxation_def.hpp:402
int getNumInitialize() const
Returns the number of calls to initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:371
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:939
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
double getInitializeTime() const
Returns the time spent in initialize().
Definition: Ifpack2_BlockRelaxation_def.hpp:394
static Teuchos::RCP< BaseContainer > build(std::string containerType, const Teuchos::RCP< const MatrixType > &A, const Teuchos::Array< Teuchos::Array< local_ordinal_type >> &localRows, const Teuchos::RCP< const import_type > importer, int OverlapLevel, scalar_type DampingFactor)
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's constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:329
Teuchos::RCP< const map_type > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:338
#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:434
std::string description() const
A one-line description of this object.
Definition: Ifpack2_BlockRelaxation_def.hpp:889
Teuchos::RCP< const map_type > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Definition: Ifpack2_BlockRelaxation_def.hpp:352
void setParameters(const Teuchos::ParameterList ¶ms)
Sets all the parameters for the preconditioner.
Definition: Ifpack2_BlockRelaxation_def.hpp:166
void compute()
compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation ...
Definition: Ifpack2_BlockRelaxation_def.hpp:650
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...
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
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:523
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:539
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:378
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_BlockRelaxation_def.hpp:386
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
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
void getValidParameters(Teuchos::ParameterList ¶ms)
Fills a list which contains all the parameters possibly used by Ifpack2.
Definition: Ifpack2_Parameters.cpp:50
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:122
BlockRelaxation(const Teuchos::RCP< const row_matrix_type > &Matrix)
Constructor.
Definition: Ifpack2_BlockRelaxation_def.hpp:83