16 #ifndef dealii_trilinos_block_sparse_matrix_h 17 #define dealii_trilinos_block_sparse_matrix_h 20 #include <deal.II/base/config.h> 22 #ifdef DEAL_II_WITH_TRILINOS 24 # include <deal.II/base/table.h> 25 # include <deal.II/base/template_constraints.h> 26 # include <deal.II/lac/block_matrix_base.h> 27 # include <deal.II/lac/trilinos_sparse_matrix.h> 28 # include <deal.II/lac/trilinos_parallel_block_vector.h> 29 # include <deal.II/lac/full_matrix.h> 30 # include <deal.II/lac/exceptions.h> 34 DEAL_II_NAMESPACE_OPEN
88 typedef BaseClass::pointer pointer;
89 typedef BaseClass::const_pointer const_pointer;
90 typedef BaseClass::reference reference;
91 typedef BaseClass::const_reference const_reference;
92 typedef BaseClass::size_type size_type;
147 const size_type n_block_columns);
154 template <
typename BlockSparsityPatternType>
155 void reinit (
const std::vector<Epetra_Map> &input_maps,
156 const BlockSparsityPatternType &block_sparsity_pattern,
157 const bool exchange_data =
false);
164 template <
typename BlockSparsityPatternType>
165 void reinit (
const std::vector<IndexSet> &input_maps,
166 const BlockSparsityPatternType &block_sparsity_pattern,
167 const MPI_Comm &communicator = MPI_COMM_WORLD,
168 const bool exchange_data =
false);
175 template <
typename BlockSparsityPatternType>
176 void reinit (
const BlockSparsityPatternType &block_sparsity_pattern);
187 void reinit (
const std::vector<Epetra_Map> &input_maps,
188 const ::BlockSparseMatrix<double> &deal_ii_sparse_matrix,
189 const double drop_tolerance=1e-13);
198 void reinit (const ::BlockSparseMatrix<double> &deal_ii_sparse_matrix,
199 const double drop_tolerance=1e-13);
277 template <
typename VectorType1,
typename VectorType2>
278 void vmult (VectorType1 &dst,
279 const VectorType2 &src)
const;
286 template <
typename VectorType1,
typename VectorType2>
287 void Tvmult (VectorType1 &dst,
288 const VectorType2 &src)
const;
355 <<
"The blocks [" << arg1 <<
',' << arg2 <<
"] and [" 356 << arg3 <<
',' << arg4 <<
"] have differing row numbers.");
363 <<
"The blocks [" << arg1 <<
',' << arg2 <<
"] and [" 364 << arg3 <<
',' << arg4 <<
"] have differing column numbers.");
371 template <
typename VectorType1,
typename VectorType2>
372 void vmult (VectorType1 &dst,
373 const VectorType2 &src,
375 const std::integral_constant<bool, true>,
376 const std::integral_constant<bool, true>)
const;
382 template <
typename VectorType1,
typename VectorType2>
383 void vmult (VectorType1 &dst,
384 const VectorType2 &src,
386 const std::integral_constant<bool, false>,
387 const std::integral_constant<bool, true>)
const;
393 template <
typename VectorType1,
typename VectorType2>
394 void vmult (VectorType1 &dst,
395 const VectorType2 &src,
397 const std::integral_constant<bool, true>,
398 const std::integral_constant<bool, false>)
const;
405 template <
typename VectorType1,
typename VectorType2>
406 void vmult (VectorType1 &dst,
407 const VectorType2 &src,
409 const std::integral_constant<bool, false>,
410 const std::integral_constant<bool, false>)
const;
429 this->
block(r,c) = d;
440 bool compressed =
true;
443 if (
block(row, col).is_compressed() ==
false)
454 template <
typename VectorType1,
typename VectorType2>
458 const VectorType2 &src)
const 460 vmult(dst, src,
false,
467 template <
typename VectorType1,
typename VectorType2>
471 const VectorType2 &src)
const 473 vmult(dst, src,
true,
480 template <
typename VectorType1,
typename VectorType2>
484 const VectorType2 &src,
486 std::integral_constant<bool, true>,
487 std::integral_constant<bool, true>)
const 498 template <
typename VectorType1,
typename VectorType2>
502 const VectorType2 &src,
504 std::integral_constant<bool, false>,
505 std::integral_constant<bool, true>)
const 515 template <
typename VectorType1,
typename VectorType2>
519 const VectorType2 &src,
521 std::integral_constant<bool, true>,
522 std::integral_constant<bool, false>)
const 532 template <
typename VectorType1,
typename VectorType2>
536 const VectorType2 &src,
538 std::integral_constant<bool, false>,
539 std::integral_constant<bool, false>)
const 550 std::vector<IndexSet>
556 std::vector<IndexSet> domain_indices;
558 domain_indices.push_back(this->sub_objects[0][c]->locally_owned_domain_indices());
560 return domain_indices;
566 std::vector<IndexSet>
572 std::vector<IndexSet> range_indices;
574 range_indices.push_back(this->sub_objects[r][0]->locally_owned_range_indices());
576 return range_indices;
583 namespace BlockLinearOperatorImplementation
601 template <
typename PayloadBlockType>
619 template <
typename... Args>
623 "TrilinosBlockPayload can only accept a payload of type TrilinosPayload.");
634 DEAL_II_NAMESPACE_CLOSE
636 #endif // DEAL_II_WITH_TRILINOS 638 #endif // dealii_trilinos_block_sparse_matrix_h PayloadBlockType BlockType
void vmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
std::vector< Epetra_Map > range_partitioner() const
BlockSparseMatrix()=default
static ::ExceptionBase & ExcIncompatibleRowNumbers(int arg1, int arg2, int arg3, int arg4)
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
BlockMatrixBase< SparseMatrix > BaseClass
TrilinosBlockPayload(const Args &...)
void vmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
static ::ExceptionBase & ExcNotInitialized()
void Tvmult_block_nonblock(BlockVectorType &dst, const VectorType &src) const
void Tvmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
void Tvmult_nonblock_block(VectorType &dst, const BlockVectorType &src) const
void vmult_block_block(BlockVectorType &dst, const BlockVectorType &src) const
void Tvmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
static ::ExceptionBase & ExcIncompatibleColNumbers(int arg1, int arg2, int arg3, int arg4)
unsigned int n_block_cols() const
std::vector< Epetra_Map > domain_partitioner() const
void vmult(VectorType1 &dst, const VectorType2 &src) const
#define Assert(cond, exc)
BaseClass::value_type value_type
void reinit(const size_type n_block_rows, const size_type n_block_columns)
BlockType::value_type value_type
SymmetricTensor< rank_, dim, Number > transpose(const SymmetricTensor< rank_, dim, Number > &t)
bool is_compressed() const
MPI_Comm get_mpi_communicator() const
void Tvmult(VectorType1 &dst, const VectorType2 &src) const
BaseClass::BlockType BlockType
void vmult_nonblock_nonblock(VectorType &dst, const VectorType &src) const
BlockType & block(const unsigned int row, const unsigned int column)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
size_type n_nonzero_elements() const
unsigned int n_block_rows() const
std::vector< IndexSet > locally_owned_range_indices() const
TrilinosScalar residual(MPI::BlockVector &dst, const MPI::BlockVector &x, const MPI::BlockVector &b) const
BlockSparseMatrix & operator=(const BlockSparseMatrix &)=default
std::vector< IndexSet > locally_owned_domain_indices() const