Skip to content
Snippets Groups Projects
Commit 70bb78cd authored by Christoph Gersbacher's avatar Christoph Gersbacher
Browse files

[DenseMatrix] Use default implementation DenseMatrixAssigner in assignment from primitive types

The default implementation of DenseMatrixAssigner replaces redundant
code in dense matrix constructors taking a primitive data type.
parent 0725aff8
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,8 @@ namespace Dune
representing a field and a compile-time given number of rows and columns.
*/
/**
\brief you have to specialize this structure for any type that should be assignable to a DenseMatrix
\tparam DenseMatrix Some type implementing the dense matrix interface
......@@ -71,6 +73,16 @@ namespace Dune
template< class DenseMatrix, class K, int N, int M >
void istl_assign_to_fmatrix ( DenseMatrix &denseMatrix, const K (&values)[ M ][ N ] )
{
for( int i = 0; i < N; ++i )
for( int j = 0; j < M; ++j )
denseMatrix[ i ][ j ] = values[ i ][ j ];
}
#ifndef DOXYGEN
namespace
{
......@@ -134,7 +146,7 @@ namespace Dune
{
static void apply ( M &m, const T &t )
{
static_assert( Conversion< T, typename DenseMatrix::field_type >::exists, "No specialization found" );
static_assert( Conversion< T, M >::exists, "No specialization found" );
m = static_cast< const M & >( t );
}
};
......
......@@ -90,11 +90,6 @@ namespace Dune
/** \brief Constructor initializing the whole matrix with a scalar
*/
explicit FieldMatrix ( typename Base::field_type value )
{
_data.fill( row_type( value ) );
}
template< class Other >
FieldMatrix ( const Other &other )
{
......
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