← Back to team overview

dolfin team mailing list archive

Re: [noreply@xxxxxxxxxxxxx: [Branch ~dolfin-core/dolfin/main] Rev 4333: Add outline of a new Array class.]

 


Anders Logg wrote:
> On Sun, Dec 06, 2009 at 12:46:53PM +0000, Garth N. Wells wrote:
>>
>> Anders Logg wrote:
>>> Shouldn't this be templated? This could be used also for passing uint
>>> arrays to and from Python.
>>>
>> It probably should be, but it may make things more complicated on the
>> SWIG side. Perhaps Johan H. could comment - not on whether it's possible
>> (I'm sure for Johan that it is), but on whether or not it's easy.
>>
>> Templating it would be better on the C++ side, not just for double, int,
>> etc, but to handle const pointers correctly.
> 
> ok.
> 
>>> I imagine we can typedef
>>>
>>>   DoubleArray
>>>   UintArray
>>>
>> This is a bit ugly. Might as well just use Array<double>, Array<uint>, etc.
> 
> I agree it's ugly. I didn't suggest it for use in C++ but that it
> might simplify for the wrapper generators but when I think of it
> again, it probably makes no difference for SWIG.
>

As a start, we can declare the templates with these names in SWIG, and
SWIG will wrap the member functions and it should work out of the box
(with a few tweaks for [] and =).

Later, we can provide typemaps for cases where we want to map an Array
to a NumPy array.

Garth

> --
> Anders





Follow ups

References