bdmatrix.hh
Go to the documentation of this file.00001 #ifndef DUNE_BLOCK_DIAGONAL_MATRIX_HH
00002 #define DUNE_BLOCK_DIAGONAL_MATRIX_HH
00003
00004 #include <dune/istl/bcrsmatrix.hh>
00005
00011 namespace Dune {
00021 template <class B, class A=ISTLAllocator>
00022 class BDMatrix : public BCRSMatrix<B,A>
00023 {
00024 public:
00025
00026
00027
00029 typedef typename B::field_type field_type;
00030
00032 typedef B block_type;
00033
00035 typedef A allocator_type;
00036
00038
00039
00041 typedef typename A::size_type size_type;
00042
00044 enum {blocklevel = B::blocklevel+1};
00045
00047 BDMatrix() : BCRSMatrix<B,A>() {}
00048
00049 explicit BDMatrix(int size)
00050 : BCRSMatrix<B,A>(size, size, BCRSMatrix<B,A>::random) {
00051
00052 for (int i=0; i<size; i++)
00053 this->BCRSMatrix<B,A>::setrowsize(i, 1);
00054
00055 this->BCRSMatrix<B,A>::endrowsizes();
00056
00057 for (int i=0; i<size; i++)
00058 this->BCRSMatrix<B,A>::addindex(i, i);
00059
00060 this->BCRSMatrix<B,A>::endindices();
00061
00062 }
00063
00065 BDMatrix& operator= (const BDMatrix& other) {
00066 this->BCRSMatrix<B,A>::operator=(other);
00067 return *this;
00068 }
00069
00071 BDMatrix& operator= (const field_type& k) {
00072 this->BCRSMatrix<B,A>::operator=(k);
00073 return *this;
00074 }
00075
00077 void invert() {
00078 for (int i=0; i<this->N(); i++)
00079 (*this)[i][i].invert();
00080 }
00081
00082 private:
00083
00084
00085
00086
00087
00088
00089
00090
00091 void setrowsize (size_type i, size_type s) {}
00092 void incrementrowsize (size_type i) {}
00093 void endrowsizes () {}
00094 void addindex (size_type row, size_type col) {}
00095 void endindices () {}
00096 };
00099 }
00100
00101 #endif