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

Carsten Gräser graeser at math.fu-berlin.de
Fri Jan 7 12:06:42 CET 2011


Am 07.01.2011 11:32, schrieb Andreas Dedner:
> Hi,
> 
> we decided to change the mechanism for storing Entities (I forgot the
> final name but it started of as EntityKey...)
> Perhaps we should add an IntersectionKey (this is a question for the
> grid developers of course...)?
This would adress the question how to store an Intersection in a memory
efficient way which it a different issue. IMHO we should first decide
how to return Intersections in custom methods: Intersection or IntersectionIterator.

Unfortunately we did not have any decision on the proposal to return
copies of Entity instead of EntityPointer. If we want to have this
change Intersections should also remain copyable. If not removing
copy constructor and assignement is perhaps a little cleaner. However
this should be (conceptually) deprecated for one release.

Thus I propose to keep them until we decided on the Entity proposal.
Otherwise users might end up changing from Intersection to
IntersectionIterator and vice versa a few weeks/months later.

Best,
Carsten


On the other
> Andreas
> 
> On 07/01/11 10:28, Carsten Gräser wrote:
>> Am 07.01.2011 11:12, schrieb Carsten Gräser:
>>   
>>> Hi,
>>> altough this comment is a little late:
>>>
>>> Was there any discussion on this interface change?
>>> Even if we agree to forbid the copy constructor
>>> and assignment they should at least remain public
>>> for the next release.
>>>     
>> Personally I'm not completely sure if we should forbid them:
>>
>> Having the view-concept in mind one might argue that
>> intersections are similar to entities and should thus
>> not be copied.
>>
>> On the other hand there are use cases where one would
>> like to store/return Intersections in some way.
>> While there is an explicit mechanism for Enity (the
>> EntityPointer) there is no such mechanism for Intersection.
>> Hence one must store/return IntersectionIterators that are
>> intended for iterating and nor for storing.
>>
>> Best,
>> Carsten
>>
>>
>>
>>   
>>> In case we want to remove them: Is anyone aware of
>>> a mechanism that generates warnings only if it's
>>> used in a public context?
>>>
>>> Best,
>>> Carsten
>>>
>>>
>>> Am 27.11.2010 13:56, schrieb mnolte at dune-project.org:
>>>     
>>>> Author: mnolte
>>>> Date: 2010-11-27 13:56:58 +0100 (Sat, 27 Nov 2010)
>>>> New Revision: 7145
>>>>
>>>> Modified:
>>>>    trunk/dune/grid/common/intersection.hh
>>>> Log:
>>>> make copy constructor protected. Intersections, like entities, may not be copied or assigned to
>>>>
>>>>
>>>> Modified: trunk/dune/grid/common/intersection.hh
>>>> ===================================================================
>>>> --- trunk/dune/grid/common/intersection.hh	2010-11-27 12:45:59 UTC (rev 7144)
>>>> +++ trunk/dune/grid/common/intersection.hh	2010-11-27 12:56:58 UTC (rev 7145)
>>>> @@ -407,10 +407,6 @@
>>>>    /** Copy Constructor from IntersectionImp */
>>>>    Intersection(const IntersectionImp<const GridImp> & i) :
>>>>      real(i) {};
>>>> -
>>>> -  /** Copy constructor */
>>>> -  Intersection(const Intersection& i) :
>>>> -    real(i.real) {}
>>>>    //@}
>>>>  
>>>>    typedef typename remove_const<GridImp>::type mutableGridImp;
>>>> @@ -430,6 +426,17 @@
>>>>    //! return reference to the real implementation 
>>>>    const ImplementationType & getRealImp() const { return real; }
>>>>  
>>>> +  /* hide copy constructor */
>>>> +  Intersection ( const Intersection &i )
>>>> +  : real( i.real )
>>>> +  {}
>>>> +
>>>> +  /* hide assignment operator */
>>>> +  const Intersection &operator= ( const Intersection &i )
>>>> +  {
>>>> +    real = i.real;
>>>> +    return *this;
>>>> +  }
>>>>  };




More information about the Dune mailing list