5#ifndef DUNE_ISTL_MATRIXINDEXSET_HH
6#define DUNE_ISTL_MATRIXINDEXSET_HH
27 indices_.resize(rows_);
34 indices_.resize(rows_);
39 indices_[i].insert(j);
46 entries += indices_[i].
size();
64 template <
class MatrixType>
67 typedef typename MatrixType::row_type RowType;
68 typedef typename RowType::ConstIterator ColumnIterator;
70 for (
size_type rowIdx=0; rowIdx<m.N(); rowIdx++) {
72 const RowType& row = m[rowIdx];
74 ColumnIterator cIt = row.begin();
75 ColumnIterator cEndIt = row.end();
77 for(; cIt!=cEndIt; ++cIt)
78 add(rowIdx+rowOffset, cIt.index()+colOffset);
89 template <
class MatrixType>
92 matrix.setSize(rows_, cols_);
93 matrix.setBuildMode(MatrixType::random);
96 matrix.setrowsize(i, indices_[i].size());
102 typename std::set<size_type>::iterator it = indices_[i].begin();
103 for (; it!=indices_[i].end(); ++it)
104 matrix.addindex(i, *it);
114 std::vector<std::set<size_type> > indices_;
Definition allocator.hh:11
Stores the nonzero entries in a sparse matrix.
Definition matrixindexset.hh:16
void resize(size_type rows, size_type cols)
Reset the size of an index set.
Definition matrixindexset.hh:31
MatrixIndexSet()
Default constructor.
Definition matrixindexset.hh:22
void add(size_type i, size_type j)
Add an index to the index set.
Definition matrixindexset.hh:38
size_type rows() const
Return the number of rows.
Definition matrixindexset.hh:52
std::size_t size_type
Definition matrixindexset.hh:19
void exportIdx(MatrixType &matrix) const
Initializes a BCRSMatrix with the indices contained in this MatrixIndexSet.
Definition matrixindexset.hh:90
MatrixIndexSet(size_type rows, size_type cols)
Constructor setting the matrix size.
Definition matrixindexset.hh:26
size_type rowsize(size_type row) const
Return the number of entries in a given row.
Definition matrixindexset.hh:56
size_type size() const
Return the number of entries.
Definition matrixindexset.hh:43