[Dune] Fwd: Re: [Dune-Commit] dune-common r6512 - trunk/dune/common

Martin Nolte nolte at mathematik.uni-freiburg.de
Thu Oct 13 11:55:11 CEST 2011



-------- Original Message --------
Subject: Re: [Dune] [Dune-Commit] dune-common r6512 - trunk/dune/common
Date: Thu, 13 Oct 2011 10:54:37 +0100
From: Martin Nolte <nolte at mathematik.uni-freiburg.de>
To: Markus Blatt <Markus.Blatt at iwr.uni-heidelberg.de>

Hi Markus,

I do not consider this an interface change, since all existing codes
will keep working unless you define row_reference to something other
than row_type &. And I do not intend to do such a thing to the
FieldMatrix, which is indeed so deeply in the core of DUNE that such a
change is nearly impossible.

The reason for the change is to allow containers that store all values
in a single array (e.g., a FieldVector). If you do this, the row has to
be a dummy object that cannot be referenced (in the standard C++ sense).
However, all required information is so small that you can actually
store it in the reference itself, once this is allowed to be an object.

So, if you feel like voting on this, go ahead and create a FlySpray
entry on this. My vote is clear.

Best,

Martin

On 10/13/2011 10:29 AM, Markus Blatt wrote:
> 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
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune




More information about the Dune mailing list