16 #ifndef dealii_trilinos_sparse_matrix_h 17 #define dealii_trilinos_sparse_matrix_h 20 #include <deal.II/base/config.h> 22 #ifdef DEAL_II_WITH_TRILINOS 24 # include <deal.II/base/subscriptor.h> 25 # include <deal.II/base/index_set.h> 26 # include <deal.II/lac/full_matrix.h> 27 # include <deal.II/lac/exceptions.h> 28 # include <deal.II/lac/trilinos_vector.h> 29 # include <deal.II/lac/trilinos_epetra_vector.h> 30 # include <deal.II/lac/vector_memory.h> 31 #include <deal.II/lac/vector_operation.h> 33 # include <type_traits> 38 # include <Epetra_FECrsMatrix.h> 39 # include <Epetra_Export.h> 40 # include <Epetra_Map.h> 41 # include <Epetra_CrsGraph.h> 42 # include <Epetra_MultiVector.h> 43 # include <Epetra_Operator.h> 44 # include <Epetra_Comm.h> 45 # ifdef DEAL_II_WITH_MPI 46 # include <Epetra_MpiComm.h> 49 # include <Epetra_SerialComm.h> 52 DEAL_II_NAMESPACE_OPEN
86 std::size_t, std::size_t, std::size_t,
87 <<
"You tried to access row " << arg1
88 <<
" of a distributed sparsity pattern, " 89 <<
" but only rows " << arg2 <<
" through " << arg3
90 <<
" are stored locally and can be accessed.");
187 template <
bool Constess>
193 TrilinosScalar
value()
const;
198 TrilinosScalar &
value();
226 template <
bool Other>
232 TrilinosScalar
value()
const;
258 operator TrilinosScalar ()
const;
263 const Reference &operator = (
const TrilinosScalar n)
const;
268 const Reference &operator += (
const TrilinosScalar n)
const;
273 const Reference &operator -= (
const TrilinosScalar n)
const;
278 const Reference &operator *= (
const TrilinosScalar n)
const;
283 const Reference &operator /= (
const TrilinosScalar n)
const;
311 Reference
value()
const;
321 friend class Reference;
338 template <
bool Constness>
364 template <
bool Other>
403 bool operator < (const Iterator<Constness> &)
const;
415 <<
"Attempt to access element " << arg2
416 <<
" of row " << arg1
417 <<
" which doesn't have that many elements.");
425 template <
bool Other>
friend class Iterator;
549 const unsigned int n_max_entries_per_row);
560 const std::vector<unsigned int> &n_entries_per_row);
603 template <
typename SparsityPatternType>
604 void reinit (
const SparsityPatternType &sparsity_pattern);
650 template <
typename number>
651 void reinit (const ::SparseMatrix<number> &dealii_sparse_matrix,
652 const double drop_tolerance=1e-13,
653 const bool copy_values=
true,
654 const ::SparsityPattern *use_this_sparsity=
nullptr);
661 void reinit (
const Epetra_CrsMatrix &input_matrix,
662 const bool copy_values =
true);
684 const size_type n_max_entries_per_row = 0);
697 const std::vector<unsigned int> &n_entries_per_row);
718 SparseMatrix (
const Epetra_Map &row_parallel_partitioning,
719 const Epetra_Map &col_parallel_partitioning,
720 const size_type n_max_entries_per_row = 0);
739 SparseMatrix (
const Epetra_Map &row_parallel_partitioning,
740 const Epetra_Map &col_parallel_partitioning,
741 const std::vector<unsigned int> &n_entries_per_row);
769 template <
typename SparsityPatternType>
771 void reinit (
const Epetra_Map ¶llel_partitioning,
772 const SparsityPatternType &sparsity_pattern,
773 const bool exchange_data =
false);
789 template <
typename SparsityPatternType>
791 void reinit (
const Epetra_Map &row_parallel_partitioning,
792 const Epetra_Map &col_parallel_partitioning,
793 const SparsityPatternType &sparsity_pattern,
794 const bool exchange_data =
false);
814 template <
typename number>
816 void reinit (
const Epetra_Map ¶llel_partitioning,
817 const ::SparseMatrix<number> &dealii_sparse_matrix,
818 const double drop_tolerance=1e-13,
819 const bool copy_values=
true,
820 const ::SparsityPattern *use_this_sparsity=
nullptr);
837 template <
typename number>
839 void reinit (
const Epetra_Map &row_parallel_partitioning,
840 const Epetra_Map &col_parallel_partitioning,
841 const ::SparseMatrix<number> &dealii_sparse_matrix,
842 const double drop_tolerance=1e-13,
843 const bool copy_values=
true,
844 const ::SparsityPattern *use_this_sparsity=
nullptr);
863 const MPI_Comm &communicator = MPI_COMM_WORLD,
864 const unsigned int n_max_entries_per_row = 0);
874 const MPI_Comm &communicator,
875 const std::vector<unsigned int> &n_entries_per_row);
892 const IndexSet &col_parallel_partitioning,
893 const MPI_Comm &communicator = MPI_COMM_WORLD,
894 const size_type n_max_entries_per_row = 0);
911 const IndexSet &col_parallel_partitioning,
912 const MPI_Comm &communicator,
913 const std::vector<unsigned int> &n_entries_per_row);
935 template <
typename SparsityPatternType>
937 const SparsityPatternType &sparsity_pattern,
938 const MPI_Comm &communicator = MPI_COMM_WORLD,
939 const bool exchange_data =
false);
953 template <
typename SparsityPatternType>
955 const IndexSet &col_parallel_partitioning,
956 const SparsityPatternType &sparsity_pattern,
957 const MPI_Comm &communicator = MPI_COMM_WORLD,
958 const bool exchange_data =
false);
976 template <
typename number>
978 const ::SparseMatrix<number> &dealii_sparse_matrix,
979 const MPI_Comm &communicator = MPI_COMM_WORLD,
980 const double drop_tolerance=1e-13,
981 const bool copy_values=
true,
982 const ::SparsityPattern *use_this_sparsity=
nullptr);
997 template <
typename number>
999 const IndexSet &col_parallel_partitioning,
1000 const ::SparseMatrix<number> &dealii_sparse_matrix,
1001 const MPI_Comm &communicator = MPI_COMM_WORLD,
1002 const double drop_tolerance=1e-13,
1003 const bool copy_values=
true,
1004 const ::SparsityPattern *use_this_sparsity=
nullptr);
1039 std::pair<size_type, size_type>
1158 const TrilinosScalar value);
1192 void set (
const std::vector<size_type> &indices,
1194 const bool elide_zero_values =
false);
1201 void set (
const std::vector<size_type> &row_indices,
1202 const std::vector<size_type> &col_indices,
1204 const bool elide_zero_values =
false);
1234 const std::vector<size_type> &col_indices,
1235 const std::vector<TrilinosScalar> &values,
1236 const bool elide_zero_values =
false);
1268 const TrilinosScalar *values,
1269 const bool elide_zero_values =
false);
1282 const TrilinosScalar value);
1302 void add (
const std::vector<size_type> &indices,
1304 const bool elide_zero_values =
true);
1311 void add (
const std::vector<size_type> &row_indices,
1312 const std::vector<size_type> &col_indices,
1314 const bool elide_zero_values =
true);
1330 const std::vector<size_type> &col_indices,
1331 const std::vector<TrilinosScalar> &values,
1332 const bool elide_zero_values =
true);
1350 const TrilinosScalar *values,
1351 const bool elide_zero_values =
true,
1352 const bool col_indices_are_sorted =
false);
1376 void add (
const TrilinosScalar factor,
1406 const TrilinosScalar new_diag_value = 0);
1428 void clear_rows (
const std::vector<size_type> &rows,
1429 const TrilinosScalar new_diag_value = 0);
1512 template <
typename VectorType>
1513 void vmult (VectorType &dst,
1514 const VectorType &src)
const;
1537 template <
typename VectorType>
1538 void Tvmult (VectorType &dst,
1539 const VectorType &src)
const;
1562 template <
typename VectorType>
1564 const VectorType &src)
const;
1587 template <
typename VectorType>
1589 const VectorType &src)
const;
1708 TrilinosScalar
l1_norm ()
const;
1920 void print (std::ostream &out,
1921 const bool write_extended_trilinos_info =
false)
const;
1934 <<
"An error with error number " << arg1
1935 <<
" occurred while calling a Trilinos function");
1942 <<
"The entry with index <" << arg1 <<
',' << arg2
1943 <<
"> does not exist.");
1949 "You are attempting an operation on two matrices that " 1950 "are the same object, but the operation requires that the " 1951 "two objects are in fact different.");
1963 <<
"You tried to access element (" << arg1
1964 <<
"/" << arg2 <<
")" 1965 <<
" of a distributed matrix, but only rows " 1966 << arg3 <<
" through " << arg4
1967 <<
" are stored locally and can be accessed.");
1974 <<
"You tried to access element (" << arg1
1975 <<
"/" << arg2 <<
")" 1976 <<
" of a sparse matrix, but it appears to not" 1977 <<
" exist in the Trilinos sparsity pattern.");
2067 void check_vector_map_equality(
const Epetra_CrsMatrix &mtrx,
2068 const Epetra_MultiVector &src,
2069 const Epetra_MultiVector &dst,
2074 Assert (src.Map().SameAs(mtrx.DomainMap()) ==
true,
2075 ExcMessage (
"Column map of matrix does not fit with vector map!"));
2076 Assert (dst.Map().SameAs(mtrx.RangeMap()) ==
true,
2077 ExcMessage (
"Row map of matrix does not fit with vector map!"));
2081 Assert (src.Map().SameAs(mtrx.RangeMap()) ==
true,
2082 ExcMessage (
"Column map of matrix does not fit with vector map!"));
2083 Assert (dst.Map().SameAs(mtrx.DomainMap()) ==
true,
2084 ExcMessage (
"Row map of matrix does not fit with vector map!"));
2092 void check_vector_map_equality(
const Epetra_Operator &op,
2093 const Epetra_MultiVector &src,
2094 const Epetra_MultiVector &dst,
2099 Assert (src.Map().SameAs(op.OperatorDomainMap()) ==
true,
2100 ExcMessage (
"Column map of operator does not fit with vector map!"));
2101 Assert (dst.Map().SameAs(op.OperatorRangeMap()) ==
true,
2102 ExcMessage (
"Row map of operator does not fit with vector map!"));
2106 Assert (src.Map().SameAs(op.OperatorRangeMap()) ==
true,
2107 ExcMessage (
"Column map of operator does not fit with vector map!"));
2108 Assert (dst.Map().SameAs(op.OperatorDomainMap()) ==
true,
2109 ExcMessage (
"Row map of operator does not fit with vector map!"));
2117 namespace LinearOperatorImplementation
2140 :
public Epetra_Operator
2242 template <
typename Solver,
typename Preconditioner>
2243 typename std::enable_if<
2244 std::is_base_of<TrilinosWrappers::SolverBase,Solver>::value &&
2245 std::is_base_of<TrilinosWrappers::PreconditionBase,Preconditioner>::value,
2265 template <
typename Solver,
typename Preconditioner>
2266 typename std::enable_if<
2267 !(std::is_base_of<TrilinosWrappers::SolverBase,Solver>::value &&
2268 std::is_base_of<TrilinosWrappers::PreconditionBase,Preconditioner>::value),
2317 std::function<void(VectorType &, const VectorType &)>
vmult;
2326 std::function<void(VectorType &, const VectorType &)>
Tvmult;
2335 std::function<void(VectorType &, const VectorType &)>
inv_vmult;
2344 std::function<void(VectorType &, const VectorType &)>
inv_Tvmult;
2428 virtual const char *
2438 virtual const Epetra_Comm &
2448 virtual const Epetra_Map &
2459 virtual const Epetra_Map &
2475 #ifdef DEAL_II_WITH_MPI 2547 visit_present_row ();
2552 AccessorBase::size_type
2553 AccessorBase::row()
const 2561 AccessorBase::size_type
2562 AccessorBase::column()
const 2565 return (*colnum_cache)[a_index];
2570 AccessorBase::size_type
2571 AccessorBase::index()
const 2579 Accessor<true>::Accessor (MatrixType *matrix,
2580 const size_type row,
2581 const size_type index)
2587 template <
bool Other>
2589 Accessor<true>::Accessor(
const Accessor<Other> &other)
2597 Accessor<true>::value()
const 2600 return (*value_cache)[a_index];
2605 Accessor<false>::Reference::Reference (
2606 const Accessor<false> &acc)
2608 accessor(const_cast<Accessor<false>&>(acc))
2613 Accessor<false>::Reference::operator TrilinosScalar ()
const 2615 return (*accessor.value_cache)[accessor.a_index];
2619 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(), accessor.column(),
2624 static_cast<TrilinosScalar
>(*this));
2630 const Accessor<false>::Reference &
2631 Accessor<false>::Reference::operator += (
const TrilinosScalar n)
const 2633 (*accessor.value_cache)[accessor.a_index] += n;
2634 accessor.matrix->set(accessor.row(), accessor.column(),
2635 static_cast<TrilinosScalar
>(*this));
2641 const Accessor<false>::Reference &
2642 Accessor<false>::Reference::operator -= (
const TrilinosScalar n)
const 2644 (*accessor.value_cache)[accessor.a_index] -= n;
2645 accessor.matrix->set(accessor.row(), accessor.column(),
2646 static_cast<TrilinosScalar
>(*this));
2652 const Accessor<false>::Reference &
2653 Accessor<false>::Reference::operator *= (
const TrilinosScalar n)
const 2655 (*accessor.value_cache)[accessor.a_index] *= n;
2656 accessor.matrix->set(accessor.row(), accessor.column(),
2657 static_cast<TrilinosScalar
>(*this));
2663 const Accessor<false>::Reference &
2664 Accessor<false>::Reference::operator /= (
const TrilinosScalar n)
const 2666 (*accessor.value_cache)[accessor.a_index] /= n;
2667 accessor.matrix->set(accessor.row(), accessor.column(),
2668 static_cast<TrilinosScalar
>(*this));
2674 Accessor<false>::Accessor (MatrixType *matrix,
2675 const size_type row,
2676 const size_type index)
2678 AccessorBase(
matrix, row, index)
2683 Accessor<false>::Reference
2684 Accessor<false>::value()
const 2687 return Reference(*
this);
2692 template <
bool Constness>
2694 Iterator<Constness>::Iterator(MatrixType *matrix,
2695 const size_type row,
2696 const size_type index)
2698 accessor(
matrix, row, index)
2702 template <
bool Constness>
2703 template <
bool Other>
2705 Iterator<Constness>::Iterator(
const Iterator<Other> &other)
2707 accessor(other.accessor)
2711 template <
bool Constness>
2713 Iterator<Constness> &
2714 Iterator<Constness>::operator++ ()
2724 if (accessor.a_index >= accessor.colnum_cache->size())
2726 accessor.a_index = 0;
2729 while ((accessor.a_row < accessor.matrix->m())
2731 ((accessor.matrix->in_local_range (accessor.a_row) ==
false)
2733 (accessor.matrix->row_length(accessor.a_row) == 0)))
2736 accessor.visit_present_row();
2742 template <
bool Constness>
2745 Iterator<Constness>::operator++ (
int)
2747 const Iterator<Constness> old_state = *
this;
2754 template <
bool Constness>
2756 const Accessor<Constness> &
2764 template <
bool Constness>
2766 const Accessor<Constness> *
2767 Iterator<Constness>::operator-> ()
const 2774 template <
bool Constness>
2777 Iterator<Constness>::operator == (
const Iterator<Constness> &other)
const 2779 return (accessor.a_row == other.accessor.a_row &&
2780 accessor.a_index == other.accessor.a_index);
2785 template <
bool Constness>
2788 Iterator<Constness>::operator != (
const Iterator<Constness> &other)
const 2790 return ! (*
this == other);
2795 template <
bool Constness>
2798 Iterator<Constness>::operator < (
const Iterator<Constness> &other)
const 2800 return (accessor.row() < other.accessor.row() ||
2801 (accessor.row() == other.accessor.row() &&
2802 accessor.index() < other.accessor.index()));
2806 template <
bool Constness>
2809 Iterator<Constness>::operator > (
const Iterator<Constness> &other)
const 2811 return (other < *
this);
2831 return const_iterator(
this, m(), 0);
2841 if (in_local_range (r)
2843 (row_length(r) > 0))
2844 return const_iterator(
this, r, 0);
2860 for (size_type i=r+1; i<m(); ++i)
2861 if (in_local_range (i)
2863 (row_length(i) > 0))
2864 return const_iterator(
this, i, 0);
2886 return iterator(
this, m(), 0);
2896 if (in_local_range (r)
2898 (row_length(r) > 0))
2899 return iterator(
this, r, 0);
2915 for (size_type i=r+1; i<m(); ++i)
2916 if (in_local_range (i)
2918 (row_length(i) > 0))
2919 return iterator(
this, i, 0);
2932 TrilinosWrappers::types::int_type begin, end;
2933 #ifndef DEAL_II_WITH_64BIT_INDICES 2934 begin =
matrix->RowMap().MinMyGID();
2935 end =
matrix->RowMap().MaxMyGID()+1;
2937 begin =
matrix->RowMap().MinMyGID64();
2938 end =
matrix->RowMap().MaxMyGID64()+1;
2941 return ((index >= static_cast<size_type>(begin)) &&
2942 (index < static_cast<size_type>(end)));
2963 const TrilinosScalar value)
2968 set (i, 1, &j, &value,
false);
2977 const bool elide_zero_values)
2979 Assert (indices.size() == values.
m(),
2983 for (size_type i=0; i<indices.size(); ++i)
2984 set (indices[i], indices.size(), indices.data(), &values(i,0),
2994 const TrilinosScalar value)
3006 if (last_action == Insert)
3009 ierr =
matrix->GlobalAssemble(*column_space_map,
3010 matrix->RowMap(),
false);
3021 add (i, 1, &j, &value,
false);
3032 #ifndef DEAL_II_WITH_64BIT_INDICES 3033 return matrix->NumGlobalRows();
3035 return matrix->NumGlobalRows64();
3049 #ifndef DEAL_II_WITH_64BIT_INDICES 3050 return column_space_map->NumGlobalElements();
3052 return column_space_map->NumGlobalElements64();
3062 return matrix -> NumMyRows();
3068 std::pair<SparseMatrix::size_type, SparseMatrix::size_type>
3072 #ifndef DEAL_II_WITH_64BIT_INDICES 3073 begin =
matrix->RowMap().MinMyGID();
3074 end =
matrix->RowMap().MaxMyGID()+1;
3076 begin =
matrix->RowMap().MinMyGID64();
3077 end =
matrix->RowMap().MaxMyGID64()+1;
3080 return std::make_pair (begin, end);
3089 #ifndef DEAL_II_WITH_64BIT_INDICES 3090 return matrix->NumGlobalNonzeros();
3092 return matrix->NumGlobalNonzeros64();
3098 template <
typename SparsityPatternType>
3101 const SparsityPatternType &sparsity_pattern,
3102 const MPI_Comm &communicator,
3103 const bool exchange_data)
3105 reinit (parallel_partitioning, parallel_partitioning,
3106 sparsity_pattern, communicator, exchange_data);
3111 template <
typename number>
3114 const ::SparseMatrix<number> &sparse_matrix,
3115 const MPI_Comm &communicator,
3116 const double drop_tolerance,
3117 const bool copy_values,
3118 const ::SparsityPattern *use_this_sparsity)
3121 reinit (parallel_partitioning, parallel_partitioning, sparse_matrix,
3122 drop_tolerance, copy_values, use_this_sparsity);
3128 const Epetra_CrsMatrix &
3131 return static_cast<const Epetra_CrsMatrix &
>(*matrix);
3137 const Epetra_CrsGraph &
3182 namespace LinearOperatorImplementation
3184 template <
typename Solver,
typename Preconditioner>
3185 typename std::enable_if<
3186 std::is_base_of<TrilinosWrappers::SolverBase,Solver>::value &&
3187 std::is_base_of<TrilinosWrappers::PreconditionBase,Preconditioner>::value,
3188 TrilinosPayload>::type
3189 TrilinosPayload::inverse_payload (
3191 const Preconditioner &preconditioner)
const 3193 const auto &payload = *
this;
3195 TrilinosPayload return_op(payload);
3199 return_op.inv_vmult = [payload,&solver,&preconditioner](
3200 TrilinosPayload::Domain &tril_dst,
const TrilinosPayload::Range &tril_src
3206 internal::check_vector_map_equality(payload,
3208 !payload.UseTranspose());
3209 solver.solve(payload, tril_dst, tril_src, preconditioner);
3212 return_op.inv_Tvmult = [payload,&solver,&preconditioner](
3213 TrilinosPayload::Range &tril_dst,
const TrilinosPayload::Domain &tril_src
3219 internal::check_vector_map_equality(payload,
3221 payload.UseTranspose());
3223 const_cast<TrilinosPayload &
>(payload).
transpose();
3224 solver.solve(payload, tril_dst, tril_src, preconditioner);
3225 const_cast<TrilinosPayload &
>(payload).
transpose();
3230 if (return_op.UseTranspose() ==
true)
3232 return_op.inv_Tvmult);
3237 template <
typename Solver,
typename Preconditioner>
3238 typename std::enable_if<
3239 !(std::is_base_of<TrilinosWrappers::SolverBase,Solver>::value &&
3240 std::is_base_of<TrilinosWrappers::PreconditionBase,Preconditioner>::value),
3241 TrilinosPayload>::type
3242 TrilinosPayload::inverse_payload (
3244 const Preconditioner &)
const 3246 TrilinosPayload return_op(*
this);
3248 return_op.inv_vmult = [](TrilinosPayload::Domain &,
3249 const TrilinosPayload::Range &)
3252 ExcMessage(
"Payload inv_vmult disabled because of " 3253 "incompatible solver/preconditioner choice."));
3256 return_op.inv_Tvmult = [](TrilinosPayload::Range &,
3257 const TrilinosPayload::Domain &)
3260 ExcMessage(
"Payload inv_vmult disabled because of " 3261 "incompatible solver/preconditioner choice."));
3274 DEAL_II_NAMESPACE_CLOSE
3277 #endif // DEAL_II_WITH_TRILINOS static const bool zero_addition_can_be_elided
TrilinosScalar diag_element(const size_type i) const
static ::ExceptionBase & ExcTrilinosError(int arg1)
TrilinosScalar el(const size_type i, const size_type j) const
types::global_dof_index size_type
virtual bool UseTranspose() const
const_iterator end() const
const Epetra_Map & col_partitioner() const
bool operator>(const Iterator< Constness > &) const
TrilinosScalar frobenius_norm() const
void mmult(SparseMatrix &C, const SparseMatrix &B, const MPI::Vector &V=MPI::Vector()) const
#define DeclException2(Exception2, type1, type2, outsequence)
TrilinosPayload null_payload() const
SparseMatrixIterators::Iterator< false > iterator
Contents is actually a matrix.
::types::global_dof_index size_type
static ::ExceptionBase & ExcSourceEqualsDestination()
static ::ExceptionBase & ExcBeyondEndOfMatrix()
bool operator==(const Iterator< Constness > &) const
void clear_row(const size_type row, const TrilinosScalar new_diag_value=0)
const Epetra_Map & range_partitioner() const
void vmult_add(VectorType &dst, const VectorType &src) const
std::function< void(VectorType &, const VectorType &)> inv_Tvmult
virtual double NormInf() const
Epetra_CombineMode last_action
std::enable_if< std::is_base_of< TrilinosWrappers::SolverBase, Solver >::value &&std::is_base_of< TrilinosWrappers::PreconditionBase, Preconditioner >::value, TrilinosPayload >::type inverse_payload(Solver &, const Preconditioner &) const
bool is_compressed() const
::types::global_dof_index size_type
TrilinosScalar operator()(const size_type i, const size_type j) const
std::function< void(VectorType &, const VectorType &)> Tvmult
virtual int ApplyInverse(const VectorType &Y, VectorType &X) const
static ::ExceptionBase & ExcInvalidIndex(size_type arg1, size_type arg2)
static ::ExceptionBase & ExcAccessToNonlocalRow(std::size_t arg1, std::size_t arg2, std::size_t arg3)
const Epetra_Map & row_partitioner() const
#define AssertThrow(cond, exc)
static ::ExceptionBase & ExcAccessToNonPresentElement(size_type arg1, size_type arg2)
SymmetricTensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+(const SymmetricTensor< rank_, dim, Number > &left, const SymmetricTensor< rank_, dim, OtherNumber > &right)
TrilinosScalar residual(MPI::Vector &dst, const MPI::Vector &x, const MPI::Vector &b) const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcTrilinosError(int arg1)
SymmetricTensor< rank_, dim, Number > operator*(const SymmetricTensor< rank_, dim, Number > &t, const Number &factor)
TrilinosScalar matrix_scalar_product(const MPI::Vector &u, const MPI::Vector &v) const
void clear_rows(const std::vector< size_type > &rows, const TrilinosScalar new_diag_value=0)
void Tvmult(VectorType &dst, const VectorType &src) const
virtual ~TrilinosPayload()=default
Epetra_Map make_trilinos_map(const MPI_Comm &communicator=MPI_COMM_WORLD, const bool overlapping=false) const
std::shared_ptr< std::vector< size_type > > colnum_cache
SparseMatrix & operator*=(const TrilinosScalar factor)
std::unique_ptr< Epetra_FECrsMatrix > matrix
SparseMatrix & operator=(const SparseMatrix &)=delete
TrilinosPayload transpose_payload() const
bool in_local_range(const size_type index) const
static ::ExceptionBase & ExcMessage(std::string arg1)
const Accessor< Constness > & operator*() const
TrilinosPayload identity_payload() const
#define DeclException1(Exception1, type1, outsequence)
void add(const size_type i, const size_type j, const TrilinosScalar value)
virtual bool HasNormInf() const
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
std::unique_ptr< Epetra_Export > nonlocal_matrix_exporter
size_type memory_consumption() const
#define DeclExceptionMsg(Exception, defaulttext)
void print(std::ostream &out, const bool write_extended_trilinos_info=false) const
bool operator!=(const Iterator< Constness > &) const
Epetra_MpiComm communicator
#define DeclException0(Exception0)
std::function< void(VectorType &, const VectorType &)> inv_vmult
virtual ~SparseMatrix()=default
TrilinosScalar matrix_norm_square(const MPI::Vector &v) const
const Accessor< Constness > * operator->() const
IndexSet locally_owned_range_indices() const
const Epetra_CrsMatrix & trilinos_matrix() const
SymmetricTensor< rank_, dim, Number > transpose(const SymmetricTensor< rank_, dim, Number > &t)
AccessorBase(SparseMatrix *matrix, const size_type row, const size_type index)
static ::ExceptionBase & ExcInvalidIndexWithinRow(size_type arg1, size_type arg2)
virtual int SetUseTranspose(bool UseTranspose)
void vmult(VectorType &dst, const VectorType &src) const
const SparseMatrix MatrixType
Epetra_MultiVector VectorType
IndexSet locally_owned_range_indices() const
size_type n_nonzero_elements() const
MPI_Comm get_mpi_communicator() const
static ::ExceptionBase & ExcIteratorPastEnd()
const_iterator begin() const
static ::ExceptionBase & ExcNotQuadratic()
void swap(Vector< Number > &u, Vector< Number > &v)
unsigned int row_length(const size_type row) const
Accessor< Constness > accessor
void Tvmult_add(VectorType &dst, const VectorType &src) const
SparseMatrixIterators::Iterator< true > const_iterator
virtual int Apply(const VectorType &X, VectorType &Y) const
virtual const Epetra_Map & OperatorDomainMap() const
types::global_dof_index size_type
void reinit(const SparsityPatternType &sparsity_pattern)
TrilinosScalar linfty_norm() const
Iterator< Constness > & operator++()
void copy_from(const SparseMatrix &source)
const Epetra_Map & domain_partitioner() const
std::function< void(VectorType &, const VectorType &)> vmult
SparseMatrix & operator/=(const TrilinosScalar factor)
::types::global_dof_index size_type
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Accessor< Constness >::MatrixType MatrixType
std::pair< size_type, size_type > local_range() const
IndexSet locally_owned_domain_indices() const
virtual const Epetra_Comm & Comm() const
static ::ExceptionBase & ExcMatrixNotCompressed()
IndexSet locally_owned_domain_indices() const
const Epetra_CrsGraph & trilinos_sparsity_pattern() const
void Tmmult(SparseMatrix &C, const SparseMatrix &B, const MPI::Vector &V=MPI::Vector()) const
#define DeclException3(Exception3, type1, type2, type3, outsequence)
TrilinosScalar value() const
std::unique_ptr< Epetra_Map > column_space_map
void compress(::VectorOperation::values operation)
static ::ExceptionBase & ExcAccessToNonLocalElement(size_type arg1, size_type arg2, size_type arg3, size_type arg4)
TrilinosScalar value_type
std::unique_ptr< Epetra_CrsMatrix > nonlocal_matrix
MPI_Comm get_mpi_communicator() const
void set(const size_type i, const size_type j, const TrilinosScalar value)
#define AssertIsFinite(number)
unsigned int local_size() const
virtual const char * Label() const
TrilinosScalar l1_norm() const
static ::ExceptionBase & ExcInternalError()
virtual const Epetra_Map & OperatorRangeMap() const
std::shared_ptr< std::vector< TrilinosScalar > > value_cache