[Dune] [Dune-Commit] dune-common r6512 - trunk/dune/common

Markus Blatt Markus.Blatt at iwr.uni-heidelberg.de
Thu Oct 13 11:29:16 CEST 2011


Hi,

On Thu, Oct 13, 2011 at 11:08:39AM +0200, mnolte at dune-project.org wrote:
> Author: mnolte
> Date: 2011-10-13 11:08:39 +0200 (Thu, 13 Oct 2011)
> New Revision: 6512
> 
> Modified:
>    trunk/dune/common/densematrix.hh
>    trunk/dune/common/dynmatrix.hh
>    trunk/dune/common/fmatrix.hh
> Log:
> allow row references to be modelled by an arbitrary object, not just row_type &
> 
> 
> Modified: trunk/dune/common/densematrix.hh
> ===================================================================
> --- trunk/dune/common/densematrix.hh	2011-10-12 15:02:29 UTC (rev 6511)
> +++ trunk/dune/common/densematrix.hh	2011-10-13 09:08:39 UTC (rev 6512)
> @@ -138,8 +138,14 @@
>      typedef typename Traits::size_type size_type;
>      
>      //! The type used to represent a row (must fulfill the Dune::DenseVector interface)
> -    typedef typename Traits::row_type row_type; 
> +    typedef typename Traits::row_type row_type;
>  
> +    //! The type used to represent a reference to a row (usually row_type &)
> +    typedef typename Traits::row_reference row_reference;
> +
> +    //! The type used to represent a reference to a constant row (usually const row_type &)
> +    typedef typename Traits::const_row_reference const_row_reference;
> +
>      //! We are at the leaf of the block recursion
>      enum {
>        //! The number of block levels we contain. This is 1.
> @@ -149,12 +155,12 @@
>      //===== access to components
>      
>      //! random access
> -    row_type & operator[] (size_type i)
> +    row_reference operator[] ( size_type i )
>      {
>        return asImp().mat_access(i);
>      }
>      
> -    const row_type & operator[] (size_type i) const
> +    const_row_reference operator[] ( size_type i ) const
>      {
>        return asImp().mat_access(i);
>      }
> 


I am a bit confused now. Personally I would consider this an EXTENSIVE
interface change. Therefore I am missing the discussion BEFORE
implementing it.

Of course all the code will hopefully still work. But once there is
one implementation which uses a non-standard reference every part of
DUNE that does not use the new typedefs will (surprisingly to the
user) be broken.

Preventing this will be a lot of work as at least FieldMatrix is at
the core of DUNE and therefore the changes will be in a lot of
modules. Do you intend to make all these changes yourself?

Regards,

Markus




More information about the Dune mailing list