C++ SparseMatrix constructor surprise

Hi all,

I ran into a small SparseMatrix constructor surprise. The constructor I call is

SparseMatrix (int height, int width, const Table<int> & rowelements, 
	  const Table<int> & colelements, bool symmetric)

So I expected the tables I pass to be safe.
However, it seems the call chain eventually reaches MatrixGraph(...) with FlatTable<int> arguments, and there the column table is sorted. This reorders the original const Table<int> & passed to SparseMatrix constructor.

Since I later use the same table to AddElementMatrix, I ran into some surprise, as my local matrix does not agree with the newly sorted dofs.

Is this intended behavior?
If reordering of the original table is intended, it might be nicer to pass FlatTable<int> in SparseMatrix constructor?

Thanks!

thanks - good point, changed to FlatTable.

Joachim

1 Like