[Dune] dune-geometry r44

Martin Nolte nolte at mathematik.uni-freiburg.de
Mon Feb 20 17:36:47 CET 2012


Hi Jö,

I like your solution and implemented it. The question whether making code 
fool-proof is worth it has to be asked to others. I'm on your side.

Best,

Martin

On 02/20/2012 05:27 PM, Jö Fahlke wrote:
> Am Mon, 20. Feb 2012, 16:37:56 +0100 schrieb Martin Nolte:
>> no, that was indeed not intended and is hopefully fixed. All I
>> wanted is to use a Dune::array to store the reference elements
>> instead of a C array, so I could provide iterators without
>> additional work.
>>
>> Originally, this Dune::array stored GenericReferenceElement<  ...>
>> and, hence, its value_type was exactly what we wanted to export.
>> Unfortunately, the constructor (and destructor) of
>> GenericReferenceElement is private and, hence, the Dune::array had
>> no constructor. To circumvent this, I added a nasty hack: The
>> Dune::array now actually stores a derived type with a public
>> constructor / desctructor. If anyone knows a better trick, I'd be
>> thankful.
>
> Well, for instance you could use C-pointers as iterators, which is perfectly
> legal.  This way you could go with the original C-array.
>
> Or make the constructors public.  I mean, it is a nice idea to guide the users
> into not writing inefficient code by preventing them from recreating reference
> elements that already exist as singletons.  But when I look at the hoops the
> code has to jump through to prevent this, I wonder whether it is worth it.
>
> Bye,
> Jö.
>

-- 
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5630
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list