16 #include <deal.II/lac/trilinos_block_sparse_matrix.h> 18 #ifdef DEAL_II_WITH_TRILINOS 20 # include <deal.II/lac/block_sparse_matrix.h> 21 # include <deal.II/lac/block_sparsity_pattern.h> 23 DEAL_II_NAMESPACE_OPEN
43 reinit (
const size_type n_block_rows,
44 const size_type n_block_columns)
56 this->column_block_indices.
reinit (n_block_columns, 0);
72 template <
typename BlockSparsityPatternType>
75 reinit (
const std::vector<Epetra_Map> ¶llel_partitioning,
76 const BlockSparsityPatternType &block_sparsity_pattern,
77 const bool exchange_data)
79 Assert (parallel_partitioning.size() == block_sparsity_pattern.n_block_rows(),
81 block_sparsity_pattern.n_block_rows()));
82 Assert (parallel_partitioning.size() == block_sparsity_pattern.n_block_cols(),
84 block_sparsity_pattern.n_block_cols()));
86 const size_type
n_block_rows = parallel_partitioning.size();
91 block_sparsity_pattern.n_block_rows()));
94 block_sparsity_pattern.n_block_cols()));
98 reinit (block_sparsity_pattern.n_block_rows(),
99 block_sparsity_pattern.n_block_cols());
103 this->column_block_indices = block_sparsity_pattern.get_column_indices();
111 parallel_partitioning[c],
112 block_sparsity_pattern.block(r,c),
119 template <
typename BlockSparsityPatternType>
122 reinit (
const std::vector<IndexSet> ¶llel_partitioning,
123 const BlockSparsityPatternType &block_sparsity_pattern,
124 const MPI_Comm &communicator,
125 const bool exchange_data)
127 std::vector<Epetra_Map> epetra_maps;
128 for (size_type i=0; i<block_sparsity_pattern.n_block_rows(); ++i)
129 epetra_maps.push_back
130 (parallel_partitioning[i].make_trilinos_map(communicator,
false));
132 reinit (epetra_maps, block_sparsity_pattern, exchange_data);
138 template <
typename BlockSparsityPatternType>
141 reinit (
const BlockSparsityPatternType &block_sparsity_pattern)
143 std::vector<Epetra_Map> parallel_partitioning;
144 for (size_type i=0; i<block_sparsity_pattern.n_block_rows(); ++i)
145 parallel_partitioning.emplace_back
146 (static_cast<TrilinosWrappers::types::int_type>(block_sparsity_pattern.block(i,0).n_rows()),
150 reinit (parallel_partitioning, block_sparsity_pattern);
182 reinit (
const std::vector<Epetra_Map> ¶llel_partitioning,
183 const ::BlockSparseMatrix<double> &dealii_block_sparse_matrix,
184 const double drop_tolerance)
186 const size_type
n_block_rows = parallel_partitioning.size();
190 dealii_block_sparse_matrix.n_block_rows()));
193 dealii_block_sparse_matrix.n_block_cols()));
204 parallel_partitioning[c],
205 dealii_block_sparse_matrix.block(r,c),
216 reinit (const ::BlockSparseMatrix<double> &dealii_block_sparse_matrix,
217 const double drop_tolerance)
219 Assert (dealii_block_sparse_matrix.n_block_rows() ==
220 dealii_block_sparse_matrix.n_block_cols(),
222 dealii_block_sparse_matrix.n_block_cols()));
223 Assert (dealii_block_sparse_matrix.m() ==
224 dealii_block_sparse_matrix.n(),
226 dealii_block_sparse_matrix.n()));
230 #ifdef DEAL_II_WITH_MPI 231 Epetra_MpiComm trilinos_communicator (MPI_COMM_SELF);
233 Epetra_SerialComm trilinos_communicator;
236 std::vector<Epetra_Map> parallel_partitioning;
237 for (size_type i=0; i<dealii_block_sparse_matrix.n_block_rows(); ++i)
238 parallel_partitioning.emplace_back
239 (static_cast<TrilinosWrappers::types::int_type>(dealii_block_sparse_matrix.block(i,0).m()),
241 trilinos_communicator);
243 reinit (parallel_partitioning, dealii_block_sparse_matrix, drop_tolerance);
259 BlockSparseMatrix::size_type
262 size_type n_nonzero = 0;
263 for (size_type rows = 0; rows<this->
n_block_rows(); ++rows)
264 for (size_type cols = 0; cols<this->
n_block_cols(); ++cols)
332 std::vector<Epetra_Map>
347 std::vector<Epetra_Map>
367 return this->
sub_objects[0][0]->get_mpi_communicator();
381 const ::BlockSparsityPattern &,
385 const ::BlockDynamicSparsityPattern &,
390 const ::BlockDynamicSparsityPattern &,
397 DEAL_II_NAMESPACE_CLOSE
std::vector< Epetra_Map > range_partitioner() const
real_type l2_norm() const
real_type l2_norm() const
size_type n_block_cols() const
size_type n_block_rows() const
static ::ExceptionBase & ExcNotInitialized()
const Epetra_Comm & comm_self()
SparsityPatternType & block(const size_type row, const size_type column)
std::size_t n_nonzero_elements() const
unsigned int n_block_cols() const
std::vector< Epetra_Map > domain_partitioner() const
void vmult(VectorType1 &dst, const VectorType2 &src) const
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void reinit(const unsigned int n_blocks, const size_type n_elements_per_block)
void reinit(const size_type n_block_rows, const size_type n_block_columns)
const BlockIndices & get_row_indices() const
MPI_Comm get_mpi_communicator() const
BaseClass::BlockType BlockType
BlockType & block(const unsigned int row, const unsigned int column)
Table< 2, SmartPointer< BlockType, BlockMatrixBase< SparseMatrix > > > sub_objects
size_type n_nonzero_elements() const
BlockIndices row_block_indices
unsigned int n_block_rows() const
const BlockIndices & get_column_indices() const
TrilinosScalar residual(MPI::BlockVector &dst, const MPI::BlockVector &x, const MPI::BlockVector &b) const
static ::ExceptionBase & ExcInternalError()