[Dune] Feature request FieldVector
Adrian Burri
burriad at mathematik.uni-freiburg.de
Tue Mar 1 16:15:47 CET 2005
Hm, doesn't look like a clean solution either... But at least the mess
stays confined in my own code, so I settle for this solution!
(Nooooooobody touches the definition of FieldVector, alright?!)
Cheers
Adi
Oliver Sander wrote:
> Hi Adrian!
> If you claim to know details about the implementation of FieldVector,
> then you can get access to the underlying array by writing
>
> FieldVector<double, 69> aVector;
>
> double* array = &aVector[0];
>
> and there's no need to compromise the interface. Of course this
> breaks if someone changes the implementation, but you may be willing
> to take that risk.
>
> --
> Oliver
>
> ************************************************************************
> * Oliver Sander ** *
> * Freie Universität Berlin ** email: sander at math.fu-berlin.de *
> * Institut für Mathematik II ** phone: + 49 (30) 838 75217 *
> * Arnimallee 2-6 ** fax : + 49 (30) 838 54977 *
> * 14195 Berlin, Germany ** URL : www.math.fu-berlin.de/~sander *
> ************************************************************************
>
> On Tue, 1 Mar 2005, Adrian Burri wrote:
>
>> Hi all,
>>
>> I have a (probably quite controversial) feature request for the
>> FieldVector: I'd like to have a method that gives me direct access to
>> the underlying C-array, i.e. something like this
>> (&K)[n] array() { return p; }
>> I know this breaks encapsulation, it is a highly dangerous quirk and
>> against all principles of good software engineering, but I am
>> interfacing to a C-library for numerical flux functions and I don't
>> intend to copy my range vectors (2*nQuadpoints*nElements*dimRange
>> copies in one grid sweep...)
>> Those array() functions (the const and the non-const version) should
>> of course be tagged with a large warning sign!
>>
>> I am interested to hear your opinion on this issue.
>>
>> Cheers
>>
>> Adi
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at hal.iwr.uni-heidelberg.de
>> http://hal.iwr.uni-heidelberg.de/cgi-bin/mailman/listinfo/dune
>>
More information about the Dune
mailing list