Go to the documentation of this file.
3 #ifndef DUNE_ISTL_MATRIXINDEXSET_HH
4 #define DUNE_ISTL_MATRIXINDEXSET_HH
25 indices_.resize(rows_);
32 indices_.resize(rows_);
37 indices_[i].insert(j);
44 entries += indices_[i].
size();
62 template <
class MatrixType>
65 typedef typename MatrixType::row_type RowType;
66 typedef typename RowType::ConstIterator ColumnIterator;
68 for (
size_type rowIdx=0; rowIdx<m.N(); rowIdx++) {
70 const RowType& row = m[rowIdx];
72 ColumnIterator cIt = row.begin();
73 ColumnIterator cEndIt = row.end();
75 for(; cIt!=cEndIt; ++cIt)
76 add(rowIdx+rowOffset, cIt.index()+colOffset);
87 template <
class MatrixType>
90 matrix.setSize(rows_, cols_);
91 matrix.setBuildMode(MatrixType::random);
94 matrix.setrowsize(i, indices_[i].size());
100 typename std::set<size_type>::iterator it = indices_[i].begin();
101 for (; it!=indices_[i].end(); ++it)
102 matrix.addindex(i, *it);
112 std::vector<std::set<size_type> > indices_;
MatrixIndexSet()
Default constructor.
Definition: matrixindexset.hh:20
void resize(size_type rows, size_type cols)
Reset the size of an index set.
Definition: matrixindexset.hh:29
void exportIdx(MatrixType &matrix) const
Initializes a BCRSMatrix with the indices contained in this MatrixIndexSet.
Definition: matrixindexset.hh:88
size_type size() const
Return the number of entries.
Definition: matrixindexset.hh:41
MatrixIndexSet(size_type rows, size_type cols)
Constructor setting the matrix size.
Definition: matrixindexset.hh:24
std::size_t size_type
Definition: matrixindexset.hh:17
size_type rowsize(size_type row) const
Return the number of entries in a given row.
Definition: matrixindexset.hh:54
size_type rows() const
Return the number of rows.
Definition: matrixindexset.hh:50
Definition: allocator.hh:7
Stores the nonzero entries in a sparse matrix.
Definition: matrixindexset.hh:13
void add(size_type i, size_type j)
Add an index to the index set.
Definition: matrixindexset.hh:36