[Dune] [Dune-Commit] dune-grid r5977 - trunk/dune/grid/common

Carsten Gräser graeser at math.fu-berlin.de
Tue Nov 24 21:50:21 CET 2009


Hi Martin,

You're right that checking 'this!=&other' was not intended.
(Unfortunately my test case was wrong.) On the other hand
the check was there on purpose. On the meeting everyone
assumed that you can assign GridViews and that this is the
way to update them.
Today I discovered that this is not possible. Andreas and
I were not sure whether we really want to allow assignment
from other grids or levels and thus decided to forbid this.

Regards
Carsten


Martin Nolte schrieb:
> Hi Carsten,
> 
> it would be nice, if the decisions from yesterday would be known to everybody 
> _before_ any of the changes are made. In this special case, the change was 
> wrong and I had no idea about the semantics decided upon.
> 
> Yours,
> 
> Martin
> 
> graeser at dune-project.org wrote:
>> Author: graeser
>> Date: 2009-11-24 14:17:51 +0100 (Tue, 24 Nov 2009)
>> New Revision: 5977
>>
>> Modified:
>>    trunk/dune/grid/common/defaultgridview.hh
>> Log:
>> Unhide assignment operator
>>
>> As decided on the last meeting the assignment from a new
>> gridview must be used to ensure usability after a grid change.
>>
>>
>> Modified: trunk/dune/grid/common/defaultgridview.hh
>> ===================================================================
>> --- trunk/dune/grid/common/defaultgridview.hh	2009-11-24 10:54:20 UTC (rev 5976)
>> +++ trunk/dune/grid/common/defaultgridview.hh	2009-11-24 13:17:51 UTC (rev 5977)
>> @@ -1,3 +1,5 @@
>> +// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
>> +// vi: set et ts=8 sw=2 sts=2:
>>  #ifndef DUNE_DEFAULTGRIDVIEW_HH
>>  #define DUNE_DEFAULTGRIDVIEW_HH
>>  
>> @@ -2,2 +4,3 @@
>>  #include <dune/common/typetraits.hh>
>> +#include <dune/common/exceptions.hh>
>>  
>> @@ -114,11 +117,13 @@
>>        level_( other.level_ )
>>      {}
>>  
>> -  private:
>> -    // prohibit assignment
>> -    ThisType &operator= ( const ThisType & );
>> +    /** \brief assignment from other GridView on the same grid */
>> +    ThisType &operator= ( const ThisType & other)
>> +    {
>> +      if ((this != &other) or (level_ != other.level_))
>> +        DUNE_THROW(Dune::Exception, "You can only assign a GridView on the same grid and level!");
>> +    }
>>  
>> -  public:
>>      /** \brief obtain a const reference to the underlying hierarchic grid */
>>      const Grid &grid () const
>>      {
>> @@ -308,11 +313,13 @@
>>        indexSet_( other.indexSet_ )
>>      {}
>>  
>> -  private:
>> -    // prohibit assignment
>> -    ThisType &operator= ( const ThisType & );
>> +    /** \brief assignment from other GridView on the same grid */
>> +    ThisType &operator= ( const ThisType & other)
>> +    {
>> +      if (this != &other)
>> +        DUNE_THROW(Dune::Exception, "You can only assign a GridView on the same grid!");
>> +    }
>>  
>> -  public:
>>      /** \brief obtain a const reference to the underlying hierarchic grid */
>>      const Grid &grid () const
>>      {

-- 
----------------------------------------------------------------------
Carsten Gräser           | phone: +49-30 / 838-75349
Freie Universität Berlin | fax  : +49-30 / 838-54977
Institut für Mathematik  | email: graeser at math.fu-berlin.de
Arnimallee 6             |
14195 Berlin, Germany    | URL  : http://page.mi.fu-berlin.de/graeser
----------------------------------------------------------------------




More information about the Dune mailing list