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),
33 localComm_ (Teuchos::
rcp (new Teuchos::MpiComm<int> (MPI_COMM_SELF)))
35 localComm_ (Teuchos::
rcp (new Teuchos::SerialComm<int> ()))
40 template<
class MatrixType,
class InverseType>
45 template<
class MatrixType,
class InverseType>
52 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++)
75 Inverses_[i]->setParameters(List_);
76 Inverses_[i]->initialize ();
79 this->IsInitialized_ =
true;
80 this->IsComputed_ =
false;
84 template<
class MatrixType,
class InverseType>
91 this->IsComputed_ =
false;
92 if (!this->isInitialized ()) {
97 this->extractValues();
100 for(
int i = 0; i < this->numBlocks_; i++) {
101 Inverses_[i]->compute ();
104 this->IsComputed_ =
true;
108 template<
class MatrixType,
class InverseType>
111 for(
auto inv : Inverses_)
119 template<
class MatrixType,
class InverseType>
126 InverseScalar beta)
const
129 Inverses_[blockIndex]->getDomainMap()->getLocalNumElements() != X.getLocalLength(),
130 std::logic_error,
"Ifpack2::SparseContainer::apply: Inverse_ "
131 "operator and X have incompatible dimensions (" <<
132 Inverses_[blockIndex]->getDomainMap()->getLocalNumElements() <<
" resp. "
133 << X.getLocalLength() <<
"). Please report this bug to "
134 "the Ifpack2 developers.");
136 Inverses_[blockIndex]->getRangeMap()->getLocalNumElements() != Y.getLocalLength(),
137 std::logic_error,
"Ifpack2::SparseContainer::apply: Inverse_ "
138 "operator and Y have incompatible dimensions (" <<
139 Inverses_[blockIndex]->getRangeMap()->getLocalNumElements() <<
" resp. "
140 << Y.getLocalLength() <<
"). Please report this bug to "
141 "the Ifpack2 developers.");
142 Inverses_[blockIndex]->apply(X, Y, mode, alpha, beta);
145 template<
class MatrixType,
class InverseType>
172 size_t numVecs = X.extent(1);
175 ! this->IsComputed_, std::runtime_error,
"Ifpack2::SparseContainer::apply: "
176 "You must have called the compute() method before you may call apply(). "
177 "You may call the apply() method as many times as you want after calling "
178 "compute() once, but you must have called compute() at least once.");
180 X.extent(1) != Y.extent(1), std::runtime_error,
181 "Ifpack2::SparseContainer::apply: X and Y have different numbers of "
182 "vectors. X has " << X.extent(1)
183 <<
", but Y has " << Y.extent(1) <<
".");
189 const LO numRows = this->blockSizes_[blockIndex];
218 for(LO i = 0; i < this->numBlocks_; i++)
219 invX.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
220 for(LO i = 0; i < this->numBlocks_; i++)
221 invY.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
223 inverse_mv_type& X_local = invX[blockIndex];
225 X_local.getLocalLength() != size_t(numRows * this->scalarsPerRow_), std::logic_error,
226 "Ifpack2::SparseContainer::apply: "
227 "X_local has length " << X_local.getLocalLength() <<
", which does "
228 "not match numRows = " << numRows * this->scalarsPerRow_ <<
". Please report this bug to "
229 "the Ifpack2 developers.");
230 const ArrayView<const LO> blockRows = this->getBlockRows(blockIndex);
231 if(this->scalarsPerRow_ == 1)
232 mvgs.gatherMVtoView(X_local, X, blockRows);
234 mvgs.gatherMVtoViewBlock(X_local, X, blockRows, this->scalarsPerRow_);
241 inverse_mv_type& Y_local = invY[blockIndex];
243 Y_local.getLocalLength () != size_t(numRows * this->scalarsPerRow_), std::logic_error,
244 "Ifpack2::SparseContainer::apply: "
245 "Y_local has length " << Y_local.getLocalLength () <<
", which does "
246 "not match numRows = " << numRows * this->scalarsPerRow_ <<
". Please report this bug to "
247 "the Ifpack2 developers.");
249 if(this->scalarsPerRow_ == 1)
250 mvgs.gatherMVtoView(Y_local, Y, blockRows);
252 mvgs.gatherMVtoViewBlock(Y_local, Y, blockRows, this->scalarsPerRow_);
256 this->solveBlockMV(X_local, Y_local, blockIndex, mode,
257 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>
295 typedef Tpetra::Vector<InverseScalar, InverseLocalOrdinal, InverseGlobalOrdinal, InverseNode> inverse_vector_type;
298 const size_t numVecs = X.extent(1);
301 ! this->IsComputed_, std::runtime_error,
"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 "
309 "of vectors. X has " << X.extent(1) <<
", but Y has "
310 << Y.extent(1) <<
".");
314 this->scalarsPerRow_ > 1, std::logic_error,
"Ifpack2::SparseContainer::weightedApply: "
315 "Use of block rows isn't allowed in overlapping Jacobi (the only method that uses weightedApply");
345 const LO numRows = this->blockSizes_[blockIndex];
349 for(LO i = 0; i < this->numBlocks_; i++)
350 invX.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
351 for(LO i = 0; i < this->numBlocks_; i++)
352 invY.emplace_back(Inverses_[i]->getDomainMap(), numVecs);
354 inverse_mv_type& X_local = invX[blockIndex];
355 const ArrayView<const LO> blockRows = this->getBlockRows(blockIndex);
356 mvgs.gatherMVtoView(X_local, X, blockRows);
363 inverse_mv_type Y_local = invY[blockIndex];
364 TEUCHOS_TEST_FOR_EXCEPTION(
365 Y_local.getLocalLength() != size_t(numRows), std::logic_error,
366 "Ifpack2::SparseContainer::weightedApply: "
367 "Y_local has length " << X_local.getLocalLength() <<
", which does "
368 "not match numRows = " << numRows <<
". Please report this bug to "
369 "the Ifpack2 developers.");
370 mvgs.gatherMVtoView(Y_local, Y, blockRows);
382 inverse_vector_type D_local(Inverses_[blockIndex]->getDomainMap());
383 TEUCHOS_TEST_FOR_EXCEPTION(
384 D_local.getLocalLength() != size_t(this->blockSizes_[blockIndex]), std::logic_error,
385 "Ifpack2::SparseContainer::weightedApply: "
386 "D_local has length " << X_local.getLocalLength () <<
", which does "
387 "not match numRows = " << this->blockSizes_[blockIndex] <<
". Please report this bug to "
388 "the Ifpack2 developers.");
389 mvgs.gatherMVtoView(D_local, D, blockRows);
390 inverse_mv_type X_scaled(Inverses_[blockIndex]->getDomainMap(), numVecs);
391 X_scaled.elementWiseMultiply(STS::one(), D_local, X_local, STS::zero());
398 inverse_mv_type* Y_temp;
399 if (InverseScalar(beta) == STS::zero ()) {
402 Y_temp =
new inverse_mv_type(Inverses_[blockIndex]->getRangeMap(), numVecs);
405 Inverses_[blockIndex]->apply(X_scaled, *Y_temp, mode);
411 Y_local.elementWiseMultiply(alpha, D_local, *Y_temp, beta);
412 if(Y_temp != &Y_local)
416 mvgs.scatterMVtoView(Y, Y_local, blockRows);
420 template<
class MatrixType,
class InverseType>
430 template<
class MatrixType,
class InverseType>
433 std::ostringstream oss;
434 oss <<
"\"Ifpack2::SparseContainer\": {";
435 if (this->isInitialized()) {
436 if (this->isComputed()) {
437 oss <<
"status = initialized, computed";
440 oss <<
"status = initialized, not computed";
444 oss <<
"status = not initialized, not computed";
446 for(
int i = 0; i < this->numBlocks_; i++)
448 oss <<
", Block Inverse " << i <<
": {";
449 oss << Inverses_[i]->description();
457 template<
class MatrixType,
class InverseType>
462 os <<
"================================================================================" << endl;
463 os <<
"Ifpack2::SparseContainer" << endl;
464 for(
int i = 0; i < this->numBlocks_; i++)
466 os <<
"Block " << i <<
" rows: = " << this->blockSizes_[i] << endl;
468 os <<
"isInitialized() = " << this->IsInitialized_ << endl;
469 os <<
"isComputed() = " << this->IsComputed_ << endl;
470 os <<
"================================================================================" << endl;
475 template<
class MatrixType,
class InverseType>
491 if(this->scalarsPerRow_ > 1)
493 Array<LO> colToBlockOffset(this->inputBlockMatrix_->getLocalNumCols(), INVALID);
494 for(
int i = 0; i < this->numBlocks_; i++)
497 LO blockStart = this->blockOffsets_[i];
498 LO blockSize = this->blockSizes_[i];
499 LO blockPointSize = this->blockSizes_[i] * this->scalarsPerRow_;
500 LO blockEnd = blockStart + blockSize;
501 ArrayView<const LO> blockRows = this->getBlockRows(i);
505 for(LO j = 0; j < blockSize; j++)
507 LO localCol = this->translateRowToCol(blockRows[j]);
508 colToBlockOffset[localCol] = blockStart + j;
512 Array<size_t> rowEntryCounts(blockPointSize, 0);
515 using inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
516 using vals_type =
typename block_crs_matrix_type::values_host_view_type;
517 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
522 LO inputRow = this->blockRows_[blockStart + blockRow];
523 this->inputBlockMatrix_->getLocalRowView(inputRow, indices, values);
524 LO numEntries = (LO) indices.size();
525 for(LO br = 0; br < this->bcrsBlockSize_; br++)
527 for(LO k = 0; k < numEntries; k++)
529 LO colOffset = colToBlockOffset[indices[k]];
530 if(blockStart <= colOffset && colOffset < blockEnd)
532 rowEntryCounts[blockRow * this->bcrsBlockSize_ + br] += this->bcrsBlockSize_;
538 RCP<InverseMap> tempMap(
new InverseMap(blockPointSize, 0, this->localComm_));
539 diagBlocks_[i] =
rcp(
new InverseCrs(tempMap, rowEntryCounts));
540 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
542 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
547 LO inputRow = this->blockRows_[blockStart + blockRow];
548 this->inputBlockMatrix_->getLocalRowView(inputRow, indices, values);
549 LO numEntries = (LO) indices.size();
550 for(LO br = 0; br < this->bcrsBlockSize_; br++)
552 indicesToInsert.
clear();
553 valuesToInsert.
clear();
554 for(LO k = 0; k < numEntries; k++)
556 LO colOffset = colToBlockOffset[indices[k]];
557 if(blockStart <= colOffset && colOffset < blockEnd)
559 LO blockCol = colOffset - blockStart;
561 for(LO bc = 0; bc < this->bcrsBlockSize_; bc++)
563 indicesToInsert.
push_back(blockCol * this->bcrsBlockSize_ + bc);
564 valuesToInsert.
push_back(values[k * this->bcrsBlockSize_ * this->bcrsBlockSize_ + bc * this->bcrsBlockSize_ + br]);
568 InverseGlobalOrdinal rowToInsert = blockRow * this->bcrsBlockSize_ + br;
569 if(indicesToInsert.
size())
570 diagBlocks_[i]->insertGlobalValues(rowToInsert, indicesToInsert(), valuesToInsert());
573 diagBlocks_[i]->fillComplete();
580 Array<LO> colToBlockOffset(this->inputMatrix_->getLocalNumCols() * this->bcrsBlockSize_, INVALID);
581 for(
int i = 0; i < this->numBlocks_; i++)
584 LO blockStart = this->blockOffsets_[i];
585 LO blockSize = this->blockSizes_[i];
586 LO blockEnd = blockStart + blockSize;
587 ArrayView<const LO> blockRows = this->getBlockRows(i);
591 for(LO j = 0; j < blockSize; j++)
594 LO localCol = this->translateRowToCol(blockRows[j]);
595 colToBlockOffset[localCol] = blockStart + j;
598 for(LO j = 0; j < blockSize; j++)
600 rowEntryCounts[j] = this->getInputRowView(this->blockRows_[blockStart + j]).size();
602 RCP<InverseMap> tempMap(
new InverseMap(blockSize, 0, this->localComm_));
603 diagBlocks_[i] =
rcp(
new InverseCrs(tempMap, rowEntryCounts));
604 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
605 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
607 valuesToInsert.
clear();
608 indicesToInsert.
clear();
610 LO inputSplitRow = this->blockRows_[blockStart + blockRow];
611 auto rowView = this->getInputRowView(inputSplitRow);
612 for(
size_t k = 0; k < rowView.size(); k++)
614 LO colOffset = colToBlockOffset[rowView.ind(k)];
615 if(blockStart <= colOffset && colOffset < blockEnd)
617 LO blockCol = colOffset - blockStart;
619 valuesToInsert.
push_back(rowView.val(k));
622 if(indicesToInsert.
size())
623 diagBlocks_[i]->insertGlobalValues(blockRow, indicesToInsert(), valuesToInsert());
625 diagBlocks_[i]->fillComplete ();
631 template<
class MatrixType,
class InverseType>
632 void SparseContainer<MatrixType,InverseType>::
650 if(this->scalarsPerRow_ > 1)
652 Array<LO> colToBlockOffset(this->inputBlockMatrix_->getLocalNumCols(), INVALID);
653 for(
int i = 0; i < this->numBlocks_; i++)
656 LO blockStart = this->blockOffsets_[i];
657 LO blockSize = this->blockSizes_[i];
658 LO blockPointSize = this->blockSizes_[i] * this->scalarsPerRow_;
659 LO blockEnd = blockStart + blockSize;
660 ArrayView<const LO> blockRows = this->getBlockRows(i);
664 for(LO j = 0; j < blockSize; j++)
666 LO localCol = this->translateRowToCol(blockRows[j]);
667 colToBlockOffset[localCol] = blockStart + j;
671 Array<size_t> rowEntryCounts(blockPointSize, 0);
674 using inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
675 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
679 LO inputRow = this->blockRows_[blockStart + blockRow];
680 this->inputBlockMatrix_->getGraph()->getLocalRowView(inputRow, indices);
681 LO numEntries = (LO) indices.size();
682 for(LO br = 0; br < this->bcrsBlockSize_; br++)
684 for(LO k = 0; k < numEntries; k++)
686 LO colOffset = colToBlockOffset[indices[k]];
687 if(blockStart <= colOffset && colOffset < blockEnd)
689 rowEntryCounts[blockRow * this->bcrsBlockSize_ + br] += this->bcrsBlockSize_;
695 RCP<InverseMap> tempMap(
new InverseMap(blockPointSize, 0, this->localComm_));
696 auto diagGraph =
rcp(
new InverseGraph(tempMap, rowEntryCounts));
698 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
702 LO inputRow = this->blockRows_[blockStart + blockRow];
703 this->inputBlockMatrix_->getGraph()->getLocalRowView(inputRow, indices);
704 LO numEntries = (LO) indices.size();
705 for(LO br = 0; br < this->bcrsBlockSize_; br++)
707 indicesToInsert.
clear();
708 for(LO k = 0; k < numEntries; k++)
710 LO colOffset = colToBlockOffset[indices[k]];
711 if(blockStart <= colOffset && colOffset < blockEnd)
713 LO blockCol = colOffset - blockStart;
715 for(LO bc = 0; bc < this->bcrsBlockSize_; bc++)
717 indicesToInsert.
push_back(blockCol * this->bcrsBlockSize_ + bc);
721 InverseGlobalOrdinal rowToInsert = blockRow * this->bcrsBlockSize_ + br;
722 if(indicesToInsert.
size())
723 diagGraph->insertGlobalIndices(rowToInsert, indicesToInsert());
726 diagGraph->fillComplete();
729 diagBlocks_[i] =
rcp(
new InverseCrs(diagGraph));
730 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
737 Array<LO> colToBlockOffset(this->inputMatrix_->getLocalNumCols() * this->bcrsBlockSize_, INVALID);
738 for(
int i = 0; i < this->numBlocks_; i++)
741 LO blockStart = this->blockOffsets_[i];
742 LO blockSize = this->blockSizes_[i];
743 LO blockEnd = blockStart + blockSize;
744 ArrayView<const LO> blockRows = this->getBlockRows(i);
748 for(LO j = 0; j < blockSize; j++)
751 LO localCol = this->translateRowToCol(blockRows[j]);
752 colToBlockOffset[localCol] = blockStart + j;
755 for(LO j = 0; j < blockSize; j++)
757 rowEntryCounts[j] = this->getInputRowView(this->blockRows_[blockStart + j]).size();
759 RCP<InverseMap> tempMap(
new InverseMap(blockSize, 0, this->localComm_));
760 auto diagGraph =
rcp(
new InverseGraph(tempMap, rowEntryCounts));
761 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
763 indicesToInsert.
clear();
765 LO inputSplitRow = this->blockRows_[blockStart + blockRow];
766 auto rowView = this->getInputRowView(inputSplitRow);
767 for(
size_t k = 0; k < rowView.size(); k++)
769 LO colOffset = colToBlockOffset[rowView.ind(k)];
770 if(blockStart <= colOffset && colOffset < blockEnd)
772 LO blockCol = colOffset - blockStart;
776 if(indicesToInsert.
size())
777 diagGraph->insertGlobalIndices(blockRow, indicesToInsert());
779 diagGraph->fillComplete();
782 diagBlocks_[i] =
rcp(
new InverseCrs(diagGraph));
783 Inverses_[i] =
rcp(
new InverseType(diagBlocks_[i]));
789 template<
class MatrixType,
class InverseType>
790 void SparseContainer<MatrixType,InverseType>::
809 if(this->scalarsPerRow_ > 1)
811 Array<LO> colToBlockOffset(this->inputBlockMatrix_->getLocalNumCols(), INVALID);
812 for(
int i = 0; i < this->numBlocks_; i++)
815 LO blockStart = this->blockOffsets_[i];
816 LO blockSize = this->blockSizes_[i];
817 LO blockEnd = blockStart + blockSize;
818 ArrayView<const LO> blockRows = this->getBlockRows(i);
822 for(LO j = 0; j < blockSize; j++)
824 LO localCol = this->translateRowToCol(blockRows[j]);
825 colToBlockOffset[localCol] = blockStart + j;
827 using inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
828 using vals_type =
typename block_crs_matrix_type::values_host_view_type;
830 diagBlocks_[i]->resumeFill();
831 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
836 LO inputRow = this->blockRows_[blockStart + blockRow];
837 this->inputBlockMatrix_->getLocalRowView(inputRow, indices, values);
838 LO numEntries = (LO) indices.size();
839 for(LO br = 0; br < this->bcrsBlockSize_; br++)
841 indicesToInsert.
clear();
842 valuesToInsert.
clear();
843 for(LO k = 0; k < numEntries; k++)
845 LO colOffset = colToBlockOffset[indices[k]];
846 if(blockStart <= colOffset && colOffset < blockEnd)
848 LO blockCol = colOffset - blockStart;
850 for(LO bc = 0; bc < this->bcrsBlockSize_; bc++)
852 indicesToInsert.
push_back(blockCol * this->bcrsBlockSize_ + bc);
853 valuesToInsert.
push_back(values[k * this->bcrsBlockSize_ * this->bcrsBlockSize_ + bc * this->bcrsBlockSize_ + br]);
857 InverseGlobalOrdinal rowToInsert = blockRow * this->bcrsBlockSize_ + br;
858 if(indicesToInsert.
size())
859 diagBlocks_[i]->replaceGlobalValues(rowToInsert, indicesToInsert(), valuesToInsert());
862 diagBlocks_[i]->fillComplete();
869 Array<LO> colToBlockOffset(this->inputMatrix_->getLocalNumCols() * this->bcrsBlockSize_, INVALID);
870 for(
int i = 0; i < this->numBlocks_; i++)
873 LO blockStart = this->blockOffsets_[i];
874 LO blockSize = this->blockSizes_[i];
875 LO blockEnd = blockStart + blockSize;
876 ArrayView<const LO> blockRows = this->getBlockRows(i);
880 for(LO j = 0; j < blockSize; j++)
883 LO localCol = this->translateRowToCol(blockRows[j]);
884 colToBlockOffset[localCol] = blockStart + j;
886 diagBlocks_[i]->resumeFill();
887 for(LO blockRow = 0; blockRow < blockSize; blockRow++)
889 valuesToInsert.
clear();
890 indicesToInsert.
clear();
892 LO inputSplitRow = this->blockRows_[blockStart + blockRow];
893 auto rowView = this->getInputRowView(inputSplitRow);
894 for(
size_t k = 0; k < rowView.size(); k++)
896 LO colOffset = colToBlockOffset[rowView.ind(k)];
897 if(blockStart <= colOffset && colOffset < blockEnd)
899 LO blockCol = colOffset - blockStart;
901 valuesToInsert.
push_back(rowView.val(k));
904 if(indicesToInsert.
size())
905 diagBlocks_[i]->replaceGlobalValues(blockRow, indicesToInsert, valuesToInsert);
907 diagBlocks_[i]->fillComplete ();
912 template<
typename MatrixType,
typename InverseType>
916 #ifdef HAVE_IFPACK2_AMESOS2
918 if(std::is_same<InverseType, ILUTInverse>::value)
922 else if(std::is_same<InverseType, AmesosInverse>::value)
924 return "SparseAmesos";
928 throw std::logic_error(
"InverseType for SparseContainer must be Ifpack2::ILUT or Details::Amesos2Wrapper");
933 constexpr
bool inverseTypeIsILUT = std::is_same<InverseType, ILUTInverse>::value;
935 "InverseType for SparseContainer must be Ifpack2::ILUT<ROW>");
943 #include "Ifpack2_ILUT.hpp"
944 #ifdef HAVE_IFPACK2_AMESOS2
945 #include "Ifpack2_Details_Amesos2Wrapper.hpp"
952 #ifdef HAVE_IFPACK2_AMESOS2
953 # define IFPACK2_SPARSECONTAINER_INSTANT(S,LO,GO,N) \
954 template class Ifpack2::SparseContainer< Tpetra::RowMatrix<S, LO, GO, N>, \
955 Ifpack2::ILUT<Tpetra::RowMatrix<S,LO,GO,N> > >; \
956 template class Ifpack2::SparseContainer< Tpetra::RowMatrix<S, LO, GO, N>, \
957 Ifpack2::Details::Amesos2Wrapper<Tpetra::RowMatrix<S,LO,GO,N> > >;
959 # define IFPACK2_SPARSECONTAINER_INSTANT(S,LO,GO,N) \
960 template class Ifpack2::SparseContainer< Tpetra::RowMatrix<S,LO,GO,N>, \
961 Ifpack2::ILUT<Tpetra::RowMatrix<S, LO, GO, N> > >;
963 #endif // IFPACK2_SPARSECONTAINER_DEF_HPP
static std::string getName()
Get the name of this container type for Details::constructContainer()
Definition: Ifpack2_SparseContainer_def.hpp:913
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
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:310
#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:53
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:421
virtual std::string description() const
A one-line description of this object.
Definition: Ifpack2_SparseContainer_def.hpp:431
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:69
typename mv_type::dual_view_type::t_host HostView
Definition: Ifpack2_Container_decl.hpp:106
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:147
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:42
TypeTo as(const TypeFrom &t)
virtual void setParameters(const Teuchos::ParameterList &List)
Set all necessary parameters.
Definition: Ifpack2_SparseContainer_def.hpp:46
virtual void compute()
Initialize and compute all blocks.
Definition: Ifpack2_SparseContainer_def.hpp:85
Ifpack2::SparseContainer class declaration.
void clearBlocks()
Definition: Ifpack2_SparseContainer_def.hpp:109
Implementation detail of Ifpack2::Container subclasses.
Definition: Ifpack2_Details_MultiVectorLocalGatherScatter.hpp:52