17 #include <deal.II/lac/block_matrix_array.h> 18 #include <deal.II/lac/vector.h> 19 #include <deal.II/lac/block_vector.h> 20 #include <deal.II/lac/trilinos_block_vector.h> 21 #include <deal.II/lac/trilinos_parallel_block_vector.h> 23 #include <deal.II/lac/petsc_block_vector.h> 24 #include <deal.II/lac/petsc_parallel_block_vector.h> 26 DEAL_II_NAMESPACE_OPEN
29 template <
typename number,
typename BlockVectorType>
44 template <
typename number,
typename BlockVectorType>
52 template <
typename number,
typename BlockVectorType>
60 template <
typename number,
typename BlockVectorType>
69 template <
typename number,
typename BlockVectorType>
72 (
const unsigned int n_block_rows,
73 const unsigned int n_block_cols)
81 template <
typename number,
typename BlockVectorType>
84 (
const unsigned int n_block_rows,
85 const unsigned int n_block_cols)
94 template <
typename number,
typename BlockVectorType>
102 template <
typename number,
typename BlockVectorType>
105 const BlockVectorType &src)
const 114 typename BlockVectorType::BlockType &aux = *p_aux;
116 typename std::vector<Entry>::const_iterator m =
entries.begin();
117 typename std::vector<Entry>::const_iterator end =
entries.end();
119 for (; m != end ; ++m)
121 aux.reinit(dst.block(m->row));
123 m->matrix->Tvmult(aux, src.block(m->col));
125 m->matrix->vmult(aux, src.block(m->col));
126 dst.block(m->row).add (m->prefix, aux);
133 template <
typename number,
typename BlockVectorType>
136 const BlockVectorType &src)
const 145 template <
typename number,
typename BlockVectorType>
148 const BlockVectorType &src)
const 156 typename std::vector<Entry>::const_iterator m =
entries.begin();
157 typename std::vector<Entry>::const_iterator end =
entries.end();
160 typename BlockVectorType::BlockType &aux = *p_aux;
162 for (; m != end ; ++m)
164 aux.reinit(dst.block(m->col));
166 m->matrix->vmult(aux, src.block(m->row));
168 m->matrix->Tvmult(aux, src.block(m->row));
169 dst.block(m->col).add (m->prefix, aux);
175 template <
typename number,
typename BlockVectorType>
178 const BlockVectorType &src)
const 187 template <
typename number,
typename BlockVectorType>
190 (
const BlockVectorType &u,
191 const BlockVectorType &v)
const 200 typename BlockVectorType::BlockType &aux = *p_aux;
202 typename std::vector<Entry>::const_iterator m;
203 typename std::vector<Entry>::const_iterator end =
entries.end();
209 aux.reinit(u.block(i));
210 for (m =
entries.begin(); m != end ; ++m)
215 m->matrix->Tvmult_add(aux, v.block(m->col));
217 m->matrix->vmult(aux, v.block(m->col));
219 result += u.block(i)*aux;
227 template <
typename number,
typename BlockVectorType>
230 (
const BlockVectorType &u)
const 237 template <
typename number,
typename BlockVectorType>
246 template <
typename number,
typename BlockVectorType>
257 template <
typename number,
typename BlockVectorType>
264 template <
typename number,
typename BlockVectorType>
273 template <
typename number,
typename BlockVectorType>
276 (
const unsigned int n)
282 template <
typename number,
typename BlockVectorType>
285 (BlockVectorType &dst,
289 typename std::vector<typename BlockMatrixArray<number,BlockVectorType>::Entry>::const_iterator
291 typename std::vector<typename BlockMatrixArray<number,BlockVectorType>::Entry>::const_iterator
293 std::vector<typename std::vector<typename BlockMatrixArray<number,BlockVectorType>::Entry>::const_iterator>
297 typename BlockVectorType::BlockType &aux = *p_aux;
299 aux.reinit(dst.block(row_num),
true);
303 for (; m != end ; ++m)
318 diagonals.push_back(m);
323 m->matrix->Tvmult(aux, dst.block(j));
325 m->matrix->vmult(aux, dst.block(j));
326 dst.block(i).add (-1.0 * m->prefix, aux);
334 if (diagonals.size() == 1)
336 if (diagonals[0]->transpose)
337 diagonals[0]->matrix->Tvmult(aux, dst.block(row_num));
339 diagonals[0]->matrix->vmult(aux, dst.block(row_num));
340 dst.block(row_num).equ (diagonals[0]->prefix, aux);
345 for (
size_type i=0; i<diagonals.size(); ++i)
353 m->matrix->Tvmult_add(aux, dst.block(row_num));
355 m->matrix->vmult_add(aux, dst.block(row_num));
358 dst.block(row_num) = aux;
364 template <
typename number,
typename BlockVectorType>
367 (BlockVectorType &dst,
368 const BlockVectorType &src)
const 383 template <
typename number,
typename BlockVectorType>
386 (BlockVectorType &dst,
387 const BlockVectorType &src)
const 409 template <
typename number,
typename BlockVectorType>
413 const BlockVectorType &)
const 419 template <
typename number,
typename BlockVectorType>
423 const BlockVectorType &)
const 433 #ifdef DEAL_II_WITH_TRILINOS 440 #ifdef DEAL_II_WITH_PETSC 441 #ifdef PETSC_USE_COMPLEX 454 DEAL_II_NAMESPACE_CLOSE
void vmult(BlockVectorType &dst, const BlockVectorType &src) const
number matrix_scalar_product(const BlockVectorType &u, const BlockVectorType &v) const
unsigned int n_block_cols() const
std::vector< Entry > entries
types::global_dof_index size_type
void Tvmult_add(BlockVectorType &dst, const BlockVectorType &src) const
void Tvmult(BlockVectorType &dst, const BlockVectorType &src) const
void vmult_add(BlockVectorType &dst, const BlockVectorType &src) const
void initialize(const unsigned int n_block_rows, const unsigned int n_block_cols)
#define Assert(cond, exc)
static::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void do_row(BlockVectorType &dst, size_type row_num) const
void vmult_add(BlockVectorType &dst, const BlockVectorType &src) const
unsigned int n_block_rows() const
Entry(const MatrixType &matrix, size_type row, size_type col, number prefix, bool transpose)
void reinit(const unsigned int n_block_rows, const unsigned int n_block_cols)
BlockTrianglePrecondition()
void vmult(BlockVectorType &dst, const BlockVectorType &src) const
number matrix_norm_square(const BlockVectorType &u) const
static::ExceptionBase & ExcNoDiagonal(size_type arg1)
PointerMatrixBase< typename BlockVectorType::BlockType > * matrix
static::ExceptionBase & ExcNotImplemented()
void Tvmult(BlockVectorType &dst, const BlockVectorType &src) const
void reinit(const unsigned int n_block_rows)
void Tvmult_add(BlockVectorType &dst, const BlockVectorType &src) const