Skip to content
Snippets Groups Projects
Commit e0622c3b authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Add method BCRSMatrix::setIndicesNoSort()

This is similar to `setIndices()` but does not sort indices
after insertion which allows to avoid an additional sort
on an already sorted range. The latter e.g. is the case when
using sorted containers as it is done in `MatrixIndexSet`.
parent 86f3573c
No related branches found
No related tags found
1 merge request!550Add BCRSMatrix::setIndicesNoSort() and speedup MatrixIndexSet::exportIdx()
......@@ -1219,11 +1219,35 @@ namespace Dune {
*pos = col;
}
//! Set all column indices for row from the given iterator range.
/**
* The iterator range has to be of the same length as the previously set row size.
* The entries in the iterator range must be sorted and must not contain duplicate values.
* This method will insert the indices in the given order.
*
* Calling this method overwrites any previously set column indices!
*
*/
template<typename It>
void setIndicesNoSort(size_type row, It begin, It end)
{
size_type row_size = r[row].size();
size_type* col_begin = r[row].getindexptr();
size_type* col_end;
// consistency check between allocated row size and number of passed column indices
if ((col_end = std::copy(begin,end,r[row].getindexptr())) != col_begin + row_size)
DUNE_THROW(BCRSMatrixError,"Given size of row " << row
<< " (" << row_size
<< ") does not match number of passed entries (" << (col_end - col_begin) << ")");
}
//! Set all column indices for row from the given iterator range.
/**
* The iterator range has to be of the same length as the previously set row size.
* The entries in the iterator range do not have to be in any particular order, but
* must not contain duplicate values.
* This method will insert the indices and sort them afterwards.
*
* Calling this method overwrites any previously set column indices!
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment