3 #ifndef DUNE_COLCOMPSPMATRIX_HH
4 #define DUNE_COLCOMPSPMATRIX_HH
7 #include <dune/istl/colcompmatrix.hh>
48 N_(0), M_(0), Nnz_(0), values_(0), rowindex_(0), colstart_(0)
111 colstart_=
new int[M_+1];
113 colstart_[i]=mat.colstart[i];
117 values_ =
new B[Nnz_];
118 rowindex_ =
new int[Nnz_];
120 values_[i]=mat.values[i];
122 rowindex_[i]=mat.rowindex[i];
145 colstart_=
new int[M_+1];
155 const auto pairIdx(mat.
realValue(count));
156 if(pairIdx.second!=Matrix::defaultCol)
157 ++(colstart_[pairIdx.second+1]);
162 std::vector<int> tempPos(M_,0);
165 colstart_[i]+=colstart_[i-1];
166 tempPos[i-1]=colstart_[i-1];
171 rowindex_=
new int[Nnz_];
177 const auto pairIdx(mat.
realValue(count));
178 if(pairIdx.second!=Matrix::defaultCol)
180 values_[tempPos[pairIdx.second]]=pairIdx.first;
181 rowindex_[tempPos[pairIdx.second]]=i;
182 ++(tempPos[pairIdx.second]);
Definition: bindguard.hh:11
Definition: colcompspmatrix.hh:12
Converter for SparseRowMatrix to column-compressed matrix. Specialization for SparseRowMatrix.
Definition: colcompspmatrix.hh:28
int * getRowIndex() const
Get the row indices of the non-zero entries of the matrix.
Definition: colcompspmatrix.hh:83
ColCompMatrix< Fem::SparseRowMatrix< B > > ThisType
The type of the matrix converted.
Definition: colcompspmatrix.hh:31
size_type N() const
Get the number of rows.
Definition: colcompspmatrix.hh:59
ThisType & operator=(const Matrix &mat)
Definition: colcompspmatrix.hh:94
int * getColStart() const
Get the column start indices.
Definition: colcompspmatrix.hh:89
Fem::SparseRowMatrix< B > Matrix
The type of the matrix to convert.
Definition: colcompspmatrix.hh:33
B * getValues() const
Get the non-zero entries of the matrix.
Definition: colcompspmatrix.hh:77
ColCompMatrix()
Empty constructor.
Definition: colcompspmatrix.hh:47
void free()
Free allocated space.
Definition: colcompspmatrix.hh:128
ColCompMatrix(const Matrix &mat)
Constructor that initializes the data.
Definition: colcompspmatrix.hh:41
virtual void setMatrix(const Matrix &mat)
Initialize data from given matrix.
Definition: colcompspmatrix.hh:139
ThisType & operator=(const ThisType &mat)
Definition: colcompspmatrix.hh:102
size_type M() const
Get the number of columns.
Definition: colcompspmatrix.hh:71
virtual ~ColCompMatrix()
Destructor.
Definition: colcompspmatrix.hh:52
Matrix::size_type size_type
Definition: colcompspmatrix.hh:35
size_type nnz() const
Get the number of non zero entries.
Definition: colcompspmatrix.hh:65
SparseRowMatrix.
Definition: spmatrix.hh:86
size_type cols() const
return number of columns
Definition: spmatrix.hh:130
size_type rows() const
return number of rows
Definition: spmatrix.hh:124
std::size_t size_type
matrix index type
Definition: spmatrix.hh:91
std::pair< const field_type, size_type > realValue(size_type index) const
Definition: spmatrix.hh:249
size_type numNonZeros() const
Definition: spmatrix.hh:235