15#ifndef dealii_trilinos_sparse_matrix_h
16# define dealii_trilinos_sparse_matrix_h
21# ifdef DEAL_II_WITH_TRILINOS
36# include <Epetra_Comm.h>
37# include <Epetra_CrsGraph.h>
38# include <Epetra_Export.h>
39# include <Epetra_FECrsMatrix.h>
40# include <Epetra_Map.h>
41# include <Epetra_MpiComm.h>
42# include <Epetra_MultiVector.h>
43# include <Epetra_Operator.h>
48# include <type_traits>
55template <
typename MatrixType>
58template <
typename number>
70 template <
bool Constness>
95 <<
"You tried to access row " << arg1
96 <<
" of a distributed sparsity pattern, "
97 <<
" but only rows " << arg2 <<
" through " << arg3
98 <<
" are stored locally and can be accessed.");
196 template <
bool Constess>
237 template <
bool Other>
334 friend class Reference;
350 template <
bool Constness>
386 template <
bool Other>
417 template <
bool OtherConstness>
424 template <
bool OtherConstness>
433 template <
bool OtherConstness>
440 template <
bool OtherConstness>
450 <<
"Attempt to access element " << arg2 <<
" of row "
451 << arg1 <<
" which doesn't have that many elements.");
459 template <
bool Other>
470 template <
bool Constness>
476 typename ::TrilinosWrappers::SparseMatrixIterators::Iterator<
477 Constness>::value_type;
479 typename ::TrilinosWrappers::SparseMatrixIterators::Iterator<
480 Constness>::difference_type;
562 <<
"You tried to access row " << arg1
563 <<
" of a non-contiguous locally owned row set."
564 <<
" The row " << arg1
565 <<
" is not stored locally and can't be accessed.");
616 const unsigned int n_max_entries_per_row);
627 const std::vector<unsigned int> &n_entries_per_row);
671 template <
typename SparsityPatternType>
673 reinit(
const SparsityPatternType &sparsity_pattern);
721 template <
typename number>
723 reinit(const ::SparseMatrix<number> &dealii_sparse_matrix,
724 const double drop_tolerance = 1e-13,
725 const bool copy_values =
true,
726 const ::SparsityPattern *use_this_sparsity =
nullptr);
734 reinit(
const Epetra_CrsMatrix &input_matrix,
const bool copy_values =
true);
754 const MPI_Comm communicator = MPI_COMM_WORLD,
755 const unsigned int n_max_entries_per_row = 0);
766 const std::vector<unsigned int> &n_entries_per_row);
783 const IndexSet &col_parallel_partitioning,
784 const MPI_Comm communicator = MPI_COMM_WORLD,
785 const size_type n_max_entries_per_row = 0);
802 const IndexSet &col_parallel_partitioning,
804 const std::vector<unsigned int> &n_entries_per_row);
826 template <
typename SparsityPatternType>
829 const SparsityPatternType &sparsity_pattern,
830 const MPI_Comm communicator = MPI_COMM_WORLD,
831 const bool exchange_data =
false);
845 template <
typename SparsityPatternType>
847 !std::is_same_v<SparsityPatternType, ::SparseMatrix<double>>>
849 const IndexSet &col_parallel_partitioning,
850 const SparsityPatternType &sparsity_pattern,
851 const MPI_Comm communicator = MPI_COMM_WORLD,
852 const bool exchange_data =
false);
870 template <
typename number>
873 const ::SparseMatrix<number> &dealii_sparse_matrix,
874 const MPI_Comm communicator = MPI_COMM_WORLD,
875 const double drop_tolerance = 1e-13,
876 const bool copy_values =
true,
877 const ::SparsityPattern *use_this_sparsity =
nullptr);
892 template <
typename number>
895 const IndexSet &col_parallel_partitioning,
896 const ::SparseMatrix<number> &dealii_sparse_matrix,
897 const MPI_Comm communicator = MPI_COMM_WORLD,
898 const double drop_tolerance = 1e-13,
899 const bool copy_values =
true,
900 const ::SparsityPattern *use_this_sparsity =
nullptr);
938 std::pair<size_type, size_type>
1099 set(
const std::vector<size_type> &indices,
1101 const bool elide_zero_values =
false);
1109 set(
const std::vector<size_type> &row_indices,
1110 const std::vector<size_type> &col_indices,
1112 const bool elide_zero_values =
false);
1143 const std::vector<size_type> &col_indices,
1144 const std::vector<TrilinosScalar> &values,
1145 const bool elide_zero_values =
false);
1174 template <
typename Number>
1179 const Number *values,
1180 const bool elide_zero_values =
false);
1213 add(
const std::vector<size_type> &indices,
1215 const bool elide_zero_values =
true);
1223 add(
const std::vector<size_type> &row_indices,
1224 const std::vector<size_type> &col_indices,
1226 const bool elide_zero_values =
true);
1243 const std::vector<size_type> &col_indices,
1244 const std::vector<TrilinosScalar> &values,
1245 const bool elide_zero_values =
true);
1265 const bool elide_zero_values =
true,
1266 const bool col_indices_are_sorted =
false);
1442 template <
typename VectorType>
1444 std::is_same_v<typename VectorType::value_type, TrilinosScalar>>
1445 vmult(VectorType &dst,
const VectorType &src)
const;
1453 template <
typename VectorType>
1455 !std::is_same_v<typename VectorType::value_type, TrilinosScalar>>
1456 vmult(VectorType &dst,
const VectorType &src)
const;
1472 template <
typename VectorType>
1474 std::is_same_v<typename VectorType::value_type, TrilinosScalar>>
1475 Tvmult(VectorType &dst,
const VectorType &src)
const;
1483 template <
typename VectorType>
1485 !std::is_same_v<typename VectorType::value_type, TrilinosScalar>>
1486 Tvmult(VectorType &dst,
const VectorType &src)
const;
1497 template <
typename VectorType>
1499 vmult_add(VectorType &dst,
const VectorType &src)
const;
1511 template <
typename VectorType>
1513 Tvmult_add(VectorType &dst,
const VectorType &src)
const;
1577 template <
typename VectorType>
1579 residual(VectorType &dst,
const VectorType &x,
const VectorType &b)
const;
1666 const Epetra_CrsMatrix &
1673 const Epetra_CrsGraph &
1822 print(std::ostream &out,
1823 const bool write_extended_trilinos_info =
false)
const;
1836 <<
"An error with error number " << arg1
1837 <<
" occurred while calling a Trilinos function. "
1839 "For historical reasons, many Trilinos functions express "
1840 "errors by returning specific integer values to indicate "
1841 "certain errors. Unfortunately, different Trilinos functions "
1842 "often use the same integer values for different kinds of "
1843 "errors, and in most cases it is also not documented what "
1844 "each error code actually means. As a consequence, it is often "
1845 "difficult to say what a particular error (in this case, "
1846 "the error with integer code '"
1848 <<
"') represents and how one should fix a code to avoid it. "
1849 "The best one can often do is to look up the call stack to "
1850 "see which deal.II function generated the error, and which "
1851 "Trilinos function the error code had originated from; "
1852 "then look up the Trilinos source code of that function (for "
1853 "example on github) to see what code path set that error "
1854 "code. Short of going through all of that, the only other "
1855 "option is to guess the cause of the error from "
1856 "the context in which the error appeared.");
1865 <<
"The entry with index <" << arg1 <<
',' << arg2
1866 <<
"> does not exist.");
1872 "You are attempting an operation on two vectors that "
1873 "are the same object, but the operation requires that the "
1874 "two objects are in fact different.");
1889 <<
"You tried to access element (" << arg1 <<
'/' << arg2
1891 <<
" of a distributed matrix, but only rows in range ["
1892 << arg3 <<
',' << arg4
1893 <<
"] are stored locally and can be accessed.");
1901 <<
"You tried to access element (" << arg1 <<
'/' << arg2
1902 <<
')' <<
" of a sparse matrix, but it appears to not"
1903 <<
" exist in the Trilinos sparsity pattern.");
1993 const Epetra_MultiVector &src,
1994 const Epetra_MultiVector &dst,
1999 Assert(src.Map().SameAs(mtrx.DomainMap()) ==
true,
2001 "Column map of matrix does not fit with vector map!"));
2002 Assert(dst.Map().SameAs(mtrx.RangeMap()) ==
true,
2003 ExcMessage(
"Row map of matrix does not fit with vector map!"));
2007 Assert(src.Map().SameAs(mtrx.RangeMap()) ==
true,
2009 "Column map of matrix does not fit with vector map!"));
2010 Assert(dst.Map().SameAs(mtrx.DomainMap()) ==
true,
2011 ExcMessage(
"Row map of matrix does not fit with vector map!"));
2020 const Epetra_MultiVector &src,
2021 const Epetra_MultiVector &dst,
2026 Assert(src.Map().SameAs(op.OperatorDomainMap()) ==
true,
2028 "Column map of operator does not fit with vector map!"));
2029 Assert(dst.Map().SameAs(op.OperatorRangeMap()) ==
true,
2031 "Row map of operator does not fit with vector map!"));
2035 Assert(src.Map().SameAs(op.OperatorRangeMap()) ==
true,
2037 "Column map of operator does not fit with vector map!"));
2038 Assert(dst.Map().SameAs(op.OperatorDomainMap()) ==
true,
2040 "Row map of operator does not fit with vector map!"));
2048 namespace LinearOperatorImplementation
2193 template <
typename Solver,
typename Preconditioner>
2195 std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
2218 template <
typename Solver,
typename Preconditioner>
2220 !(std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
2383 virtual const char *
2384 Label()
const override;
2393 virtual const Epetra_Comm &
2394 Comm()
const override;
2403 virtual const Epetra_Map &
2414 virtual const Epetra_Map &
2428 template <
typename EpetraOpType>
2430 const bool supports_inverse_operations,
2516 visit_present_row();
2520 inline AccessorBase::size_type
2521 AccessorBase::row()
const
2523 Assert(a_row < matrix->m(), ExcBeyondEndOfMatrix());
2528 inline AccessorBase::size_type
2529 AccessorBase::column()
const
2532 return (*colnum_cache)[a_index];
2536 inline AccessorBase::size_type
2537 AccessorBase::index()
const
2544 inline Accessor<true>::Accessor(MatrixType *matrix,
2551 template <
bool Other>
2552 inline Accessor<true>::Accessor(
const Accessor<Other> &other)
2553 : AccessorBase(other)
2558 Accessor<true>::value()
const
2561 return (*value_cache)[a_index];
2565 inline Accessor<false>::Reference::Reference(
const Accessor<false> &acc)
2566 : accessor(const_cast<Accessor<false> &>(acc))
2570 inline Accessor<false>::Reference::operator
TrilinosScalar()
const
2572 return (*accessor.value_cache)[accessor.a_index];
2575 inline const Accessor<false>::Reference &
2576 Accessor<false>::Reference::operator=(
const TrilinosScalar n)
const
2578 (*accessor.value_cache)[accessor.a_index] = n;
2579 accessor.matrix->set(accessor.row(),
2586 inline const Accessor<false>::Reference &
2587 Accessor<false>::Reference::operator+=(
const TrilinosScalar n)
const
2589 (*accessor.value_cache)[accessor.a_index] += n;
2590 accessor.matrix->set(accessor.row(),
2597 inline const Accessor<false>::Reference &
2598 Accessor<false>::Reference::operator-=(
const TrilinosScalar n)
const
2600 (*accessor.value_cache)[accessor.a_index] -= n;
2601 accessor.matrix->set(accessor.row(),
2608 inline const Accessor<false>::Reference &
2609 Accessor<false>::Reference::operator*=(
const TrilinosScalar n)
const
2611 (*accessor.value_cache)[accessor.a_index] *= n;
2612 accessor.matrix->set(accessor.row(),
2619 inline const Accessor<false>::Reference &
2620 Accessor<false>::Reference::operator/=(
const TrilinosScalar n)
const
2622 (*accessor.value_cache)[accessor.a_index] /= n;
2623 accessor.matrix->set(accessor.row(),
2630 inline Accessor<false>::Accessor(MatrixType *matrix,
2637 inline Accessor<false>::Reference
2638 Accessor<false>::value()
const
2646 template <
bool Constness>
2647 inline Iterator<Constness>::Iterator(MatrixType *matrix,
2654 template <
bool Constness>
2655 template <
bool Other>
2656 inline Iterator<Constness>::Iterator(
const Iterator<Other> &other)
2657 : accessor(other.accessor)
2661 template <
bool Constness>
2662 inline Iterator<Constness> &
2663 Iterator<Constness>::operator++()
2673 if (accessor.a_index >= accessor.colnum_cache->size())
2675 accessor.a_index = 0;
2678 while ((accessor.a_row < accessor.matrix->m()) &&
2679 ((accessor.matrix->in_local_range(accessor.a_row) ==
false) ||
2680 (accessor.matrix->row_length(accessor.a_row) == 0)))
2683 accessor.visit_present_row();
2689 template <
bool Constness>
2690 inline Iterator<Constness>
2691 Iterator<Constness>::operator++(
int)
2693 const Iterator<Constness> old_state = *
this;
2700 template <
bool Constness>
2701 inline const Accessor<Constness> &
2702 Iterator<Constness>::operator*()
const
2709 template <
bool Constness>
2710 inline const Accessor<Constness> *
2711 Iterator<Constness>::operator->()
const
2718 template <
bool Constness>
2719 template <
bool OtherConstness>
2721 Iterator<Constness>::operator==(
const Iterator<OtherConstness> &other)
const
2723 return (accessor.a_row == other.accessor.a_row &&
2724 accessor.a_index == other.accessor.a_index);
2729 template <
bool Constness>
2730 template <
bool OtherConstness>
2732 Iterator<Constness>::operator!=(
const Iterator<OtherConstness> &other)
const
2734 return !(*
this == other);
2739 template <
bool Constness>
2740 template <
bool OtherConstness>
2742 Iterator<Constness>::operator<(
const Iterator<OtherConstness> &other)
const
2744 return (accessor.row() < other.accessor.row() ||
2745 (accessor.row() == other.accessor.row() &&
2746 accessor.index() < other.accessor.index()));
2750 template <
bool Constness>
2751 template <
bool OtherConstness>
2753 Iterator<Constness>::operator>(
const Iterator<OtherConstness> &other)
const
2755 return (other < *
this);
2773 return const_iterator(
this, m(), 0);
2782 if (in_local_range(r) && (row_length(r) > 0))
2783 return const_iterator(
this, r, 0);
2798 for (size_type i = r + 1; i < m(); ++i)
2799 if (in_local_range(i) && (row_length(i) > 0))
2800 return const_iterator(
this, i, 0);
2820 return iterator(
this, m(), 0);
2829 if (in_local_range(r) && (row_length(r) > 0))
2830 return iterator(
this, r, 0);
2845 for (size_type i = r + 1; i < m(); ++i)
2846 if (in_local_range(i) && (row_length(i) > 0))
2847 return iterator(
this, i, 0);
2860# ifndef DEAL_II_WITH_64BIT_INDICES
2865 end =
matrix->RowMap().MaxMyGID64() + 1;
2887 SparseMatrix::set<TrilinosScalar>(
const size_type row,
2888 const size_type n_cols,
2889 const size_type *col_indices,
2891 const bool elide_zero_values);
2895 template <
typename Number>
2898 const size_type n_cols,
2899 const size_type *col_indices,
2900 const Number *values,
2901 const bool elide_zero_values)
2903 std::vector<TrilinosScalar> trilinos_values(n_cols);
2904 std::copy(values, values + n_cols, trilinos_values.begin());
2906 row, n_cols, col_indices, trilinos_values.data(), elide_zero_values);
2918 set(i, 1, &j, &value,
false);
2926 const bool elide_zero_values)
2932 for (size_type i = 0; i < indices.size(); ++i)
2957 if (last_action == Insert)
2959 const int ierr =
matrix->GlobalAssemble(*column_space_map,
2971 add(i, 1, &j, &value,
false);
2981# ifndef DEAL_II_WITH_64BIT_INDICES
2982 return matrix->NumGlobalRows();
2984 return matrix->NumGlobalRows64();
3005 return matrix->NumMyRows();
3010 inline std::pair<SparseMatrix::size_type, SparseMatrix::size_type>
3014# ifndef DEAL_II_WITH_64BIT_INDICES
3019 end =
matrix->RowMap().MaxMyGID64() + 1;
3027 inline std::uint64_t
3034 return static_cast<std::uint64_t
>(
matrix->NumGlobalNonzeros64());
3039 template <
typename SparsityPatternType>
3042 const SparsityPatternType &sparsity_pattern,
3044 const bool exchange_data)
3046 reinit(parallel_partitioning,
3047 parallel_partitioning,
3055 template <
typename number>
3058 const ::SparseMatrix<number> &sparse_matrix,
3060 const double drop_tolerance,
3061 const bool copy_values,
3062 const ::SparsityPattern *use_this_sparsity)
3066 reinit(parallel_partitioning,
3067 parallel_partitioning,
3076 inline const Epetra_CrsMatrix &
3079 return static_cast<const Epetra_CrsMatrix &
>(*matrix);
3084 inline const Epetra_CrsGraph &
3124 template <
typename VectorType>
3127 const VectorType &x,
3128 const VectorType &b)
const
3134 return dst.l2_norm();
3140 namespace LinearOperatorImplementation
3142 template <
typename EpetraOpType>
3143 TrilinosPayload::TrilinosPayload(
3145 const bool supports_inverse_operations,
3146 const bool use_transpose,
3148 const IndexSet &locally_owned_domain_indices,
3149 const IndexSet &locally_owned_range_indices)
3150 : use_transpose(use_transpose)
3151 , communicator(mpi_communicator)
3153 locally_owned_domain_indices.make_trilinos_map(communicator.Comm()))
3155 locally_owned_range_indices.make_trilinos_map(communicator.Comm()))
3160 Assert(&tril_src != &tril_dst,
3167 const int ierr = op.Apply(tril_src, tril_dst);
3174 Assert(&tril_src != &tril_dst,
3179 !op.UseTranspose());
3181 op.SetUseTranspose(!op.UseTranspose());
3182 const int ierr = op.Apply(tril_src, tril_dst);
3184 op.SetUseTranspose(!op.UseTranspose());
3187 if (supports_inverse_operations)
3193 &tril_src != &tril_dst,
3198 !op.UseTranspose());
3200 const int ierr = op.ApplyInverse(tril_src, tril_dst);
3208 &tril_src != &tril_dst,
3215 op.SetUseTranspose(!op.UseTranspose());
3216 const int ierr = op.ApplyInverse(tril_src, tril_dst);
3218 op.SetUseTranspose(!op.UseTranspose());
3226 "Uninitialized TrilinosPayload::inv_vmult called. "
3227 "The operator does not support inverse operations."));
3233 "Uninitialized TrilinosPayload::inv_Tvmult called. "
3234 "The operator does not support inverse operations."));
3240 template <
typename Solver,
typename Preconditioner>
3242 std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
3243 std::is_base_of_v<TrilinosWrappers::PreconditionBase, Preconditioner>,
3247 const Preconditioner &preconditioner)
const
3249 const auto &payload = *
this;
3255 return_op.inv_vmult = [payload, &solver, &preconditioner](
3260 Assert(&tril_src != &tril_dst,
3265 !payload.UseTranspose());
3266 solver.solve(payload, tril_dst, tril_src, preconditioner);
3269 return_op.inv_Tvmult = [payload, &solver, &preconditioner](
3274 Assert(&tril_src != &tril_dst,
3279 payload.UseTranspose());
3282 solver.solve(payload, tril_dst, tril_src, preconditioner);
3288 if (return_op.UseTranspose() ==
true)
3289 std::swap(return_op.inv_vmult, return_op.inv_Tvmult);
3294 template <
typename Solver,
typename Preconditioner>
3296 !(std::is_base_of_v<TrilinosWrappers::SolverBase, Solver> &&
3302 TrilinosPayload return_op(*
this);
3307 ExcMessage(
"Payload inv_vmult disabled because of "
3308 "incompatible solver/preconditioner choice."));
3314 ExcMessage(
"Payload inv_vmult disabled because of "
3315 "incompatible solver/preconditioner choice."));
3325 SparseMatrix::set<TrilinosScalar>(
const size_type row,
3326 const size_type n_cols,
3327 const size_type *col_indices,
3329 const bool elide_zero_values);
Epetra_Map make_trilinos_map(const MPI_Comm communicator=MPI_COMM_WORLD, const bool overlapping=false) const
AccessorBase(SparseMatrix *matrix, const size_type row, const size_type index)
std::shared_ptr< std::vector< TrilinosScalar > > value_cache
std::shared_ptr< std::vector< size_type > > colnum_cache
Reference(const Accessor< false > &accessor)
const Reference & operator-=(const TrilinosScalar n) const
const Reference & operator*=(const TrilinosScalar n) const
const Reference & operator+=(const TrilinosScalar n) const
const Reference & operator/=(const TrilinosScalar n) const
const Reference & operator=(const TrilinosScalar n) const
Accessor(MatrixType *matrix, const size_type row, const size_type index)
Accessor(const Accessor< Other > &a)
Accessor(MatrixType *matrix, const size_type row, const size_type index)
TrilinosScalar value() const
TrilinosScalar value() const
const Accessor< Constness > & operator*() const
const Accessor< Constness > * operator->() const
typename Accessor< Constness >::MatrixType MatrixType
bool operator==(const Iterator< OtherConstness > &) const
bool operator!=(const Iterator< OtherConstness > &) const
bool operator<(const Iterator< OtherConstness > &) const
Iterator(const Iterator< Other > &other)
TrilinosScalar value_type
bool operator>(const Iterator< OtherConstness > &) const
Iterator(MatrixType *matrix, const size_type row, const size_type index)
Accessor< Constness > accessor
Iterator< Constness > & operator++()
Iterator< Constness > operator++(int)
void set(const size_type i, const size_type j, const TrilinosScalar value)
std::unique_ptr< Epetra_Map > column_space_map
MPI_Comm get_mpi_communicator() const
TrilinosScalar residual(VectorType &dst, const VectorType &x, const VectorType &b) const
SparseMatrix & operator*=(const TrilinosScalar factor)
void mmult(SparseMatrix &C, const SparseMatrix &B, const MPI::Vector &V=MPI::Vector()) const
std::unique_ptr< Epetra_Export > nonlocal_matrix_exporter
TrilinosScalar l1_norm() const
void compress(VectorOperation::values operation)
std::unique_ptr< Epetra_FECrsMatrix > matrix
TrilinosScalar linfty_norm() const
const Epetra_CrsMatrix & trilinos_matrix() const
size_type memory_consumption() const
TrilinosScalar matrix_norm_square(const MPI::Vector &v) const
Epetra_CombineMode last_action
IndexSet locally_owned_range_indices() const
void print(std::ostream &out, const bool write_extended_trilinos_info=false) const
void Tmmult(SparseMatrix &C, const SparseMatrix &B, const MPI::Vector &V=MPI::Vector()) const
std::enable_if_t< std::is_same_v< typename VectorType::value_type, TrilinosScalar > > Tvmult(VectorType &dst, const VectorType &src) const
void clear_row(const size_type row, const TrilinosScalar new_diag_value=0)
void clear_rows(const ArrayView< const size_type > &rows, const TrilinosScalar new_diag_value=0)
const_iterator begin() const
void reinit(const SparsityPatternType &sparsity_pattern)
void vmult_add(VectorType &dst, const VectorType &src) const
SparseMatrix & operator=(const SparseMatrix &)=delete
const_iterator end(const size_type r) const
SparseMatrix & operator/=(const TrilinosScalar factor)
void Tvmult_add(VectorType &dst, const VectorType &src) const
std::enable_if_t< !std::is_same_v< SparsityPatternType, ::SparseMatrix< double > > > reinit(const IndexSet &row_parallel_partitioning, const IndexSet &col_parallel_partitioning, const SparsityPatternType &sparsity_pattern, const MPI_Comm communicator=MPI_COMM_WORLD, const bool exchange_data=false)
bool is_compressed() const
TrilinosScalar el(const size_type i, const size_type j) const
IndexSet locally_owned_domain_indices() const
bool in_local_range(const size_type index) const
void copy_from(const SparseMatrix &source)
unsigned int row_length(const size_type row) const
TrilinosScalar frobenius_norm() const
std::uint64_t n_nonzero_elements() const
std::enable_if_t< std::is_same_v< typename VectorType::value_type, TrilinosScalar > > vmult(VectorType &dst, const VectorType &src) const
const_iterator begin(const size_type r) const
const Epetra_CrsGraph & trilinos_sparsity_pattern() const
SparseMatrix(const SparseMatrix &)=delete
iterator end(const size_type r)
TrilinosScalar diag_element(const size_type i) const
void add(const size_type i, const size_type j, const TrilinosScalar value)
unsigned int local_size() const
iterator begin(const size_type r)
TrilinosScalar operator()(const size_type i, const size_type j) const
void reinit(const IndexSet ¶llel_partitioning, const ::SparseMatrix< number > &dealii_sparse_matrix, const MPI_Comm communicator=MPI_COMM_WORLD, const double drop_tolerance=1e-13, const bool copy_values=true, const ::SparsityPattern *use_this_sparsity=nullptr)
virtual ~SparseMatrix() override=default
void set(const size_type row, const size_type n_cols, const size_type *col_indices, const Number *values, const bool elide_zero_values=false)
TrilinosScalar matrix_scalar_product(const MPI::Vector &u, const MPI::Vector &v) const
const_iterator end() const
void set(const std::vector< size_type > &indices, const FullMatrix< TrilinosScalar > &full_matrix, const bool elide_zero_values=false)
std::pair< size_type, size_type > local_range() const
void reinit(const IndexSet ¶llel_partitioning, const SparsityPatternType &sparsity_pattern, const MPI_Comm communicator=MPI_COMM_WORLD, const bool exchange_data=false)
std::unique_ptr< Epetra_CrsMatrix > nonlocal_matrix
TrilinosScalar value_type
Epetra_MpiComm communicator
std::function< void(VectorType &, const VectorType &)> inv_Tvmult
virtual int SetUseTranspose(bool UseTranspose) override
virtual bool UseTranspose() const override
virtual const Epetra_Map & OperatorDomainMap() const override
IndexSet locally_owned_range_indices() const
TrilinosPayload transpose_payload() const
std::enable_if_t< std::is_base_of_v< TrilinosWrappers::SolverBase, Solver > &&std::is_base_of_v< TrilinosWrappers::PreconditionBase, Preconditioner >, TrilinosPayload > inverse_payload(Solver &, const Preconditioner &) const
Epetra_MultiVector VectorType
MPI_Comm get_mpi_communicator() const
virtual ~TrilinosPayload() override=default
virtual int ApplyInverse(const VectorType &Y, VectorType &X) const override
std::function< void(VectorType &, const VectorType &)> Tvmult
virtual int Apply(const VectorType &X, VectorType &Y) const override
std::function< void(VectorType &, const VectorType &)> vmult
virtual const Epetra_Map & OperatorRangeMap() const override
std::function< void(VectorType &, const VectorType &)> inv_vmult
virtual const char * Label() const override
IndexSet locally_owned_domain_indices() const
virtual const Epetra_Comm & Comm() const override
virtual bool HasNormInf() const override
TrilinosPayload identity_payload() const
TrilinosPayload(EpetraOpType &op, const bool supports_inverse_operations, const bool use_transpose, const MPI_Comm mpi_communicator, const IndexSet &locally_owned_domain_indices, const IndexSet &locally_owned_range_indices)
virtual double NormInf() const override
TrilinosPayload null_payload() const
std::enable_if_t< !(std::is_base_of_v< TrilinosWrappers::SolverBase, Solver > &&std::is_base_of_v< TrilinosWrappers::PreconditionBase, Preconditioner >), TrilinosPayload > inverse_payload(Solver &, const Preconditioner &) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInvalidIndexWithinRow(size_type arg1, size_type arg2)
#define DeclException0(Exception0)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
static ::ExceptionBase & ExcAccessToNonlocalRow(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcInvalidIndex(size_type arg1, size_type arg2)
#define Assert(cond, exc)
static ::ExceptionBase & ExcIteratorPastEnd()
static ::ExceptionBase & ExcAccessToNonPresentElement(size_type arg1, size_type arg2)
#define AssertIsFinite(number)
static ::ExceptionBase & ExcAccessToNonlocalRow(std::size_t arg1)
static ::ExceptionBase & ExcBeyondEndOfMatrix()
#define DeclException2(Exception2, type1, type2, outsequence)
#define AssertIndexRange(index, range)
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcSourceEqualsDestination()
#define DeclException3(Exception3, type1, type2, type3, outsequence)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcNotQuadratic()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcMatrixNotCompressed()
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcAccessToNonLocalElement(size_type arg1, size_type arg2, size_type arg3, size_type arg4)
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcTrilinosError(int arg1)
#define AssertThrow(cond, exc)
types::global_dof_index size_type
@ matrix
Contents is actually a matrix.
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
TrilinosPayload operator+(const TrilinosPayload &first_op, const TrilinosPayload &second_op)
VectorTraits::size_type size_type
TrilinosPayload operator*(const TrilinosPayload &first_op, const TrilinosPayload &second_op)
VectorType::value_type * end(VectorType &V)
VectorType::value_type * begin(VectorType &V)
void check_vector_map_equality(const Epetra_CrsMatrix &mtrx, const Epetra_MultiVector &src, const Epetra_MultiVector &dst, const bool transpose)
TrilinosWrappers::types::int64_type n_global_elements(const Epetra_BlockMap &map)
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
unsigned int global_dof_index
static const bool zero_addition_can_be_elided
typename ::TrilinosWrappers::SparseMatrixIterators::Iterator< Constness >::value_type value_type
forward_iterator_tag iterator_category
typename ::TrilinosWrappers::SparseMatrixIterators::Iterator< Constness >::difference_type difference_type