5#ifndef DUNE_ISTL_BDMATRIX_HH
6#define DUNE_ISTL_BDMATRIX_HH
10#include <dune/common/rangeutilities.hh>
11#include <dune/common/scalarmatrixview.hh>
31 template <
class B,
class A=std::allocator<B> >
39 using field_type =
typename Imp::BlockTraits<B>::field_type;
54 [[deprecated(
"Use free function blockLevel(). Will be removed after 2.8.")]]
55 static constexpr unsigned int blocklevel = blockLevel<B>()+1;
63 for (
int i=0; i<size; i++)
68 for (
int i=0; i<size; i++)
76 BDMatrix (std::initializer_list<B>
const &list)
80 for (
auto it = list.begin(); it != list.end(); ++it, ++i)
91 for (
auto i : range(size))
96 for (
auto i : range(size))
120 void solve (V& x,
const V& rhs)
const {
123 auto&& xv = Impl::asVector(x[i]);
124 auto&& rhsv = Impl::asVector(rhs[i]);
125 Impl::asMatrix((*
this)[i][i]).solve(xv,rhsv);
132 Impl::asMatrix((*
this)[i][i]).
invert();
146 void endrowsizes () {}
148 void endindices () {}
151 template<
typename B,
typename A>
155 using real_type =
typename FieldTraits<field_type>::real_type;
Helper functions for determining the vector/matrix block level.
Implementation of the BCRSMatrix class.
Col col
Definition matrixmatrix.hh:351
Definition allocator.hh:11
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
void endrowsizes()
indicate that size of all rows is defined
Definition bcrsmatrix.hh:1149
@ random
Build entries randomly.
Definition bcrsmatrix.hh:530
void endindices()
indicate that all indices are defined, check consistency
Definition bcrsmatrix.hh:1248
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:1972
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:861
BCRSMatrix & operator=(const BCRSMatrix &Mat)
assignment
Definition bcrsmatrix.hh:911
A block-diagonal matrix.
Definition bdmatrix.hh:33
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bdmatrix.hh:39
A::size_type size_type
implement row_type with compressed vector
Definition bdmatrix.hh:51
BDMatrix()
Default constructor.
Definition bdmatrix.hh:58
BDMatrix(std::initializer_list< B > const &list)
Construct from a std::initializer_list.
Definition bdmatrix.hh:76
B block_type
export the type representing the components
Definition bdmatrix.hh:42
void solve(V &x, const V &rhs) const
Solve the system Ax=b in O(n) time.
Definition bdmatrix.hh:120
A allocator_type
export the allocator type
Definition bdmatrix.hh:45
BDMatrix(int size)
Definition bdmatrix.hh:60
BDMatrix & operator=(const BDMatrix &other)
assignment
Definition bdmatrix.hh:103
static constexpr unsigned int blocklevel
increment block level counter
Definition bdmatrix.hh:55
void setSize(size_type size)
Resize the matrix. Invalidates the content!
Definition bdmatrix.hh:85
void invert()
Inverts the matrix.
Definition bdmatrix.hh:130
typename BDMatrix< B, A >::field_type field_type
Definition bdmatrix.hh:154
typename FieldTraits< field_type >::real_type real_type
Definition bdmatrix.hh:155