Skip to content
Snippets Groups Projects
Commit 81d3d446 authored by Oliver Sander's avatar Oliver Sander
Browse files

Merge branch 'init-bdmatrix-from-initializer-list' into 'master'

Implement construction of BDMatrix from std::initializer_list

See merge request !108
parents b586302f 61183921
No related branches found
No related tags found
No related merge requests found
......@@ -65,6 +65,15 @@ namespace Dune {
}
/** \brief Construct from a std::initializer_list */
BDMatrix (std::initializer_list<B> const &list)
: BDMatrix(list.size())
{
size_t i=0;
for (auto it = list.begin(); it != list.end(); ++it, ++i)
(*this)[i][i] = *it;
}
//! assignment
BDMatrix& operator= (const BDMatrix& other) {
this->BCRSMatrix<B,A>::operator=(other);
......
......@@ -385,6 +385,10 @@ int main()
testSuperMatrix(bdMatrix);
// Test construction from initializer list
BDMatrix<FieldMatrix<double,2,2> > bdMatrix2 = { {{1,0},{0,1}}, {{0,1},{-1,0}}};
testSuperMatrix(bdMatrix2);
// ////////////////////////////////////////////////////////////////////////
// Test the BTDMatrix class -- a dynamic block-tridiagonal matrix
// a) the scalar case
......
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