10 #ifndef IFPACK2_SPARSECONTAINER_DEF_HPP
11 #define IFPACK2_SPARSECONTAINER_DEF_HPP
18 #include "Teuchos_DefaultSerialComm.hpp"
25 template <
class MatrixType,
class InverseType>
31 :
ContainerImpl<MatrixType, InverseScalar>(matrix, partitions, pointIndexed)
34 localComm_(Teuchos::
rcp(new Teuchos::MpiComm<int>(MPI_COMM_SELF)))
36 localComm_(Teuchos::
rcp(new Teuchos::SerialComm<int>()))
42 template <
class MatrixType,
class InverseType>
47 template <
class MatrixType,
class InverseType>
53 template <
class MatrixType,
class InverseType>
66 diagBlocks_.assign(this->numBlocks_, Teuchos::null);
67 Inverses_.assign(this->numBlocks_, Teuchos::null);
73 for (
int i = 0; i < this->numBlocks_; i++) {
74 Inverses_[i]->setParameters(List_);
75 Inverses_[i]->initialize();
78 this->IsInitialized_ =
true;
79 this->IsComputed_ =
false;
83 template <
class MatrixType,
class InverseType>
89 this->IsComputed_ =
false;
90 if (!this->isInitialized()) {
95 this->extractValues();
98 for (
int i = 0; i < this->numBlocks_; i++) {
99 Inverses_[i]->compute();
102 this->IsComputed_ =
true;
106 template <
class MatrixType,
class InverseType>
108 for (
auto inv : Inverses_)
116 template <
class MatrixType,
class InverseType>
123 InverseScalar beta)
const {
125 Inverses_[blockIndex]->getDomainMap()->getLocalNumElements() != X.getLocalLength(),
127 "Ifpack2::SparseContainer::apply: Inverse_ "
128 "operator and X have incompatible dimensions ("
129 << Inverses_[blockIndex]->getDomainMap()->getLocalNumElements() <<
" resp. "
130 << X.getLocalLength() <<
"). Please report this bug to "
131 "the Ifpack2 developers.");
133 Inverses_[blockIndex]->getRangeMap()->getLocalNumElements() != Y.getLocalLength(),
135 "Ifpack2::SparseContainer::apply: Inverse_ "
136 "operator and Y have incompatible dimensions ("
137 << Inverses_[blockIndex]->getRangeMap()->getLocalNumElements() <<
" resp. "
138 << Y.getLocalLength() <<
"). Please report this bug to "
139 "the Ifpack2 developers.");
140 Inverses_[blockIndex]->apply(X, Y, mode, alpha, beta);
143 template <
class MatrixType,
class InverseType>
168 size_t numVecs = X.extent(1);
171 !this->IsComputed_, std::runtime_error,
172 "Ifpack2::SparseContainer::apply: "
173 "You must have called the compute() method before you may call apply(). "
174 "You may call the apply() method as many times as you want after calling "
175 "compute() once, but you must have called compute() at least once.");
177 X.extent(1) != Y.extent(1), std::runtime_error,
178 "Ifpack2::SparseContainer::apply: X and Y have different numbers of "
181 <<
", but Y has " << Y.extent(1) <<
".");
187 const LO numRows = this->blockSizes_[blockIndex];
214 if (invX.size() == 0) {
215 for (LO i = 0; i < this->numBlocks_; i++)
216 invX.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
217 for (LO i = 0; i < this->numBlocks_; i++)
218 invY.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
220 inverse_mv_type& X_local = invX[blockIndex];
222 X_local.getLocalLength() != size_t(numRows * this->scalarsPerRow_), std::logic_error,
223 "Ifpack2::SparseContainer::apply: "
224 "X_local has length "
225 << X_local.getLocalLength() <<
", which does "
226 "not match numRows = "
227 << numRows * this->scalarsPerRow_ <<
". Please report this bug to "
228 "the Ifpack2 developers.");
229 const ArrayView<const LO> blockRows = this->getBlockRows(blockIndex);
230 if (this->scalarsPerRow_ == 1)
231 mvgs.gatherMVtoView(X_local, X, blockRows);
233 mvgs.gatherMVtoViewBlock(X_local, X, blockRows, this->scalarsPerRow_);
240 inverse_mv_type& Y_local = invY[blockIndex];
242 Y_local.getLocalLength() != size_t(numRows * this->scalarsPerRow_), std::logic_error,
243 "Ifpack2::SparseContainer::apply: "
244 "Y_local has length "
245 << Y_local.getLocalLength() <<
", which does "
246 "not match numRows = "
247 << numRows * this->scalarsPerRow_ <<
". Please report this bug to "
248 "the Ifpack2 developers.");
250 if (this->scalarsPerRow_ == 1)
251 mvgs.gatherMVtoView(Y_local, Y, blockRows);
253 mvgs.gatherMVtoViewBlock(Y_local, Y, blockRows, this->scalarsPerRow_);
257 this->solveBlockMV(X_local, Y_local, blockIndex, mode,
258 InverseScalar(alpha), InverseScalar(beta));
262 if (this->scalarsPerRow_ == 1)
263 mvgs.scatterMVtoView(Y, Y_local, blockRows);
265 mvgs.scatterMVtoViewBlock(Y, Y_local, blockRows, this->scalarsPerRow_);
269 template <
class MatrixType,
class InverseType>
294 typedef Tpetra::Vector<InverseScalar, InverseLocalOrdinal, InverseGlobalOrdinal, InverseNode> inverse_vector_type;
297 const size_t numVecs = X.extent(1);
300 !this->IsComputed_, std::runtime_error,
301 "Ifpack2::SparseContainer::"
302 "weightedApply: You must have called the compute() method before you may "
303 "call apply(). You may call the apply() method as many times as you want "
304 "after calling compute() once, but you must have called compute() at least "
307 X.extent(1) != Y.extent(1), std::runtime_error,
308 "Ifpack2::SparseContainer::weightedApply: X and Y have different numbers "
310 << X.extent(1) <<
", but Y has "
311 << Y.extent(1) <<
".");
315 this->scalarsPerRow_ > 1, std::logic_error,
316 "Ifpack2::SparseContainer::weightedApply: "
317 "Use of block rows isn't allowed in overlapping Jacobi (the only method that uses weightedApply");
347 const LO numRows = this->blockSizes_[blockIndex];
349 if (invX.size() == 0) {
350 for (LO i = 0; i < this->numBlocks_; i++)
351 invX.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
352 for (LO i = 0; i < this->numBlocks_; i++)
353 invY.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
355 inverse_mv_type& X_local = invX[blockIndex];
356 const ArrayView<const LO> blockRows = this->getBlockRows(blockIndex);
357 mvgs.gatherMVtoView(X_local, X, blockRows);
364 inverse_mv_type Y_local = invY[blockIndex];
365 TEUCHOS_TEST_FOR_EXCEPTION(
366 Y_local.getLocalLength() != size_t(numRows), std::logic_error,
367 "Ifpack2::SparseContainer::weightedApply: "
368 "Y_local has length "
369 << X_local.getLocalLength() <<
", which does "
370 "not match numRows = "
371 << numRows <<
". Please report this bug to "
372 "the Ifpack2 developers.");
373 mvgs.gatherMVtoView(Y_local, Y, blockRows);
385 inverse_vector_type D_local(Inverses_[blockIndex]->getDomainMap());
386 TEUCHOS_TEST_FOR_EXCEPTION(
387 D_local.getLocalLength() != size_t(this->blockSizes_[blockIndex]), std::logic_error,
388 "Ifpack2::SparseContainer::weightedApply: "
389 "D_local has length "
390 << X_local.getLocalLength() <<
", which does "
391 "not match numRows = "
392 << this->blockSizes_[blockIndex] <<
". Please report this bug to "
393 "the Ifpack2 developers.");
394 mvgs.gatherMVtoView(D_local, D, blockRows);
395 inverse_mv_type X_scaled(Inverses_[blockIndex]->getDomainMap(), numVecs);
396 X_scaled.elementWiseMultiply(STS::one(), D_local, X_local, STS::zero());
403 inverse_mv_type* Y_temp;
404 if (InverseScalar(beta) == STS::zero()) {
407 Y_temp =
new inverse_mv_type(Inverses_[blockIndex]->getRangeMap(), numVecs);
410 Inverses_[blockIndex]->apply(X_scaled, *Y_temp, mode);
416 Y_local.elementWiseMultiply(alpha, D_local, *Y_temp, beta);
417 if (Y_temp != &Y_local)
421 mvgs.scatterMVtoView(Y, Y_local, blockRows);
425 template <
class MatrixType,
class InverseType>
434 template <
class MatrixType,
class InverseType>
436 std::ostringstream oss;
437 oss <<
"\"Ifpack2::SparseContainer\": {";
438 if (this->isInitialized()) {
439 if (this->isComputed()) {
440 oss <<
"status = initialized, computed";
442 oss <<
"status = initialized, not computed";
445 oss <<
"status = not initialized, not computed";
447 for (
int i = 0; i < this->numBlocks_; i++) {
448 oss <<
", Block Inverse " << i <<
": {";
449 oss << Inverses_[i]->description();
457 template <
class MatrixType,
class InverseType>
461 os <<
"================================================================================" << endl;
462 os <<
"Ifpack2::SparseContainer" << endl;
463 for (
int i = 0; i < this->numBlocks_; i++) {
464 os <<
"Block " << i <<
" rows: = " << this->blockSizes_[i] << endl;
466 os <<
"isInitialized() = " << this->IsInitialized_ << endl;
467 os <<
"isComputed() = " << this->IsComputed_ << endl;
468 os <<
"================================================================================" << endl;
473 template <
class MatrixType,
class InverseType>
488 if (this->scalarsPerRow_ > 1) {
489 Array<LO> colToBlockOffset(this->inputBlockMatrix_->getLocalNumCols(), INVALID);
490 for (
int i = 0; i < this->numBlocks_; i++) {
492 LO blockStart = this->blockOffsets_[i];
493 LO blockSize = this->blockSizes_[i];
494 LO blockPointSize = this->blockSizes_[i] * this->scalarsPerRow_;
495 LO blockEnd = blockStart + blockSize;
496 ArrayView<const LO> blockRows = this->getBlockRows(i);
500 for (LO j = 0; j < blockSize; j++) {
501 LO localCol = this->translateRowToCol(blockRows[j]);
502 colToBlockOffset[localCol] = blockStart + j;
506 Array<size_t> rowEntryCounts(blockPointSize, 0);
509 using inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
510 using vals_type =
typename block_crs_matrix_type::values_host_view_type;
511 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
515 LO inputRow = this->blockRows_[blockStart + blockRow];
516 this->inputBlockMatrix_->getLocalRowView(inputRow, indices, values);
517 LO numEntries = (LO)indices.size();
518 for (LO br = 0; br < this->bcrsBlockSize_; br++) {
519 for (LO k = 0; k < numEntries; k++) {
520 LO colOffset = colToBlockOffset[indices[k]];
521 if (blockStart <= colOffset && colOffset < blockEnd) {
522 rowEntryCounts[blockRow * this->bcrsBlockSize_ + br] += this->bcrsBlockSize_;
528 RCP<InverseMap> tempMap(
new InverseMap(blockPointSize, 0, this->localComm_));
529 diagBlocks_[i] =
rcp(
new InverseCrs(tempMap, rowEntryCounts));
530 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
532 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
536 LO inputRow = this->blockRows_[blockStart + blockRow];
537 this->inputBlockMatrix_->getLocalRowView(inputRow, indices, values);
538 LO numEntries = (LO)indices.size();
539 for (LO br = 0; br < this->bcrsBlockSize_; br++) {
540 indicesToInsert.
clear();
541 valuesToInsert.
clear();
542 for (LO k = 0; k < numEntries; k++) {
543 LO colOffset = colToBlockOffset[indices[k]];
544 if (blockStart <= colOffset && colOffset < blockEnd) {
545 LO blockCol = colOffset - blockStart;
547 for (LO bc = 0; bc < this->bcrsBlockSize_; bc++) {
548 indicesToInsert.
push_back(blockCol * this->bcrsBlockSize_ + bc);
549 valuesToInsert.
push_back(values[k * this->bcrsBlockSize_ * this->bcrsBlockSize_ + bc * this->bcrsBlockSize_ + br]);
553 InverseGlobalOrdinal rowToInsert = blockRow * this->bcrsBlockSize_ + br;
554 if (indicesToInsert.
size())
555 diagBlocks_[i]->insertGlobalValues(rowToInsert, indicesToInsert(), valuesToInsert());
558 diagBlocks_[i]->fillComplete();
563 Array<LO> colToBlockOffset(this->inputMatrix_->getLocalNumCols() * this->bcrsBlockSize_, INVALID);
564 for (
int i = 0; i < this->numBlocks_; i++) {
566 LO blockStart = this->blockOffsets_[i];
567 LO blockSize = this->blockSizes_[i];
568 LO blockEnd = blockStart + blockSize;
569 ArrayView<const LO> blockRows = this->getBlockRows(i);
573 for (LO j = 0; j < blockSize; j++) {
575 LO localCol = this->translateRowToCol(blockRows[j]);
576 colToBlockOffset[localCol] = blockStart + j;
579 for (LO j = 0; j < blockSize; j++) {
580 rowEntryCounts[j] = this->getInputRowView(this->blockRows_[blockStart + j]).size();
582 RCP<InverseMap> tempMap(
new InverseMap(blockSize, 0, this->localComm_));
583 diagBlocks_[i] =
rcp(
new InverseCrs(tempMap, rowEntryCounts));
584 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
585 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
586 valuesToInsert.
clear();
587 indicesToInsert.
clear();
589 LO inputSplitRow = this->blockRows_[blockStart + blockRow];
590 auto rowView = this->getInputRowView(inputSplitRow);
591 for (
size_t k = 0; k < rowView.size(); k++) {
592 LO colOffset = colToBlockOffset[rowView.ind(k)];
593 if (blockStart <= colOffset && colOffset < blockEnd) {
594 LO blockCol = colOffset - blockStart;
596 valuesToInsert.
push_back(rowView.val(k));
599 if (indicesToInsert.
size())
600 diagBlocks_[i]->insertGlobalValues(blockRow, indicesToInsert(), valuesToInsert());
602 diagBlocks_[i]->fillComplete();
608 template <
class MatrixType,
class InverseType>
609 void SparseContainer<MatrixType, InverseType>::
626 if (this->scalarsPerRow_ > 1) {
627 Array<LO> colToBlockOffset(this->inputBlockMatrix_->getLocalNumCols(), INVALID);
628 for (
int i = 0; i < this->numBlocks_; i++) {
630 LO blockStart = this->blockOffsets_[i];
631 LO blockSize = this->blockSizes_[i];
632 LO blockPointSize = this->blockSizes_[i] * this->scalarsPerRow_;
633 LO blockEnd = blockStart + blockSize;
634 ArrayView<const LO> blockRows = this->getBlockRows(i);
638 for (LO j = 0; j < blockSize; j++) {
639 LO localCol = this->translateRowToCol(blockRows[j]);
640 colToBlockOffset[localCol] = blockStart + j;
644 Array<size_t> rowEntryCounts(blockPointSize, 0);
647 using inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
648 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
651 LO inputRow = this->blockRows_[blockStart + blockRow];
652 this->inputBlockMatrix_->getGraph()->getLocalRowView(inputRow, indices);
653 LO numEntries = (LO)indices.size();
654 for (LO br = 0; br < this->bcrsBlockSize_; br++) {
655 for (LO k = 0; k < numEntries; k++) {
656 LO colOffset = colToBlockOffset[indices[k]];
657 if (blockStart <= colOffset && colOffset < blockEnd) {
658 rowEntryCounts[blockRow * this->bcrsBlockSize_ + br] += this->bcrsBlockSize_;
664 RCP<InverseMap> tempMap(
new InverseMap(blockPointSize, 0, this->localComm_));
665 auto diagGraph =
rcp(
new InverseGraph(tempMap, rowEntryCounts));
667 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
670 LO inputRow = this->blockRows_[blockStart + blockRow];
671 this->inputBlockMatrix_->getGraph()->getLocalRowView(inputRow, indices);
672 LO numEntries = (LO)indices.size();
673 for (LO br = 0; br < this->bcrsBlockSize_; br++) {
674 indicesToInsert.
clear();
675 for (LO k = 0; k < numEntries; k++) {
676 LO colOffset = colToBlockOffset[indices[k]];
677 if (blockStart <= colOffset && colOffset < blockEnd) {
678 LO blockCol = colOffset - blockStart;
680 for (LO bc = 0; bc < this->bcrsBlockSize_; bc++) {
681 indicesToInsert.
push_back(blockCol * this->bcrsBlockSize_ + bc);
685 InverseGlobalOrdinal rowToInsert = blockRow * this->bcrsBlockSize_ + br;
686 if (indicesToInsert.
size())
687 diagGraph->insertGlobalIndices(rowToInsert, indicesToInsert());
690 diagGraph->fillComplete();
693 diagBlocks_[i] =
rcp(
new InverseCrs(diagGraph));
694 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
699 Array<LO> colToBlockOffset(this->inputMatrix_->getLocalNumCols() * this->bcrsBlockSize_, INVALID);
700 for (
int i = 0; i < this->numBlocks_; i++) {
702 LO blockStart = this->blockOffsets_[i];
703 LO blockSize = this->blockSizes_[i];
704 LO blockEnd = blockStart + blockSize;
705 ArrayView<const LO> blockRows = this->getBlockRows(i);
709 for (LO j = 0; j < blockSize; j++) {
711 LO localCol = this->translateRowToCol(blockRows[j]);
712 colToBlockOffset[localCol] = blockStart + j;
715 for (LO j = 0; j < blockSize; j++) {
716 rowEntryCounts[j] = this->getInputRowView(this->blockRows_[blockStart + j]).size();
718 RCP<InverseMap> tempMap(
new InverseMap(blockSize, 0, this->localComm_));
719 auto diagGraph =
rcp(
new InverseGraph(tempMap, rowEntryCounts));
720 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
721 indicesToInsert.
clear();
723 LO inputSplitRow = this->blockRows_[blockStart + blockRow];
724 auto rowView = this->getInputRowView(inputSplitRow);
725 for (
size_t k = 0; k < rowView.size(); k++) {
726 LO colOffset = colToBlockOffset[rowView.ind(k)];
727 if (blockStart <= colOffset && colOffset < blockEnd) {
728 LO blockCol = colOffset - blockStart;
732 if (indicesToInsert.
size())
733 diagGraph->insertGlobalIndices(blockRow, indicesToInsert());
735 diagGraph->fillComplete();
738 diagBlocks_[i] =
rcp(
new InverseCrs(diagGraph));
739 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
745 template <
class MatrixType,
class InverseType>
746 void SparseContainer<MatrixType, InverseType>::
764 if (this->scalarsPerRow_ > 1) {
765 Array<LO> colToBlockOffset(this->inputBlockMatrix_->getLocalNumCols(), INVALID);
766 for (
int i = 0; i < this->numBlocks_; i++) {
768 LO blockStart = this->blockOffsets_[i];
769 LO blockSize = this->blockSizes_[i];
770 LO blockEnd = blockStart + blockSize;
771 ArrayView<const LO> blockRows = this->getBlockRows(i);
775 for (LO j = 0; j < blockSize; j++) {
776 LO localCol = this->translateRowToCol(blockRows[j]);
777 colToBlockOffset[localCol] = blockStart + j;
779 using inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
780 using vals_type =
typename block_crs_matrix_type::values_host_view_type;
782 diagBlocks_[i]->resumeFill();
783 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
787 LO inputRow = this->blockRows_[blockStart + blockRow];
788 this->inputBlockMatrix_->getLocalRowView(inputRow, indices, values);
789 LO numEntries = (LO)indices.size();
790 for (LO br = 0; br < this->bcrsBlockSize_; br++) {
791 indicesToInsert.
clear();
792 valuesToInsert.
clear();
793 for (LO k = 0; k < numEntries; k++) {
794 LO colOffset = colToBlockOffset[indices[k]];
795 if (blockStart <= colOffset && colOffset < blockEnd) {
796 LO blockCol = colOffset - blockStart;
798 for (LO bc = 0; bc < this->bcrsBlockSize_; bc++) {
799 indicesToInsert.
push_back(blockCol * this->bcrsBlockSize_ + bc);
800 valuesToInsert.
push_back(values[k * this->bcrsBlockSize_ * this->bcrsBlockSize_ + bc * this->bcrsBlockSize_ + br]);
804 InverseGlobalOrdinal rowToInsert = blockRow * this->bcrsBlockSize_ + br;
805 if (indicesToInsert.
size())
806 diagBlocks_[i]->replaceGlobalValues(rowToInsert, indicesToInsert(), valuesToInsert());
809 diagBlocks_[i]->fillComplete();
814 Array<LO> colToBlockOffset(this->inputMatrix_->getLocalNumCols() * this->bcrsBlockSize_, INVALID);
815 for (
int i = 0; i < this->numBlocks_; i++) {
817 LO blockStart = this->blockOffsets_[i];
818 LO blockSize = this->blockSizes_[i];
819 LO blockEnd = blockStart + blockSize;
820 ArrayView<const LO> blockRows = this->getBlockRows(i);
824 for (LO j = 0; j < blockSize; j++) {
826 LO localCol = this->translateRowToCol(blockRows[j]);
827 colToBlockOffset[localCol] = blockStart + j;
829 diagBlocks_[i]->resumeFill();
830 for (LO blockRow = 0; blockRow < blockSize; blockRow++) {
831 valuesToInsert.
clear();
832 indicesToInsert.
clear();
834 LO inputSplitRow = this->blockRows_[blockStart + blockRow];
835 auto rowView = this->getInputRowView(inputSplitRow);
836 for (
size_t k = 0; k < rowView.size(); k++) {
837 LO colOffset = colToBlockOffset[rowView.ind(k)];
838 if (blockStart <= colOffset && colOffset < blockEnd) {
839 LO blockCol = colOffset - blockStart;
841 valuesToInsert.
push_back(rowView.val(k));
844 if (indicesToInsert.
size())
845 diagBlocks_[i]->replaceGlobalValues(blockRow, indicesToInsert, valuesToInsert);
847 diagBlocks_[i]->fillComplete();
852 template <
typename MatrixType,
typename InverseType>
855 #ifdef HAVE_IFPACK2_AMESOS2
857 if (std::is_same<InverseType, ILUTInverse>::value) {
859 }
else if (std::is_same<InverseType, AmesosInverse>::value) {
860 return "SparseAmesos";
862 throw std::logic_error(
"InverseType for SparseContainer must be Ifpack2::ILUT or Details::Amesos2Wrapper");
867 constexpr
bool inverseTypeIsILUT = std::is_same<InverseType, ILUTInverse>::value;
869 "InverseType for SparseContainer must be Ifpack2::ILUT<ROW>");
877 #include "Ifpack2_ILUT.hpp"
878 #ifdef HAVE_IFPACK2_AMESOS2
879 #include "Ifpack2_Details_Amesos2Wrapper.hpp"
886 #ifdef HAVE_IFPACK2_AMESOS2
887 #define IFPACK2_SPARSECONTAINER_INSTANT(S, LO, GO, N) \
888 template class Ifpack2::SparseContainer<Tpetra::RowMatrix<S, LO, GO, N>, \
889 Ifpack2::ILUT<Tpetra::RowMatrix<S, LO, GO, N>>>; \
890 template class Ifpack2::SparseContainer<Tpetra::RowMatrix<S, LO, GO, N>, \
891 Ifpack2::Details::Amesos2Wrapper<Tpetra::RowMatrix<S, LO, GO, N>>>;
893 #define IFPACK2_SPARSECONTAINER_INSTANT(S, LO, GO, N) \
894 template class Ifpack2::SparseContainer<Tpetra::RowMatrix<S, LO, GO, N>, \
895 Ifpack2::ILUT<Tpetra::RowMatrix<S, LO, GO, N>>>;
897 #endif // IFPACK2_SPARSECONTAINER_DEF_HPP
static std::string getName()
Get the name of this container type for Details::constructContainer()
Definition: Ifpack2_SparseContainer_def.hpp:853
Store and solve a local sparse linear problem.
Definition: Ifpack2_SparseContainer_decl.hpp:101
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to the given FancyOStream.
Definition: Ifpack2_SparseContainer_def.hpp:458
The implementation of the numerical features of Container (Jacobi, Gauss-Seidel, SGS). This class allows a custom scalar type (LocalScalarType) to be used for storing blocks and solving the block systems. Hiding this template parameter from the Container interface simplifies the BlockRelaxation and ContainerFactory classes.
Definition: Ifpack2_Container_decl.hpp:307
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void initialize()
Do all set-up operations that only require matrix structure.
Definition: Ifpack2_SparseContainer_def.hpp:54
SparseContainer(const Teuchos::RCP< const row_matrix_type > &matrix, const Teuchos::Array< Teuchos::Array< LO >> &partitions, const Teuchos::RCP< const import_type > &importer, bool pointIndexed)
Constructor.
Definition: Ifpack2_SparseContainer_def.hpp:27
ILUT (incomplete LU factorization with threshold) of a Tpetra sparse matrix.
Definition: Ifpack2_ILUT_decl.hpp:60
virtual std::ostream & print(std::ostream &os) const
Print information about this object to the given output stream.
Definition: Ifpack2_SparseContainer_def.hpp:426
virtual std::string description() const
A one-line description of this object.
Definition: Ifpack2_SparseContainer_def.hpp:435
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper class for direct solvers in Amesos2.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:68
typename mv_type::dual_view_type::t_host HostView
Definition: Ifpack2_Container_decl.hpp:105
virtual void apply(ConstHostView X, HostView Y, int blockIndex, Teuchos::ETransp mode=Teuchos::NO_TRANS, SC alpha=Teuchos::ScalarTraits< SC >::one(), SC beta=Teuchos::ScalarTraits< SC >::zero()) const
Compute Y := alpha * M^{-1} X + beta*Y.
Definition: Ifpack2_SparseContainer_def.hpp:145
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
virtual void weightedApply(ConstHostView X, HostView Y, ConstHostView W, int blockIndex, Teuchos::ETransp mode=Teuchos::NO_TRANS, SC alpha=Teuchos::ScalarTraits< SC >::one(), SC beta=Teuchos::ScalarTraits< SC >::zero()) const
Compute Y := alpha * diag(D) * M^{-1} (diag(D) * X) + beta*Y.
Definition: Ifpack2_SparseContainer_def.hpp:271
void push_back(const value_type &x)
virtual ~SparseContainer()
Destructor (declared virtual for memory safety of derived classes).
Definition: Ifpack2_SparseContainer_def.hpp:44
TypeTo as(const TypeFrom &t)
virtual void setParameters(const Teuchos::ParameterList &List)
Set all necessary parameters.
Definition: Ifpack2_SparseContainer_def.hpp:48
virtual void compute()
Initialize and compute all blocks.
Definition: Ifpack2_SparseContainer_def.hpp:84
Ifpack2::SparseContainer class declaration.
void clearBlocks()
Definition: Ifpack2_SparseContainer_def.hpp:107
Implementation detail of Ifpack2::Container subclasses.
Definition: Ifpack2_Details_MultiVectorLocalGatherScatter.hpp:52