3#ifndef DUNE_COLCOMPSPMATRIX_HH
4#define DUNE_COLCOMPSPMATRIX_HH
7#include <dune/istl/bccsmatrixinitializer.hh>
11#ifndef DUNE_ISTL_COLCOMPMATRIX_HH
14 template <
class M,
class RowIndex =
int>
15 struct ColCompMatrix :
public ISTL::Impl::BCCSMatrix< typename M::field_type, RowIndex>{};
22 template<
class M,
class RowIndex=
int>
37 template <
class T,
class IndexT,
class ValuesVector,
class IndicesVector,
class RowIndex>
38 class ColCompMatrix< Fem::SparseRowMatrix<T,IndexT,ValuesVector,IndicesVector>, RowIndex >
61 N_(0), M_(0), Nnz_(0), values_(0), rowindex_(0), colstart_(0)
126 colstart_[i]=mat.colstart[i];
130 values_ =
new T[Nnz_];
133 values_[i]=mat.values[i];
135 rowindex_[i]=mat.rowindex[i];
168 const auto pairIdx(mat.
realValue( col ));
169 if( pairIdx.second!=Matrix::defaultCol )
171 ++(colstart_[pairIdx.second+1]);
178 std::vector<int> tempPos(M_,0);
181 colstart_[i]+=colstart_[i-1];
182 tempPos[i-1]=colstart_[i-1];
188 for(
size_type row = 0; row < N_ ; ++ row)
193 const auto pairIdx(mat.
realValue( col ));
194 if(pairIdx.second!=Matrix::defaultCol)
196 values_[tempPos[pairIdx.second]] = pairIdx.first;
197 rowindex_[tempPos[pairIdx.second]] = row ;
198 ++(tempPos[pairIdx.second]);
210 RowIndexType* rowindex_;
211 RowIndexType* colstart_;
Definition: bindguard.hh:11
Definition: colcompspmatrix.hh:23
void free()
Free allocated space.
Definition: colcompspmatrix.hh:141
virtual void setMatrix(const Matrix &mat)
Initialize data from given matrix.
Definition: colcompspmatrix.hh:152
ThisType & operator=(const Matrix &mat)
Definition: colcompspmatrix.hh:107
RowIndexType * getColStart() const
Get the column start indices.
Definition: colcompspmatrix.hh:102
size_type M() const
Get the number of columns.
Definition: colcompspmatrix.hh:84
virtual ~ColCompMatrix()
Destructor.
Definition: colcompspmatrix.hh:65
ColCompMatrix(const Matrix &mat)
Constructor that initializes the data.
Definition: colcompspmatrix.hh:54
size_type nnz() const
Get the number of non zero entries.
Definition: colcompspmatrix.hh:78
Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector > Matrix
The type of the matrix to convert.
Definition: colcompspmatrix.hh:44
size_type N() const
Get the number of rows.
Definition: colcompspmatrix.hh:72
Matrix::size_type size_type
Definition: colcompspmatrix.hh:46
ColCompMatrix()
Empty constructor.
Definition: colcompspmatrix.hh:60
ColCompMatrix< Fem::SparseRowMatrix< T, IndexT, ValuesVector, IndicesVector > > ThisType
The type of the matrix converted.
Definition: colcompspmatrix.hh:42
RowIndex RowIndexType
Definition: colcompspmatrix.hh:48
T * getValues() const
Get the non-zero entries of the matrix.
Definition: colcompspmatrix.hh:90
RowIndexType * getRowIndex() const
Get the row indices of the non-zero entries of the matrix.
Definition: colcompspmatrix.hh:96
ThisType & operator=(const ThisType &mat)
Definition: colcompspmatrix.hh:115
SparseRowMatrix.
Definition: spmatrix.hh:40
std::pair< const field_type, size_type > realValue(size_type index) const
Definition: spmatrix.hh:246
size_type endRow(const size_type row) const
Definition: spmatrix.hh:331
IndexT size_type
matrix index type
Definition: spmatrix.hh:45
size_type startRow(const size_type row) const
Definition: spmatrix.hh:326
size_type rows() const
return number of rows
Definition: spmatrix.hh:109
size_type cols() const
return number of columns
Definition: spmatrix.hh:115