16 #ifndef dealii_precondition_block_h 17 #define dealii_precondition_block_h 82 template <
typename MatrixType,
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;
538 template <
typename number2>
540 vmult(Vector<number2> &,
const Vector<number2> &)
const;
545 template <
typename number2>
547 Tvmult(Vector<number2> &,
const Vector<number2> &)
const;
555 template <
typename number2>
557 vmult_add(Vector<number2> &,
const Vector<number2> &)
const;
562 template <
typename number2>
564 Tvmult_add(Vector<number2> &,
const Vector<number2> &)
const;
569 template <
typename number2>
571 step(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
576 template <
typename number2>
578 Tstep(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
612 template <
typename number2>
614 do_vmult(Vector<number2> &,
const Vector<number2> &,
bool adding)
const;
657 template <
typename MatrixType,
658 typename inverse_type =
typename MatrixType::value_type>
677 using number =
typename MatrixType::value_type;
703 template <
typename number2>
705 vmult(Vector<number2> &,
const Vector<number2> &)
const;
717 template <
typename number2>
719 vmult_add(Vector<number2> &,
const Vector<number2> &)
const;
729 template <
typename number2>
731 Tvmult(Vector<number2> &,
const Vector<number2> &)
const;
743 template <
typename number2>
745 Tvmult_add(Vector<number2> &,
const Vector<number2> &)
const;
750 template <
typename number2>
752 step(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
757 template <
typename number2>
759 Tstep(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
776 template <
typename number2>
778 forward(Vector<number2> &,
779 const Vector<number2> &,
780 const bool transpose_diagonal,
781 const bool adding)
const;
792 template <
typename number2>
794 backward(Vector<number2> &,
795 const Vector<number2> &,
796 const bool transpose_diagonal,
797 const bool adding)
const;
822 template <
typename MatrixType,
823 typename inverse_type =
typename MatrixType::value_type>
837 using number =
typename MatrixType::value_type;
873 template <
typename number2>
875 vmult(Vector<number2> &,
const Vector<number2> &)
const;
880 template <
typename number2>
882 Tvmult(Vector<number2> &,
const Vector<number2> &)
const;
887 template <
typename number2>
889 step(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
894 template <
typename number2>
896 Tstep(Vector<number2> &dst,
const Vector<number2> &rhs)
const;
904 template <
typename MatrixType,
typename inverse_type>
914 template <
typename MatrixType,
typename inverse_type>
919 const unsigned int nb = i / bs;
926 if (jb + nb * bs != j)
936 template <
typename MatrixType,
typename inverse_type>
944 , b_iterator(&matrix->
inverse(0), 0, 0)
945 , b_end(&matrix->
inverse(0), 0, 0)
949 if (a_block == matrix->
size())
961 template <
typename MatrixType,
typename inverse_type>
968 return bs * a_block + b_iterator->row();
972 template <
typename MatrixType,
typename inverse_type>
979 return bs * a_block + b_iterator->column();
983 template <
typename MatrixType,
typename inverse_type>
990 return b_iterator->value();
994 template <
typename MatrixType,
typename inverse_type>
999 : accessor(matrix, row)
1003 template <
typename MatrixType,
typename inverse_type>
1011 ++accessor.b_iterator;
1012 if (accessor.b_iterator == accessor.b_end)
1016 if (accessor.a_block < accessor.matrix->size())
1018 accessor.b_iterator =
1019 accessor.matrix->inverse(accessor.a_block).begin();
1020 accessor.b_end = accessor.matrix->inverse(accessor.a_block).end();
1027 template <
typename MatrixType,
typename inverse_type>
1037 template <
typename MatrixType,
typename inverse_type>
1047 template <
typename MatrixType,
typename inverse_type>
1050 operator==(
const const_iterator &other)
const 1052 if (accessor.a_block == accessor.matrix->size() &&
1053 accessor.a_block == other.accessor.a_block)
1056 if (accessor.a_block != other.accessor.a_block)
1059 return (accessor.row() == other.accessor.row() &&
1060 accessor.column() == other.accessor.column());
1064 template <
typename MatrixType,
typename inverse_type>
1067 operator!=(
const const_iterator &other)
const 1069 return !(*
this == other);
1073 template <
typename MatrixType,
typename inverse_type>
1076 operator<(
const const_iterator &other)
const 1078 return (accessor.row() < other.accessor.row() ||
1079 (accessor.row() == other.accessor.row() &&
1080 accessor.column() < other.accessor.column()));
1084 template <
typename MatrixType,
typename inverse_type>
1089 return const_iterator(
this, 0);
1093 template <
typename MatrixType,
typename inverse_type>
1102 template <
typename MatrixType,
typename inverse_type>
1109 return const_iterator(
this, r);
1114 template <
typename MatrixType,
typename inverse_type>
1121 return const_iterator(
this, r + 1);
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
#define DeclException2(Exception2, type1, type2, outsequence)
Contents is actually a matrix.
FullMatrix< inverse_type >::const_iterator b_iterator
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)
const Accessor * operator->() const
bool operator!=(const AlignedVector< T > &lhs, const AlignedVector< T > &rhs)
#define AssertIndexRange(index, range)
const_iterator end() const
Accessor(const PreconditionBlockJacobi< MatrixType, inverse_type > *matrix, const size_type row)
bool operator<(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)
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)
std::vector< size_type > inverse_permutation
bool operator==(const AlignedVector< T > &lhs, const AlignedVector< T > &rhs)
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()
FullMatrix< inverse_type > & inverse(size_type i)
bool operator!=(const const_iterator &) const
bool operator==(const const_iterator &) const
#define Assert(cond, exc)
value_type el(size_type i, size_type j) const
bool store_diagonals() const
#define DeclException0(Exception0)
#define DEAL_II_NAMESPACE_CLOSE
VectorType::value_type * end(VectorType &V)
PreconditionBlockBase< inverse_type >::Inversion inversion
iterator end(const size_type r)
SynchronousIterators< Iterators > operator++(SynchronousIterators< Iterators > &a)
const_iterator begin() const
PreconditionBlock(bool store_diagonals=false)
MatrixTableIterators::Accessor< TransposeTable< T >, Constness, MatrixTableIterators::Storage::column_major > Accessor
void forward_step(Vector< number2 > &dst, const Vector< number2 > &prev, const Vector< number2 > &src, const bool transpose_diagonal) const
static ::ExceptionBase & ExcIteratorPastEnd()
unsigned int global_dof_index
std::vector< size_type > permutation
#define DEAL_II_NAMESPACE_OPEN
VectorType::value_type * begin(VectorType &V)
const Accessor & operator*() const
unsigned int size() const
void invert_permuted_diagblocks()
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, std::complex< U > >::type >::type operator*(const std::complex< T > &left, const std::complex< U > &right)
const PreconditionBlockJacobi< MatrixType, inverse_type > * matrix
iterator begin(const size_type r)
bool operator<(const const_iterator &) const
~PreconditionBlock() override=default