16 #ifndef dealii_precondition_block_h 17 #define dealii_precondition_block_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 23 #include <deal.II/base/smartpointer.h> 24 #include <deal.II/base/subscriptor.h> 26 #include <deal.II/lac/precondition_block_base.h> 30 DEAL_II_NAMESPACE_OPEN
82 template <
typename MatrixType,
83 typename inverse_type =
typename MatrixType::value_type>
91 using number =
typename MatrixType::value_type;
274 template <
typename number2>
277 const Vector<number2> &prev,
278 const Vector<number2> &src,
279 const bool transpose_diagonal)
const;
292 template <
typename number2>
295 const Vector<number2> &prev,
296 const Vector<number2> &src,
297 const bool transpose_diagonal)
const;
325 <<
"The blocksize " << arg1 <<
" and the size of the matrix " 326 << arg2 <<
" do not match.");
380 template <
typename MatrixType,
381 typename inverse_type =
typename MatrixType::value_type>
390 using number =
typename MatrixType::value_type;
540 template <
typename number2>
542 vmult(Vector<number2> &,
const Vector<number2> &)
const;
547 template <
typename number2>
549 Tvmult(Vector<number2> &,
const Vector<number2> &)
const;
557 template <
typename number2>
559 vmult_add(Vector<number2> &,
const Vector<number2> &)
const;
564 template <
typename number2>
566 Tvmult_add(Vector<number2> &,
const Vector<number2> &)
const;
571 template <
typename number2>
573 step(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
578 template <
typename number2>
580 Tstep(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
614 template <
typename number2>
616 do_vmult(Vector<number2> &,
const Vector<number2> &,
bool adding)
const;
618 friend class Accessor;
659 template <
typename MatrixType,
660 typename inverse_type =
typename MatrixType::value_type>
679 using number =
typename MatrixType::value_type;
705 template <
typename number2>
707 vmult(Vector<number2> &,
const Vector<number2> &)
const;
719 template <
typename number2>
721 vmult_add(Vector<number2> &,
const Vector<number2> &)
const;
731 template <
typename number2>
733 Tvmult(Vector<number2> &,
const Vector<number2> &)
const;
745 template <
typename number2>
747 Tvmult_add(Vector<number2> &,
const Vector<number2> &)
const;
752 template <
typename number2>
754 step(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
759 template <
typename number2>
761 Tstep(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
778 template <
typename number2>
781 const Vector<number2> &,
782 const bool transpose_diagonal,
783 const bool adding)
const;
794 template <
typename number2>
797 const Vector<number2> &,
798 const bool transpose_diagonal,
799 const bool adding)
const;
824 template <
typename MatrixType,
825 typename inverse_type =
typename MatrixType::value_type>
839 using number =
typename MatrixType::value_type;
875 template <
typename number2>
877 vmult(Vector<number2> &,
const Vector<number2> &)
const;
882 template <
typename number2>
884 Tvmult(Vector<number2> &,
const Vector<number2> &)
const;
889 template <
typename number2>
891 step(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
896 template <
typename number2>
898 Tstep(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
906 template <
typename MatrixType,
typename inverse_type>
916 template <
typename MatrixType,
typename inverse_type>
920 const size_type bs = blocksize;
921 const unsigned int nb = i / bs;
925 const size_type ib = i % bs;
926 const size_type jb = j % bs;
928 if (jb + nb * bs != j)
938 template <
typename MatrixType,
typename inverse_type>
944 , b_iterator(&
matrix->inverse(0), 0, 0)
945 , b_end(&
matrix->inverse(0), 0, 0)
947 bs =
matrix->block_size();
952 if (a_block ==
matrix->size())
957 b_iterator =
matrix->inverse(a_block).begin(r);
958 b_end =
matrix->inverse(a_block).end();
964 template <
typename MatrixType,
typename inverse_type>
967 inverse_type>::const_iterator::Accessor::row()
const 971 return bs * a_block + b_iterator->row();
975 template <
typename MatrixType,
typename inverse_type>
978 inverse_type>::const_iterator::Accessor::column()
const 982 return bs * a_block + b_iterator->column();
986 template <
typename MatrixType,
typename inverse_type>
989 inverse_type>::const_iterator::Accessor::value()
const 993 return b_iterator->value();
997 template <
typename MatrixType,
typename inverse_type>
1001 const size_type row)
1006 template <
typename MatrixType,
typename inverse_type>
1030 template <
typename MatrixType,
typename inverse_type>
1032 const_iterator::Accessor &
1040 template <
typename MatrixType,
typename inverse_type>
1042 const_iterator::Accessor *
1050 template <
typename MatrixType,
typename inverse_type>
1053 operator==(
const const_iterator &other)
const 1055 if (accessor.a_block == accessor.matrix->size() &&
1056 accessor.a_block == other.accessor.a_block)
1059 if (accessor.a_block != other.accessor.a_block)
1062 return (accessor.row() == other.accessor.row() &&
1063 accessor.column() == other.accessor.column());
1067 template <
typename MatrixType,
typename inverse_type>
1070 operator!=(
const const_iterator &other)
const 1072 return !(*
this == other);
1076 template <
typename MatrixType,
typename inverse_type>
1079 operator<(
const const_iterator &other)
const 1081 return (accessor.row() < other.accessor.row() ||
1082 (accessor.row() == other.accessor.row() &&
1083 accessor.column() < other.accessor.column()));
1087 template <
typename MatrixType,
typename inverse_type>
1092 return const_iterator(
this, 0);
1096 template <
typename MatrixType,
typename inverse_type>
1105 template <
typename MatrixType,
typename inverse_type>
1112 return const_iterator(
this, r);
1117 template <
typename MatrixType,
typename inverse_type>
1124 return const_iterator(
this, r + 1);
1129 DEAL_II_NAMESPACE_CLOSE
FullMatrix< inverse_type >::const_iterator b_end
std::size_t memory_consumption() const
void set_permutation(const std::vector< size_type > &permutation, const std::vector< size_type > &inverse_permutation)
const_iterator & operator++()
SmartPointer< const MatrixType, PreconditionBlock< MatrixType, inverse_type > > A
void Tvmult_add(Vector< number2 > &, const Vector< number2 > &) const
inverse_type value() const
#define DeclException2(Exception2, type1, type2, outsequence)
Contents is actually a matrix.
FullMatrix< inverse_type >::const_iterator b_iterator
void Tstep(Vector< number2 > &dst, const Vector< number2 > &rhs) const
AdditionalData(const size_type block_size, const double relaxation=1., const bool invert_diagonal=true, const bool same_diagonal=false)
static ::ExceptionBase & ExcWrongBlockSize(int arg1, int arg2)
void step(Vector< number2 > &dst, const Vector< number2 > &rhs) const
const Accessor * operator->() const
void Tvmult(Vector< number2 > &, const Vector< number2 > &) const
const_iterator end() const
Accessor(const PreconditionBlockJacobi< MatrixType, inverse_type > *matrix, const size_type row)
void backward_step(Vector< number2 > &dst, const Vector< number2 > &prev, const Vector< number2 > &src, const bool transpose_diagonal) const
void initialize(const MatrixType &A, const AdditionalData parameters)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
void Tvmult_add(Vector< number2 > &, const Vector< number2 > &) const
std::vector< size_type > inverse_permutation
const_iterator(const PreconditionBlockJacobi< MatrixType, inverse_type > *matrix, const size_type row)
size_type block_size() const
typename MatrixType::value_type number
static ::ExceptionBase & ExcInverseMatricesAlreadyExist()
void step(Vector< number2 > &dst, const Vector< number2 > &rhs) const
bool operator!=(const const_iterator &) const
bool operator==(const const_iterator &) const
types::global_dof_index size_type
#define Assert(cond, exc)
value_type el(size_type i, size_type j) const
bool store_diagonals() const
void vmult(Vector< number2 > &, const Vector< number2 > &) const
void Tvmult(Vector< number2 > &, const Vector< number2 > &) const
void vmult_add(Vector< number2 > &, const Vector< number2 > &) const
#define DeclException0(Exception0)
types::global_dof_index size_type
PreconditionBlockBase< inverse_type >::Inversion inversion
void vmult_add(Vector< number2 > &, const Vector< number2 > &) const
const_iterator begin() const
PreconditionBlock(bool store_diagonals=false)
void forward_step(Vector< number2 > &dst, const Vector< number2 > &prev, const Vector< number2 > &src, const bool transpose_diagonal) const
void Tvmult(Vector< number2 > &, const Vector< number2 > &) const
static ::ExceptionBase & ExcIteratorPastEnd()
void do_vmult(Vector< number2 > &, const Vector< number2 > &, bool adding) const
void backward(Vector< number2 > &, const Vector< number2 > &, const bool transpose_diagonal, const bool adding) const
unsigned int global_dof_index
void vmult(Vector< number2 > &, const Vector< number2 > &) const
types::global_dof_index size_type
void Tstep(Vector< number2 > &dst, const Vector< number2 > &rhs) const
std::vector< size_type > permutation
void vmult(Vector< number2 > &, const Vector< number2 > &) const
void Tstep(Vector< number2 > &dst, const Vector< number2 > &rhs) const
void step(Vector< number2 > &dst, const Vector< number2 > &rhs) const
const Accessor & operator*() const
unsigned int size() const
void invert_permuted_diagblocks()
const PreconditionBlockJacobi< MatrixType, inverse_type > * matrix
void forward(Vector< number2 > &, const Vector< number2 > &, const bool transpose_diagonal, const bool adding) const
bool operator<(const const_iterator &) const
~PreconditionBlock() override=default